Skip to content

feat: add per-file rule overrides to config#98

Open
MeinhartThomas wants to merge 1 commit intomillionco:mainfrom
MeinhartThomas:feat/per-file-rule-overrides
Open

feat: add per-file rule overrides to config#98
MeinhartThomas wants to merge 1 commit intomillionco:mainfrom
MeinhartThomas:feat/per-file-rule-overrides

Conversation

@MeinhartThomas
Copy link

Summary

  • Adds an overrides field to react-doctor.config.json that allows disabling specific rules for specific file patterns (similar to ESLint overrides)
  • Each override entry takes files (glob patterns) and ignore.rules (rule identifiers to suppress for those files)
  • Existing global ignore.rules and ignore.files behavior is unchanged

Example config

{
  "overrides": [
    {
      "files": ["src/legacy/**", "src/generated/**"],
      "ignore": {
        "rules": ["react-doctor/no-giant-component", "react/no-danger"]
      }
    },
    {
      "files": ["**/*.test.tsx"],
      "ignore": {
        "rules": ["knip/exports"]
      }
    }
  ]
}

Test plan

  • Override ignores a rule only for matching files (non-matching files keep the diagnostic)
  • Multiple overrides applying to different file patterns
  • Overrides combined with global ignore.rules and ignore.files
  • Empty/missing overrides array has no effect
  • Multiple file globs in a single override

Made with Cursor

Allow disabling specific rules for specific file patterns via a new
`overrides` field in react-doctor.config.json, similar to ESLint overrides.
@vercel
Copy link

vercel bot commented Mar 6, 2026

@MeinhartThomas is attempting to deploy a commit to the Million Team on Vercel.

A member of the Team first needs to authorize it.

Comment on lines +13 to +14
filePatterns: override.files.map(compileGlobPattern),
ignoredRules: new Set(override.ignore.rules),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
filePatterns: override.files.map(compileGlobPattern),
ignoredRules: new Set(override.ignore.rules),
filePatterns: Array.isArray(override.files) ? override.files.map(compileGlobPattern) : [],
ignoredRules: new Set(Array.isArray(override.ignore?.rules) ? override.ignore.rules : []),

The compileOverrides function crashes with "Cannot read properties of undefined" when processing malformed override configs missing ignore or files properties.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant