Skip to main content

Configuration File

Create a react-doctor.config.json file in your project root to customize React Doctor’s behavior.
react-doctor.config.json

Configuration Options

Scan Options

boolean
default:"true"
Enable or disable linting checks using oxlint.
boolean
default:"true"
Enable or disable dead code detection using Knip.
boolean
default:"false"
Show file details and line numbers for each diagnostic.
Example:

Diff Mode

boolean | string
default:"false"
Enable diff mode to scan only changed files.
  • false: Disabled
  • true: Auto-detect changes
  • "branch-name": Compare against specific branch (e.g., "main")
Examples:

Error Handling

'error' | 'warning' | 'none'
default:"none"
Control when React Doctor exits with an error code.
  • "error": Exit with code 1 only if errors are found
  • "warning": Exit with code 1 if any warnings or errors are found
  • "none": Never exit with error code
Example:
Use "failOn": "error" in CI to fail builds on errors while allowing warnings.

Ignore Configuration

object
Configure rules and files to ignore during scanning.
string[]
default:"[]"
Array of rule identifiers to ignore. Format: "plugin/rule-name"
string[]
default:"[]"
Array of glob patterns for files to ignore.
Example:

Complete Configuration Example

react-doctor.config.json

Configuration Priority

React Doctor resolves configuration in the following order (highest to lowest priority):
  1. CLI flags: Explicit command-line options
  2. Configuration file: react-doctor.config.json
  3. Defaults: Built-in default values
Example:
Even if react-doctor.config.json has "lint": true, the --no-lint flag takes precedence.

TypeScript Support

For TypeScript projects, you can use type definitions for better autocomplete:
react-doctor.config.json

Finding Rule Names

To find rule names for the ignore.rules array:
  1. Run React Doctor with --verbose flag:
  2. Look for the rule identifier in the output:
  3. Add to your config:

Common Patterns

Validation

React Doctor validates the configuration file on load. Invalid configurations will show an error:

Location

Place react-doctor.config.json in:
  • Project root (same directory as package.json)
  • Workspace root for monorepos
For monorepos, each workspace can have its own configuration file that overrides the root configuration.