React Doctor: One‑command React health scanner with actionable fixes
React Doctor is a one‑command static scanner that scores React projects (0–100) and returns rule‑based, actionable diagnostics and fixes for CI, PRs, and local debugging.
GitHub millionco/react-doctor Updated 2026-05-12 Branch main Stars 12.5K Forks 396
React Static Analysis CI Integration Accessibility Performance Diagnostics

💡 Deep Analysis

4
What kinds of projects or teams are best suited for react-doctor, and in which scenarios is it not recommended?

Core Analysis

Core Issue: Adoption should be driven by tech stack, repo scale, and the need for static quality metrics.

  • Medium-to-large React apps: Complex state/effect logic, multi-team collaboration, and PR workflows benefit from anti-pattern detection.
  • Cross-platform projects: React Native + Web codebases gain from framework-aware rules to reduce cross-platform false positives.
  • Teams wanting measurable health: Those wanting a 0–100 health metric in CI/PR to track code quality over time.
  • Teams using/training coding agents: npx react-doctor install can embed best practices into code-generation agents.
  • Non-React projects: The rule set is React-focused and offers little value for Vue/Angular/back-end repos.
  • Small or disposable repos: Maintenance and config cost may outweigh benefits.
  • Restricted runtime environments: Repos that cannot run Node or install dependencies will struggle to integrate.

Practical Advice

  1. Run npx -y react-doctor@latest . as a trial to inspect score and top rule violations.
  2. Consider whether your team can maintain ignore lists and config—mid/large teams gain more.

Important: If your main issues are runtime-only, supplement static checks with tests and runtime monitoring.

Summary: Best for large React codebases needing semantic governance; not suitable as a primary tool in non-React or constrained environments.

87.0%
How to smoothly introduce react-doctor into existing CI/ESLint workflows while avoiding noise (false positives and third-party code)?

Core Analysis

Core Issue: The biggest friction when adding a new static checker is noise from vendor/generated files and improper suppressions.

Technical Analysis

  • Key capabilities:
  • react-doctor.config.json supports ignore.rules, ignore.files, and ignore.overrides for fine-grained control.
  • The tool respects .gitignore, .eslintignore, .oxlintignore and can merge existing lint configs (adoptExistingLintConfig).
  • GitHub Action integration can post PR comments and expose scores for visibility rather than immediate failure.

Practical Recommendations (phased rollout)

  1. Merge existing config: Enable adoptExistingLintConfig:true so react-doctor folds in current ESLint rules and avoids duplicate alerts.
  2. Exclude vendor/generated files: Add src/generated/**, node_modules/** or build output to ignore.files; use ignore.overrides for file-specific exceptions.
  3. Show, don’t block: Configure the Action to post comments (warnings) on PRs first, then escalate to fail-on progressively.
  4. Use incremental scans: Use --diff/--staged for large repos to limit CI time and focus on changed files.
  5. Debug suppressions: Run --explain when suppression annotations seem ineffective to correct annotation placement.

Important: Don’t flip all strict rules on in a large repo at once—converge gradually.

Summary: Merge lint configs, use fine-grained ignores, make PR feedback non-blocking initially, and use incremental scans to integrate react-doctor with minimal noise.

86.0%
How reliable is the tool for dead-code and unused-symbol detection? What common false positives occur and how to reduce them?

Core Analysis

Core Issue: Dead-code detection relies on static reachability analysis and has inherent blind spots with modern build and dynamic loading patterns.

Technical Analysis

  • Accurate cases:
  • Explicitly unused functions/variables/components not imported anywhere.
  • Modules whose static reference graph is fully resolvable.
  • Common false positives:
  • Dynamic imports / code-splitting: Imports computed from strings or runtime values are not statically resolvable.
  • Runtime registration/reflection: Frameworks/plugins registering components at runtime via conventions/metadata.
  • Dependency injection or service locators: Symbols injected or referenced via reflection at runtime.
  • Test/tooling references: Test runners or build tools referencing files only at runtime.

How to reduce false positives

  1. Configure ignores: Add generated or runtime-registered directories to ignore.files (e.g., src/generated/**, plugins/**).
  2. Explicit exports/annotations: Mark modules referenced at runtime with explicit exports or comments to aid static tooling or to be excluded.
  3. Use overrides: Use ignore.overrides to allow specific files exceptions while keeping other rules active.
  4. Prioritize diffs: Focus human review on changed files (--diff/--staged) to reduce noisy audits.

Important: Treat static dead-code detection as high-value but imperfect—great for explicit unused code, needing config for dynamic runtime patterns.

Summary: Reliable for most static cases; mitigate false positives in dynamic-loading or runtime-registration scenarios via config, annotations, and diff-first workflows.

86.0%
How can react-doctor be integrated with code-generating coding agents to reduce the likelihood of agents producing bad React code?

Core Analysis

Core Issue: Injecting static rules and explainability into coding agents enables prevention at generation time and creates a feedback loop for continuous improvement.

Technical Analysis

  • Built-in capability: npx react-doctor install can inject rules/guidance into many agents; the tool runs via CLI/Action/ESLint plugin and offers --explain to clarify rule triggers.
  • Integration paths:
  • Pre-generation: Seed agents’ prompts/templates with recommended rules, anti-pattern examples, and do/don’t lists.
  • Post-generation: Run react-doctor immediately on generated output and feed diagnostics back to the agent to request fixes.
  • CI gatekeeping: Use diff scans on agent PRs and post scores/comments as a quality gate or visibility metric.

Practical Recommendations

  1. Add concise rule summaries to agent prompts (e.g., avoid side effects during render; prefer useMemo/useCallback only when needed).
  2. Include react-doctor install in agent initialization so team rules are automatically applied.
  3. Implement a post-generation hook to run react-doctor and return --explain details to the agent for correction.
  4. Use --diff mode for agent-generated changes to minimize scan overhead.

Important: Agents must be able to receive injected rules and a feedback loop; otherwise you can only audit post-generation, not prevent errors at source.

Summary: A combined strategy—pre-populating prompts, automatic post-generation scans with feedback, and CI scoring—meaningfully reduces bad React code from agents and helps bake best practices into the generation pipeline.

84.0%

✨ Highlights

  • Generates a 0–100 project health score in one command
  • Works with Next.js, Vite, and React Native
  • Built-in GitHub Actions and CLI integration
  • Missing license declaration and formal releases
  • Repository metadata shows missing contributors and commits

🔧 Engineering

  • Rule-based static diagnostics covering state & effects, performance, and accessibility
  • Posts findings to PRs and outputs a reusable health score for automation
  • Supports configurable ignores, merging with existing ESLint, and optional plugins

⚠️ Risks

  • No clear license declared; may block enterprise or restricted-environment adoption
  • Metadata shows few contributors, no releases and no recent commits in provided data, indicating maintenance and long‑term support risk
  • Rules depend on project environment and ESLint plugins, so false positives or coverage gaps are possible

👥 For who?

  • Intended for React developers, code reviewers, and quality teams
  • Suitable for CI integration, automated PR comments, and local code health checks
  • Can feed best-practice guidance to coding agents to reduce low-quality code generation