chore(lint): migrate to oxlint and oxfmt - #1117
Merged
Merged
Conversation
EhabY
marked this pull request as ready for review
September 17, 2026 13:04
EhabY
force-pushed
the
chore/oxc-lint-format-migration
branch
9 times, most recently
from
September 17, 2026 15:45
46e34a0 to
e4feb1d
Compare
Move linting to Oxlint and formatting to Oxfmt, keeping a small residual ESLint for what Oxlint cannot do (import-x/order, Markdown, package.json). - Add .oxlintrc.json with correctness category + curated rules from all categories, plus .oxlintrc.react.json for react/react-x rules - Add .oxfmtrc.json for formatting with oxfmt - Keep eslint.config.mjs for import-x/order, Markdown, and package.json linting (documented in CONTRIBUTING.md) - Run TypeScript 7 (tsc) side-by-side with TypeScript 6 (API for typescript-eslint) - Cap oxlint/oxfmt thread count at 8 (scripts/run-oxc.mjs) - Fix 5 no-misused-spread and require-array-sort-compare findings - Guard against oxlint config regressions with test/unit/oxlintConfig.test.ts Benchmarks: CI lint job -80% (26.3s -> 5.2s), format:check -91% (3.22s -> 0.30s), typecheck -83% (5.43s -> 0.95s). Fixes OOM on default heap.
EhabY
force-pushed
the
chore/oxc-lint-format-migration
branch
from
September 18, 2026 10:56
e4feb1d to
2ba9e23
Compare
Rename .oxfmtrc.json, .oxlintrc.json, and .oxlintrc.react.json to .jsonc. These files already carry comments, so the .jsonc extension gets GitHub to highlight them and gets VS Code to stop flagging the comments as errors. Oxfmt and Oxlint both discover the .jsonc names, and `extends` resolves .oxlintrc.react.jsonc. Parse the config with jsonc-parser in test/unit/oxlintConfig.test.ts so comments in .oxlintrc.jsonc stay possible. Drop the jsPlugins resolution case from that test. Oxlint loads JS plugins eagerly when it parses the config and exits non-zero on a missing one, even when the override glob matches nothing, so `pnpm lint` already covers it.
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.
What and why
Move linting to Oxlint and formatting to Oxfmt, keeping a small residual ESLint for what Oxlint cannot do (
import-x/order, Markdown,package.json).Benchmarks
Interleaved A/B against
mainon the same host, minimum of 3–5 rounds, corroborated in CPU time. Negative Δ is faster.pnpm lintcoldpnpm lintat default heappnpm format:checkcoldpnpm typecheck(root + test)pnpm lintwarmReal CI agrees: Lint went from 94s on
mainto 39s here (run 35145079125).The warm regression. Oxlint and Oxfmt have no cache, so warm local lint is genuinely slower than cached ESLint. Two mitigations, both applied or documented:
scripts/run-oxc.mjs): both tools default tonprocthreads; above ~32 cores the per-thread startup outweighs the parallelism. Capping at 8 cut oxlint 4.0s→2.1s and oxfmt 1.8s→0.23s on a 128-core box, and is a no-op on CI (4 vCPU) and typical laptops. Upstream: oxc#21672.react-xplugin, inherent to the bridge. Editor latency is unaffected; the Oxc LSP measures 60ms init and <1ms diagnostics ondidChange.Config structure
Two oxlint config files:
.oxlintrc.json(346 lines):correctness: "error"category + 82 curated rules from all categories (pedantic, style, restriction, suspicious). React rules are extracted to.oxlintrc.react.jsonviaextends..oxlintrc.react.json(87 lines): 18react/*and 52react-x/*rules scoped topackages/**/*.{ts,tsx}.The residual ESLint config (
eslint.config.mjs) handles only what Oxlint cannot:import-x/ordersortImportsreorders differently@eslint/markdowneslint-plugin-package-json(58 rules)This list is documented in CONTRIBUTING.md so entries can be removed as Oxlint gains equivalents.
Rule coverage
I diffed every rule enabled on
mainagainst the effective rules here, per file, using--print-config. Everything left out is accounted for:@eslint-react/no-leaked-conditional-renderingno-restricted-syntaxselectors cover numeric JSX&&.curlymain:eslint-config-prettierset it to0, so it never ran. Enabling it fresh fails on 69 pre-existing sites, so it stays off rather than blocking this PR.@typescript-eslint/prefer-optional-chainno-undeftsc+ strict mode covers it.import-x/no-unresolvedtscreports TS2307 and runs earlier in CI.import-x/no-relative-packagesrootDir, which is stricter (catches even valid cross-package relative imports).no-dupe-args,no-octalreact-hooks/config,react-hooks/gatingreact-compilersettings and no gating options are configured.no-useless-assignmenteslint-jsplugin.require-awaitawait).React regression, found and fixed. The migration tool copied
disable-conflict-eslint-plugin-react-hooks'sreact-hooks/*: offentries across asreact/*(Oxlint's own namespace), silently disabling@eslint-reactrules with no replacement. The config restores the 17 natively-implemented rules at their previous severities and loads the other 52 from@eslint-reactas a JS plugin aliasedreact-x; a probe with a conditional hook, missing key, leaked fetch, and nested component reports the same 5 findings asmain.Upstream workarounds
Both guarded by
test/unit/oxlintConfig.test.ts:**/*.stories.@(ts|tsx|...), leaving every Storybook rule inert. Brace globs instead.Also:
no-restricted-importspatterns understand only**and literal paths, not single*, so the UI guard is"../../../**".Formatting
22 files reformat from exactly two divergence classes, both deterministic and idempotent: union types expand to leading-pipe style (known upstream divergence, oxc#25841) and one
yieldoperand is parenthesised. Prettier stays a devDependency because Oxfmt delegates Markdown/YAML to it internally.TypeScript 7
TS 7 has no programmatic API and
typescript-eslintrefuses to load against it, so they run side-by-side per the official guidance:typescriptaliased to@typescript/typescript6(API,tsc6) and@typescript/nativetotypescript@^7(thetscbinary). This also fixes the default-heap OOM: the full type-aware ESLint config exceeded the default heap, and dropping that config removes the need for--max-old-space-size.Reviewer checklist
import-x/orderis acceptable (the alternative is a 153-filesortImportsreformat)typescript-eslintTS7 supportThis PR was generated by Coder Agents.