proposal: no-focus-on-mount#315
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
✅ No new issues Reviewed by reactreview for commit e687437. Configure here. |
23ed1b9 to
683b41c
Compare
683b41c to
0fb05e6
Compare
Auto-discovered draft proposal. No implementation yet — see file body for the proposed detector + prompts + evidence. See millionco/react-doctor-evals#11 for the discovery pipeline.
0fb05e6 to
e687437
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e687437. Configure here.
| if (!hasEmptyDependencyArray(node)) return; | ||
| const callback = getEffectCallback(node); | ||
| if (!callback) return; | ||
| if (!effectCallbackContainsFocusCall(callback)) return; |
There was a problem hiding this comment.
Detector flags non-mount focus
Medium Severity
The proposed effectCallbackContainsFocusCall walk treats any .focus() under the effect callback as mount-time focus, including calls inside if (isOpen) guards, nested handlers, and cleanup returns. That conflicts with the proposal’s own FP guidance for gated, modal, and user-triggered focus.
Reviewed by Cursor Bugbot for commit e687437. Configure here.


Proposal:
react-doctor/no-focus-on-mountstate-and-effectswarnNEW::no-focus-on-mountSources
Discovered by the react-doctor-evals discovery flywheel mining bug-fix evidence across React OSS repos. The pipeline below produced this proposal:
Backing evidence
freeCodeCamp/freeCodeCamp—e2e/editor.spec.ts(FixCommitMeta)Validation prompt
FP-aware guidance for the react-review agent when triaging this rule:
Fix prompt
Actionable fix suggestion surfaced to the user when the rule fires:
Positive fixture (SHOULD trigger)
Negative fixture (should NOT trigger)
Proposed AST detector
Would land at
packages/oxlint-plugin-react-doctor/src/plugin/rules/state-and-effects/no-focus-on-mount.ts:Generated by `rde discover` (see [millionco/react-doctor-evals#11](https://github.com/millionco/react-doctor-evals/pull/11) for the pipeline). Implementation, test fixtures, and rule registration are deliberately deferred — this PR exists for maintainer triage of the proposal only. Reject, edit-and-approve, or merge after wiring as you see fit.
Note
Low Risk
Adds a markdown-only draft proposal with no runtime or build impact. Risk is limited to potential reviewer confusion/maintenance overhead if proposals are treated as implemented rules.
Overview
Adds a new markdown proposal,
proposals/no-focus-on-mount.md, describing a not-yet-implementedreact-doctor/no-focus-on-mountrule that would warn whenfocus()is called inside an empty-deps effect on mount.The document includes false-positive guidance, a suggested fix pattern, example positive/negative fixtures, and a proposed AST detector outline, but no code is wired into the plugin in this PR.
Reviewed by Cursor Bugbot for commit e687437. Bugbot is set up for automated code reviews on this repo. Configure here.