Skip to main content

Your First Scan

Navigate to your React project directory and run:
npx -y react-doctor@latest .
1

React Doctor starts scanning

React Doctor will detect your framework, React version, and begin analyzing your codebase.
react-doctor v0.0.29

Detected: Next.js 15.1.0, React 19.0.0
Running lint checks...
Running dead code detection...
2

Get your health score

Within seconds, you’ll receive a 0-100 score and summary of issues.
βœ“ Scan complete

Score: 84 (Great)

πŸ“Š Results:
  2 errors, 196 warnings
  80 unused files detected

Run with --verbose to see file details
3

Review diagnostics

React Doctor will show a summary by category. Add --verbose to see specific files and line numbers.

Understanding Your Score

React Doctor calculates a health score based on the severity and number of issues:

75+ Great

Your codebase is in excellent shape. Minor improvements may still be possible.

50-74 Needs Work

Some issues to address. Focus on errors first, then warnings.

<50 Critical

Significant problems detected. Prioritize fixing errors and major warnings.
Errors weigh more heavily than warnings in the score calculation.

Verbose Output

For detailed diagnostics with file paths and line numbers:
npx -y react-doctor@latest . --verbose
react-doctor v0.0.29

Detected: Next.js 15.1.0, React 19.0.0
Running lint checks...
Running dead code detection...

βœ“ Scan complete

Score: 84 (Great)

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

πŸ“Š Errors (2)

react-hooks/exhaustive-deps (2 files)
  src/components/Dashboard.tsx:45:3
  src/hooks/useData.ts:12:5

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

⚠️  Warnings (196)

react/no-unused-state (12 files)
  src/components/Form.tsx:20:3
  src/pages/Settings.tsx:35:5
  ...

knip/exports (80 files)
  src/utils/legacy.ts
  src/components/OldButton.tsx
  ...

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Common Options

Diff Mode

Scan only changed files compared to your main branch:
npx -y react-doctor@latest . --diff main
Diff mode is perfect for CI/CD pipelines and large codebases. It dramatically speeds up scans by focusing only on what changed.

Score Only

Output just the numeric score (useful for scripting):
npx -y react-doctor@latest . --score
84

Skip Lint or Dead Code

Disable specific analysis types:
# Skip linting, only run dead code detection
npx -y react-doctor@latest . --no-lint

# Skip dead code detection, only run linting
npx -y react-doctor@latest . --no-dead-code

Silent Mode (No Prompts)

Skip all interactive prompts:
npx -y react-doctor@latest . --yes
Use --yes in CI/CD environments to prevent the build from hanging on prompts.

Understanding Diagnostics

Each diagnostic includes:
  • Plugin/Rule: The source of the diagnostic (e.g., react-hooks/exhaustive-deps, knip/exports)
  • Severity: Either error or warning
  • File Path: Location of the issue
  • Line & Column: Exact position in the file
  • Message: Description of the issue
  • Category: Type of issue (performance, security, correctness, etc.)

Rule Categories

React Doctor checks 60+ rules across these categories:

State & Effects

useState, useEffect, useCallback, useMemo usage

Performance

Re-renders, bundle size, lazy loading

Security

XSS, dangerouslySetInnerHTML, unsafe patterns

Correctness

Prop types, key props, fragment usage

Accessibility

ARIA attributes, semantic HTML, keyboard nav

Architecture

Dead code, unused exports, duplicate code

Next.js

Image optimization, Link usage, metadata

React Native

Platform-specific issues and optimizations

Auto-Fix with Ami

React Doctor integrates with Ami, a coding agent built for React:
npx -y react-doctor@latest . --fix
Ami will:
  1. Read your React Doctor report
  2. Understand your codebase
  3. Fix issues one by one
  4. Re-run the scan to verify improvements
Ami is free to use and supports all React Doctor diagnostics. Learn more at ami.app

Next Steps

Configuration

Customize rules and ignore patterns for your project

GitHub Actions

Set up React Doctor in your CI/CD pipeline

API Reference

Use React Doctor programmatically in Node.js

Rules Reference

Explore all 60+ rules and their examples

Troubleshooting

Make sure you’re running the command from your project root where package.json is located.
Try using --diff mode to scan only changed files, or use --no-dead-code to skip dead code detection.
Create a react-doctor.config.json file to ignore specific rules or file patterns. See the Configuration guide.
React Doctor requires TypeScript 5.0.4 or higher. Update your TypeScript version:
npm install typescript@latest

Build docs developers (and LLMs) love