How to fix issues
Every diagnostic names the file, line, rule, and a recommended fix.
Recommended workflow
1
Run a diff scan
npx react-doctor@latest --verbose --diff2
Fix security and performance diagnostics first, then other
error diagnostics3
Re-run until the scan is clean
Understand a diagnostic
Use the why subcommand when a rule is confusing or a suppression isn't working:
npx react-doctor@latest why src/App.tsx:42To learn what a rule means in general, use rules explain:
npx react-doctor@latest rules explain react-doctor/no-derived-state-effectSuppress only when needed
Prefer fixing the root cause. When a suppression is appropriate, keep it narrow:
// react-doctor-disable-next-line react-doctor/no-derived-state-effect
useEffect(() => {
setValue(expensiveInitialValue);
}, []);Use comma-separated rule names for multiple suppressions on one line.