feat: make React cleanup first-class - #1624
Open
aidenybai wants to merge 20 commits into
Open
Conversation
commit: |
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Contributor
Interactive terminal E2ETerminal Control verified the built CLI at
|
aidenybai
force-pushed
the
agent/react-cleanup-engine
branch
from
August 10, 2026 12:12
1a7f6ca to
792321a
Compare
aidenybai
marked this pull request as ready for review
August 11, 2026 00:31
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 7ccdd49. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Why
React Doctor should make React applications easier to understand, compose, and change. The previous standalone cleanup package split that job across package boundaries, made broad unused-code reports part of the default product, and kept experimental editor surfaces alive beside the CLI and API.
This PR makes React cleanup a native React Doctor capability. React-specific complexity and repeated composition are default signals; whole-project export, file, dependency, and cycle checks remain available only through explicit rule opt-ins.
What changed
@react-doctor/core; the published CLI and Node API ship their own worker entry instead of consuming a separate cleanup package.deadCodeAPI/config and hidden CLI switches.deadCode: falsedisables duplicated-JSX analysis only; explicitly enabled graph rules still run.react-doctor/*identities.scan.projectAnalysisRuleCountto the canonical run event so opt-in adoption is measurable without a high-cardinality metric.Rule inventory
react-doctor/no-high-complexity-react-functionreact-doctor/duplicate-jsx-subtreereact-doctor/unused-filereact-doctor/unused-exportreact-doctor/unused-typereact-doctor/unused-dependencyreact-doctor/unused-dev-dependencyreact-doctor/circular-dependencyCategory severity changes do not activate opt-in rules. Enable each graph rule directly:
{ "rules": { "react-doctor/unused-file": "warn", "react-doctor/unused-export": "warn", "react-doctor/unused-type": "warn", "react-doctor/unused-dependency": "warn", "react-doctor/unused-dev-dependency": "warn", "react-doctor/circular-dependency": "warn" } }The default React cleanup is intended to produce a component boundary, not a mechanical rewrite:
Compatibility and rollout
react-doctorandoxlint-plugin-react-doctor.Validation
unused-exportscan withdeadCode: false.nr typecheck,nr lint,nr format:check, andnr build.nr smoke:json-reportandnr check:published-deps.c54185e3675a0505a94eb203fe4296823fd3f40c: 2,000/2,000 projects compared, zero failures or skipped projects, 46,421 added diagnostics, and zero removed. The exact final-head rerun at52eb7699e257d9f1fa38adfae54ab7f869ec712cis blocked before scanning by the account’s five-custom-snapshot quota; no unrelated benchmark-harness snapshot was deleted to bypass it.c54185e: 19,489unused-file, 9,861unused-type, 7,625unused-export, 4,454unused-dependency, 2,639 complexity, 1,704unused-dev-dependency, and 649 runtime cycles.frontend/codegen.yml; 33 unused exports remain independently eligible for the opt-in export rule.3ccaac6, scan time increased from 7,422,866 ms to 10,108,347 ms (+36.2%, 180 project regressions). This is not the default CLI contract: graph rules do no work unless individually configured.Note
High Risk
Large architectural rewrite of maintainability/dead-code analysis with new default diagnostics and removal of packages and editor surfaces. Compatibility shims reduce breakage, but analyzer behavior and default findings change substantially.
Overview
Makes React cleanup a native React Doctor capability. Default scans now surface React complexity and repeated JSX composition; whole-project unused file/export/type/dependency and import-cycle checks become explicit opt-in
react-doctor/*rules.Replaces the Deslop-backed
DeadCodepath with an in-coreMaintainabilityservice and project-graph analyzer (checkProjectAnalysis/analyzeProject), shipped via CLI and API worker entries. Removes the standalonedeslop-js/deslop-clipackages, experimental language server, editor scan API, and IDE extensions.Preserves
deadCodeAPI/config compatibility:deadCode: falseonly disables duplicate-JSX analysis; explicitly enabled graph rules still run. Graph rules stay out of changed/staged scans; duplicate JSX still matches the full corpus but focuses reports to changed paths.Reviewed by Cursor Bugbot for commit 52eb769. Bugbot is set up for automated code reviews on this repo. Configure here.