New
Introducing React Bench, see how different models perform on React code

CLI reference

Run React Doctor from the command line:

react-doctor [directory] [options]

If directory is omitted, React Doctor scans the current directory.

Common commands

npx react-doctor@latest
npx react-doctor@latest --verbose --scope changed
npx react-doctor@latest --category Security --json
npx react-doctor@latest ci install
npx react-doctor@latest rules list
npx react-doctor@latest install

Options

OptionDescription
-v, --versionPrint the installed version
--lint, --no-lintSkip lint diagnostics
--supply-chain, --no-supply-chainEnable or skip Socket.dev dependency checks
--verboseShow every rule and per-file details
--debugPrint the Sentry trace ID for a bug report
--output-dir <dir>Write the full diagnostics dump to a directory
--scoreOutput only the numeric score
--jsonOutput a structured JSON report
--category <category>

Show findings from one diagnostic category. Repeat the flag to include more categories

--json-compact

Emit compact JSON with --json

--json-out <path>

With --json, write the report to a file

-y, --yesSkip prompts and scan all detected workspace projects
--no-parallelLint serially with one worker
--project <name>

Select projects to scan, comma-separated. Accepts workspace package names or directory paths; * selects every workspace project

--scope <value>

Choose full, files, changed, or lines

--base <ref>Set the base ref for files, changed, or lines scope
--include-untracked

Include ordinary untracked files in a partial scope, respecting .gitignore

--no-score

Skip the score API, share URL, and crash reporting. React Doctor also accepts --no-telemetry

--stagedScan staged files for pre-commit hooks
--blocking <level>

Severity that fails CI: error (default), warning, or none (advisory)

--max-duration <seconds>Set a time budget and report partial results when it expires
--no-respect-inline-disablesAudit mode for inline disables
--warnings, --no-warningsShow or hide warning-severity diagnostics
--color, --no-colorForce or disable colored output

Scan scopes

Choose one scan scope with --scope:

  • full: scan the entire project and report every finding
  • files: scan changed files and report every finding in them
  • changed: compare with the base and report only introduced findings
  • lines: report findings whose source range touches a changed line

The default is full. React Doctor detects the base ref for partial scopes. Pass --base main when you need a specific ref. The older --diff flag still works as a deprecated alias for --scope changed.

Maintainability analysis compares repeated JSX against the full source corpus in every scope. Partial scopes report only findings connected to the selected files or changed lines.

Multi-project scans

Use --project to score each project in a monorepo separately. Each entry resolves as a workspace package name first, then as a directory path relative to the scan root:

npx react-doctor@latest --project modules/billing,modules/payroll

Directory paths cover monorepos whose modules are not workspace packages. --project "*" selects every discovered workspace project. Unknown entries fail the run before scanning starts.

Each project scans with its own doctor.config.* layered onto the root config: rules and categories merge per key, and ignore lists union. A module can override one rule without discarding the shared base config.

Output shows one score line per project plus a worst-of aggregate. JSON reports list each project in the projects array.

To score the same projects on every run without passing the flag, set projects in the root config file. An explicit --project flag overrides the config list.

Install command

npx react-doctor install [options]

Interactive setup installs the /react-doctor skill for selected coding agents and offers optional local hooks. Manage CI separately with react-doctor ci.

OptionDescription
-y, --yesSkip prompts and install the skill for all detected agents
--dry-runShow what would be installed
--agent-hooksInstall native Claude Code and Cursor hooks
--cwd <cwd>Project root for install

CI commands

Use the ci command group to manage a GitHub Actions workflow or GitLab CI scaffold:

npx react-doctor@latest ci install
npx react-doctor@latest ci config
npx react-doctor@latest ci upgrade

ci install accepts --provider, --pr, --blocking, --scope, reporting toggles, --yes, and --cwd. ci config accepts the same settings except --pr. ci upgrade accepts --provider, --pr, --yes, and --cwd.

Reporting toggles are --comment, --review-comments, and --commit-status, with a --no-* form for each one. GitHub Actions supports every toggle. GitLab CI produces a gate-only scaffold.

Rules commands

Inspect and configure the effective rule set:

npx react-doctor@latest rules list
npx react-doctor@latest rules explain react-doctor/no-array-index-as-key
npx react-doctor@latest rules set react-doctor/no-array-index-as-key error
npx react-doctor@latest rules disable react-doctor/no-danger
npx react-doctor@latest rules enable react-doctor/no-danger
npx react-doctor@latest rules category Performance warn
npx react-doctor@latest rules ignore-tag design
npx react-doctor@latest rules unignore-tag design

Filter rules list with --category, --tag, --framework, or --configured. Add --json to rules list or rules explain for structured output. Every rules subcommand accepts --cwd.

JSON output

Use --json when another tool needs to parse the scan:

npx react-doctor@latest --json

Human-readable output is suppressed. Errors still produce JSON with ok: false, so stdout remains parseable.

Use --category when you want a report for one part of the diagnostic set:

npx react-doctor@latest --json --category Performance

Repeat --category to include more than one category:

npx react-doctor@latest --category Performance --category Accessibility

Category filters narrow normal output, verbose output, workspace summaries, handoff prompts, and JSON reports. They do not change which files React Doctor scans. Unknown categories fail before report output.

Explain a diagnostic

Use the why subcommand when a diagnostic or suppression is confusing:

npx react-doctor@latest why src/App.tsx:42

The output reports what React Doctor sees at that location and why a nearby suppression did or didn't apply.

To learn what a rule means in general, use rules explain:

npx react-doctor@latest rules explain react-doctor/no-array-index-as-key