feat(oxlint-plugin): native TypeScript ports of OXC react/* + jsx-a11y/* + react-hooks + you-might-not-need-an-effect (108+ rules)
Summary
Native TypeScript ports of every React linter rule we previously delegated to OXC. The plugin no longer needs plugins: ["react", "jsx-a11y"] in oxlint config — every rule runs in-process through oxlint-plugin-react-doctor's visitor pipeline.
What's ported
| Bucket | Count | Source |
|---|---|---|
react/* |
56 | oxc_linter::rules::react::* (Rust) |
jsx-a11y/* |
44 | oxc_linter::rules::jsx_a11y::* (Rust) |
react-hooks |
2 | [email protected] (rules-of-hooks, exhaustive-deps) |
you-might-not-need-an-effect |
8 | NickvanDyke / MIT |
All ports ship with their original fixtures wired through runOxcFixtures / runUpstreamParity, plus the semantic infrastructure (ScopeAnalysis, ControlFlowAnalysis, closureCaptures) the hooks rules need.
Parity status
After deep iteration, upstream parity is at 100% on every replay-able test case:
| Source | Cases | Passing | Skipped |
|---|---|---|---|
[email protected] rules-of-hooks |
135 | 135 / 135 (100%) | 0 |
[email protected] exhaustive-deps |
314 | 314 / 314 (100%) | 0 |
OXC react/* + jsx-a11y/* fixtures |
5,528 | 5,528 / 5,528 (100%) | 0 |
you-might-not-need-an-effect |
196 | 196 / 196 (100%) | 1 (upstream todo: true) |
| Combined | 6,173 | 6,173 (100%) | 1 |
The only harness-level concession is regex-rewriting Flow component/hook keywords into function for 22 upstream cases that oxc-parser can't parse natively; rule semantics still trigger correctly because the naming heuristics survive the rewrite. No fixtures are stubbed or silenced.
Semantic infrastructure
src/plugin/semantic/scope-analysis.ts(980 LoC, 362 LoC tests) — TS port ofoxc_semantic: scope tree, symbol table, reference resolution, hoisting, block scoping.src/plugin/semantic/control-flow-graph.ts(642 LoC, 242 LoC tests) — per-function CFG mirroringoxc_cfg: basic blocks, typed edges,isUnconditionalFromEntry(dominance-based),dominatesExit.closure-captures.ts— captured-binding helper used byexhaustive-deps.utils/wrap-with-semantic-context.ts— lazily injects scopes / CFG intoRuleContextper file (cached, conservative fallback returnsfalseso missed captures err toward flagging).
Out of scope: 16 React Compiler rules
eslint-plugin-react-hooks ships 16 additional rules (set-state-in-render, immutability, refs, purity, hooks, set-state-in-effect, globals, error-boundaries, preserve-manual-memoization, unsupported-syntax, static-components, use-memo, void-use-memo, incompatible-library, todo, component-hook-factories). These are dispatcher rules over babel-plugin-react-compiler's HIR analyzer (~30k LoC of bundled compiler code) — they can't be ported to a visitor-only TS plugin without bundling the compiler itself. We continue to delegate them to the user's installed eslint-plugin-react-hooks@7+ via oxlint's JS plugin host (plugin-resolution.ts → resolveReactHooksJsPlugin), only when React Compiler is detected in scope.
Configuration surface
packages/core/src/runners/oxlint/config.ts— dropsplugins: ["react", "jsx-a11y"];BUILTIN_REACT_RULES/BUILTIN_A11Y_RULES/YOU_MIGHT_NOT_NEED_EFFECT_RULESare permanently empty.customRulesOnlymode preserved via a neworiginallyExternal: trueflag on the 108 ported rules inrule-registry.ts; the 179 native react-doctor rules carryoriginallyExternal: false.packages/core/src/runners/oxlint/external-plugin-rules.ts— emptied.resolveYouMightNotNeedEffectPluginremoved (the optional peer dep is gone).
Verification (latest)
pnpm build— 7/7 packages greenpnpm typecheck— 10/10 packages greenpnpm lint— 0 warnings, 0 errors (966 files)pnpm test— 6,027 / 6,027 passing in oxlint-plugin (0 skipped, 0 failing), 1,385 / 1,386 in react-doctor (1 upstreamtodo: true)- Harness strictness verified by injection: neutering the rule body causes 62 / 135 upstream-parity assertions to fail immediately.
Changesets included for @react-doctor/core, oxlint-plugin-react-doctor, react-doctor.
Reviewer notes
- AGENTS.md compliance: arrow functions, kebab-case files, descriptive names, top-level types,
Boolean()over!!, magic numbers in named constants, minimal type casts. - Comments are intentionally sparse; non-obvious code is gated behind
// HACK:or short "why not what" notes. - Ports are 1:1 behavioral with the source; divergences are documented inline with reasons.
Branch state
This session's work is on cursor/port-oxc-react-rules-1778917290 (clean rebase + squash onto latest main). The PR head branch is up to date with verification numbers above.
Copy as prompt
Check if these React Review issues are valid. If so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
Run this before and after your changes to verify the result:
npx react-doctor@latest --verbose --diff
Do not modify the react-doctor configuration unless explicitly asked.
Fix the underlying code issues instead of changing or suppressing the rules.
React Review found 0 errors and 26 warnings. This PR leaves the React health score unchanged.
<file name="packages/oxlint-plugin-react-doctor/src/plugin/constants/aria-element-roles.ts">
<violation number="1" location="packages/oxlint-plugin-react-doctor/src/plugin/constants/aria-element-roles.ts:86">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
<violation number="2" location="packages/oxlint-plugin-react-doctor/src/plugin/constants/aria-element-roles.ts:95">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
</file>
<file name="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/img-redundant-alt.ts">
<violation number="1" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/img-redundant-alt.ts:51">
Severity: Warning
array.indexOf() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
</file>
<file name="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/label-has-associated-control.ts">
<violation number="1" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/label-has-associated-control.ts:56">
Severity: Warning
[...array].sort() — use array.toSorted() for immutable sorting (ES2023)
Use `array.toSorted()` (ES2023) instead of `[...array].sort()` for immutable sorting without the spread allocation
Rule: `js-tosorted-immutable`
</violation>
<violation number="2" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/label-has-associated-control.ts:139">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
<violation number="3" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/label-has-associated-control.ts:181">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
</file>
<file name="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/aria-role.ts">
<violation number="1" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/aria-role.ts:65">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
</file>
<file name="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/control-has-associated-label.ts">
<violation number="1" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/control-has-associated-label.ts:85">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
<violation number="2" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/a11y/control-has-associated-label.ts:85">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
</file>
<file name="packages/oxlint-plugin-react-doctor/src/plugin/rules/correctness/no-array-index-as-key.ts">
<violation number="1" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/correctness/no-array-index-as-key.ts:202">
Severity: Warning
callee.property.name is read 3 times inside this loop — hoist into a const at the top of the loop body
Hoist the deep member access into a const at the top of the loop body: `const { x, y } = obj.deeply.nested`
Rule: `js-cache-property-access`
</violation>
<violation number="2" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/correctness/no-array-index-as-key.ts:196">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
<violation number="3" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/correctness/no-array-index-as-key.ts:248">
Severity: Warning
callee.property.name is read 3 times inside this loop — hoist into a const at the top of the loop body
Hoist the deep member access into a const at the top of the loop body: `const { x, y } = obj.deeply.nested`
Rule: `js-cache-property-access`
</violation>
<violation number="4" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/correctness/no-array-index-as-key.ts:242">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
</file>
<file name="packages/oxlint-plugin-react-doctor/src/plugin/rules/react-builtins/jsx-handler-names.ts">
<violation number="1" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/react-builtins/jsx-handler-names.ts:35">
Severity: Warning
.map().filter() iterates the array twice — combine into a single loop with .reduce() or for...of
Combine `.map().filter()` (or similar chains) into a single pass with `.reduce()` or a `for...of` loop to avoid iterating the array twice
Rule: `js-combine-iterations`
</violation>
</file>
<file name="packages/oxlint-plugin-react-doctor/src/plugin/rules/react-builtins/exhaustive-deps.ts">
<violation number="1" location="packages/oxlint-plugin-react-doctor/src/plugin/rules/react-builtins/exhaustive-deps.ts:1223">
Severity: Warning
array.includes() in a loop is O(n) per call — convert to a Set for O(1) lookups
Use a `Set` or `Map` for repeated membership tests / keyed lookups — `Array.includes`/`find` is O(n) per call
Rule: `js-set-map-lookups`
</violation>
</file>
Showing 15 of 26 issues.
Reviewed by reactreview for commit af4ce2a593615fb2754d8574a581034f6d3094d5. Configure here.
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Actions | Updated (UTC) |
|---|---|---|---|
| react-doctor-website | Preview, Comment | May 22, 2026 3:56am |

