Skip to content

feat: add source-patched native Oxlint path - #1664

Draft
aidenybai wants to merge 7 commits into
mainfrom
codex/oxc-source-patch
Draft

feat: add source-patched native Oxlint path#1664
aidenybai wants to merge 7 commits into
mainfrom
codex/oxc-source-patch

Conversation

@aidenybai

@aidenybai aidenybai commented Aug 21, 2026

Copy link
Copy Markdown
Member

Why

React Doctor rules currently cross the Rust-to-JavaScript bridge, allocate JavaScript AST objects, and traverse them in V8. A native rule path removes that overhead, but maintaining a long-lived Oxc fork would create a permanent merge and distribution burden.

This keeps the published Oxlint JavaScript launcher and replaces only its N-API binding with a reproducible patch against an exact upstream commit. Stock behavior remains the default.

What changed

  • Port 35 existing React Doctor rules to native Rust.
  • Add seven parity-safe delegates to upstream Oxc rules: html-has-lang, no-access-key, no-clone-element, no-will-update-set-state, self-closing-comp, no-distracting-elements, and CFG-backed require-render-return.
  • Add exact custom Rust implementations for React, JSX, accessibility, DOM, dependency, and React Native rules, including forward-ref-uses-ref, aria-props, aria-unsupported-elements, no-unescaped-entities, scope, no-set-state, no-find-dom-node, and react-in-jsx-scope.
  • Preserve React-component ancestry, lexical scope, transparent TypeScript wrapper boundaries, curated comment-text exemptions, meaningful-child semantics, constant JSX tag resolution, configured element mappings, and React import/alias/destructuring provenance.
  • Share exact Rust createElement, property-key, and React API matching semantics across native rules; native utility injection resolves transitive helper dependencies.
  • Forward rule configuration, lifecycle hooks, applicability, fix capability, inline suppression, and optional non-production-file filtering through the generated native adapter.
  • Keep audited overlaps in JavaScript when controlled and corpus tests show semantic or location drift, including compiler-backed rules whose current native diagnostics are not yet equivalent.
  • Keep each native rule as a repository-owned Rust source overlay and reduce the upstream patch to stable integration files; Oxc generated registries are rebuilt with cargo lintgen.
  • Enable native rules only through REACT_DOCTOR_NATIVE_OXLINT_BINDING_PATH; unported rules remain in the JavaScript plugin and the published binding remains the default.

Validation

Check Result
Native/JavaScript fixture parity 64 identical diagnostics
Strict mutation fuzzing 30,500 retained iterations, no findings
Native/JavaScript repository corpus 48 / 48 repositories; 214,711 diagnostics identical
Generated adversarial corpus 8,490 diagnostics identical
Clean-heavy benchmark p50 728.5 ms to 76.2 ms, 89.5% faster
50,000-finding benchmark p50 1398.7 ms to 601.4 ms, 57.0% faster
Upstream patch Applies to oxlint_v1.79.0 at 0db127cc16d28b97d84bac4ebeb302caf1a78c7e

The benchmarks isolate JavaScript-plugin overhead removed by native rules; they do not claim the same whole-project React Doctor speedup while most rules remain in JavaScript.

Daytona pull-request parity is unavailable in this shell because neither DAYTONA_API_KEY nor DAYTONA_API_TOKEN is present. The deterministic repository and adversarial native-versus-JavaScript comparisons are the local fallback. The PR remains draft because the native path is still opt-in research infrastructure.

Test plan

  • nr test — 12 / 12 tasks passed; CLI suite 2,492 passed / 24 skipped
  • nr lint
  • nr typecheck
  • nr format:check
  • nr smoke:json-report
  • nr native:oxlint:verify -- --source tmp/oxc-upstream
  • nr native:oxlint:check -- --source tmp/oxc-upstream
  • Controlled production and non-production fixture parity
  • 48-repository curated corpus parity
  • Generated adversarial curated corpus parity
  • Strict @react-doctor/fuzz runs for every added rule

@pkg-pr-new

pkg-pr-new Bot commented Aug 21, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1664
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1664
npm i https://pkg.pr.new/react-doctor@1664

commit: b28de10

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit b28de10.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

Terminal Control verified the built CLI at b28de10 in a real PTY:

  • selected a project interactively and observed Scanning... before the three-second Git delay completed
  • waited for the clean result and exercised the compact report
  • opened copy context and the GitHub Actions confirmation, then cancelled safely

Download the edited MP4 and PNG evidence

@aidenybai
aidenybai force-pushed the codex/oxc-source-patch branch from 926212e to fc576d5 Compare August 21, 2026 06:21
@aidenybai
aidenybai force-pushed the codex/oxc-source-patch branch from fc576d5 to 1e12d5f Compare August 21, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant