proposal: no-mutating-reducer-state#459
Conversation
v3 auto-discovered draft (accepted-review-sourced). No implementation yet. Pipeline: millionco/react-doctor-evals#11
|
✅ No new issues Reviewed by reactreview for commit 5397504. Configure here. |
|
yes but this will be a hard rule to implement. a "corner" rule |
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 5397504. Configure here.
| } | ||
|
|
||
| if (!isNodeOfType(node.callee, "MemberExpression")) return null; | ||
| return null; |
There was a problem hiding this comment.
Unreachable dead code suggests incomplete mutation detection
Low Severity
In getReducerStateMutationKind, lines 222–223 are completely unreachable. The if (isNodeOfType(node.callee, "MemberExpression")) block on line 215 handles all cases where callee IS a MemberExpression (every internal path returns). If control reaches line 222, callee is guaranteed NOT to be a MemberExpression, so !isNodeOfType(node.callee, "MemberExpression") is always true, making line 223 (return null) unreachable. This dead code looks like a placeholder for missing detection of patterns like Object.assign(state, ...) that was never completed.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 5397504. Configure here.


Proposal:
react-doctor/no-mutating-reducer-statestate-and-effectserrorNEW::no-mutating-reducer-stateWhy the bug exists
Generality check
Sources
Discovered by the react-doctor-evals discovery flywheel mining bug-fix evidence across React OSS repos. This proposal was sourced from the accepted-review signal (a reviewer commented + the author edited the file in response + the thread was marked resolved). Pipeline:
Backing evidence
metabase/metabase-frontend/src/metabase/entities/tables-reducer.ts(AcceptedReviewFixMeta) — reviewer: bot @copilot-pull-request-reviewer · PR #74575 · signal: resolved-and-changedValidation prompt
FP-aware guidance for the react-review agent when triaging this rule:
Fix prompt
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-mutating-reducer-state.ts:Generated by `rde discover` (v3: accepted-review evidence + WHY-reasoning + generality check + explicit abstain). 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.
Note
Low Risk
Adds documentation only (a draft proposal) with no code changes or runtime impact; risk is limited to potential review confusion about an unimplemented rule.
Overview
Adds a new draft proposal doc
proposals/no-mutating-reducer-state.mddescribing a potentialreact-doctor/no-mutating-reducer-statelint rule.The proposal includes rationale, source evidence, validation/fix guidance, example fixtures, and a proposed AST detector outline, but explicitly does not implement or register the rule.
Reviewed by Cursor Bugbot for commit 5397504. Bugbot is set up for automated code reviews on this repo. Configure here.