fix(react-doctor): restore React Compiler rules to error severity#182
Merged
Merged
Conversation
PR #140 silently downgraded every `react-hooks-js/*` (React Compiler) rule from `"error"` to `"warn"` as part of a broader review pass, without justifying the severity change in the PR description. This made "React Compiler can't optimize this code" diagnostics: - show with the warning glyph instead of the error glyph in the CLI, - stop counting toward `errorCount` in the JSON summary, and - stop tripping the GitHub Action's default `--fail-on error`, so unoptimizable component shapes silently slipped through CI. Each compiler diagnostic represents code the React Compiler cannot memoize — leaving the surrounding component un-optimized at runtime. Restore them to `"error"` so the original "if the compiler can't handle it, fail CI" contract works again. A regression test in `scan-resilience.test.ts` asserts that every `react-hooks-js/*` rule emitted by `createOxlintConfig` is at `error` severity, so a future mass-rewrite can't silently undo this. Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Summary
"React Compiler can't optimize this code" diagnostics are no longer triggering as errors — they were silently downgraded to warnings in PR #140 ("Address review-report.md findings + self-review regressions"). Restored to
"error"so they fail CI again.Investigation
git log -S '"react-hooks-js/set-state-in-render": "warn"'onpackages/react-doctor/src/oxlint-config.tspoints at exactly one commit:That commit's diff on
oxlint-config.tsmass-converted the entireREACT_COMPILER_RULESmap from"error"to"warn"(16 entries), as part of a broader 88-file refactor. The PR description doesn't justify the severity change for these specific rules — it only mentionsrule severity types tightened to RuleSeverity(a TypeScript typing change). Other rule sets that had been"error"(e.g.react/rules-of-hooks,react-doctor/no-mutable-in-deps) were preserved at error in the same commit; onlyREACT_COMPILER_RULESwas uniformly downgraded.Effects of the regression
Reproduced with a minimal fixture (
useState+ in-placepush+setN(n + 1)at render time, withbabel-plugin-react-compilerlisted as a dep so detection fires):Before this PR:
After this PR:
So the user-visible regression triggered by PR #140 was:
⚠(warning) instead of✘(error).errorCountin the JSON summary stopped counting them.fail-on: error(action.yml); compiler-blocked code stopped failing CI.Fix
packages/react-doctor/src/oxlint-config.ts— everyreact-hooks-js/*entry inREACT_COMPILER_RULESset back to"error", with a HACK comment explaining why so a future refactor doesn't accidentally undo it. Each compiler diagnostic represents a code shape that prevents memoization of the surrounding component, so the previous "if the compiler can't handle it, fail CI" contract is correct.Regression test
packages/react-doctor/tests/regressions/scan-resilience.test.ts— new assertion that everyreact-hooks-js/*rule emitted bycreateOxlintConfigis aterrorseverity. A future mass-rewrite that downgrades them again will fail this test.Validation
pnpm typecheck— passespnpm test— 673/673 pass (added 1 regression)pnpm lint— 0 warnings, 0 errorspnpm format:check— cleanerrorCount: 2(was0).