Skip to content

fengmk2/react-doctor

 
 

Repository files navigation

React Doctor

version downloads

Your agent writes bad React, this catches it.

React Doctor deterministically scans your codebase and finds issues across state & effects, performance, architecture, security, and accessibility.

Works for all React frameworks and libraries - Next.js, Vite, TanStack, React Native, Expo, you name it.

Website →

Install

1. Quick start

Run this at your project root to get an audit.

npx react-doctor@latest
Main.mp4

2. Install for agents

Once you have an audit, you can install the skill for your coding agent to learn from the issues and fix them in the future.

npx react-doctor@latest install

Works with Claude Code, Cursor, Codex, OpenCode, and many more.

3. Run in CI (GitHub Actions) for your team

GitHub Action

Add the reusable GitHub Action from Marketplace to scan every pull request, show inline annotations, and leave findings where reviewers already look.

name: React Doctor

on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]

permissions:
  contents: read
  pull-requests: write
  issues: write

concurrency:
  group: react-doctor-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  react-doctor:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v5
      - uses: millionco/react-doctor@main

Add GitHub Action →

4. Configure rules in doctor.config.ts

Configure with a doctor.config.ts (or .js, .mjs, .cjs, .json, .jsonc) in your project root.

// doctor.config.ts
import type { ReactDoctorConfig } from "react-doctor/api";

export default {
  lint: true,
  rules: {
    "react-doctor/no-array-index-as-key": "off",
  },
} satisfies ReactDoctorConfig;

Prefer JSON? Use doctor.config.json:

{
  "$schema": "https://react.doctor/schema/config.json",
  "lint": true,
}

Telemetry

The CLI reports crashes and basic run traces to Sentry to help us fix bugs. Events include the version, platform, Node version, how the CLI was invoked (which command, package manager, and whether it ran locally vs. CI vs. a coding agent), the detected project shape (framework, React version, TypeScript, project size — never the contents of your files), and de-minified stack traces.

Telemetry is anonymized before it leaves your machine: no IP address is collected, your hostname and machine name are stripped, your OS username is removed from every path (your home directory is replaced with ~), captured local variables are dropped, and known secrets/API keys/emails are masked. No source code or diagnostic findings are sent.

Opt out at any time:

  • npx react-doctor@latest --no-telemetry disables Sentry entirely (crash reporting and tracing) for that run, alongside the hosted score API.
  • SENTRY_TRACES_SAMPLE_RATE=0 keeps crash reporting but turns off performance tracing.

Contributing

Issues welcome!

MIT-licensed

About

Your agent writes bad React. This catches it

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 99.0%
  • Other 1.0%