Skip to content

infra: migrate from eslint to oxlint#3773

Draft
Shinigami92 wants to merge 1 commit into
nextfrom
chore-migrate-eslint-to-oxlint
Draft

infra: migrate from eslint to oxlint#3773
Shinigami92 wants to merge 1 commit into
nextfrom
chore-migrate-eslint-to-oxlint

Conversation

@Shinigami92

@Shinigami92 Shinigami92 commented Mar 29, 2026

Copy link
Copy Markdown
Member

Summary

This PR replaces ESLint with oxlint - a much faster linter written in Rust by the oxc project.

What changed:

  • Removed 11 ESLint-related packages, added oxlint + oxlint-tsgolint (for type-aware linting)
  • Migrated all rule configurations, file overrides, and ignore patterns to oxlint.config.ts
  • Converted eslint-disable comments to oxlint-disable where the rule exists, removed them where it doesn't
  • Updated VS Code extension recommendation, devcontainer, renovate grouping, documentation, and .gitignore
  • Prettier stays as-is (runs standalone via pnpm prettier), a follow-up PR will look into oxfmt
  • Type-aware linting is enabled via oxlint-tsgolint, so rules like consistent-type-exports, restrict-plus-operands, switch-exhaustiveness-check etc. all work with full type information

Performance: The lint step in CI went from 52s (next branch) to ~1s - a ~50x speedup - even with type-aware linting enabled.

Update (2026-06-22): Rebased onto next and bumped oxlint 1.58.0 → 1.71.0 and oxlint-tsgolint 0.19.0 → 0.23.0. Several rules that were previously missing are now available and have been re-enabled (see below). The newer oxlint also moved a handful of additional rules into its correctness/suspicious categories; those that were never part of our original ESLint config are explicitly turned off to keep behavior parity.

Update (2026-06-26): Rebased again onto the latest next. The newer eslint-plugin-unicorn on next added eslint-disable directives for several unicorn rules that oxlint does not implement; those directives were removed since oxlint reports them as unused (see "unicorn rules not yet implemented by oxlint" below).

Rules regained since the original migration

Thanks to the oxlint / oxlint-tsgolint updates, the following rules - listed as "lost" in the first version of this PR - are enforced again with full parity to the original ESLint config:

Rule Type info needed Re-enabled via
logical-assignment-operators no oxlint 1.71.0
typescript/no-mixed-enums yes oxlint-tsgolint 0.23.0
typescript/no-unsafe-argument yes oxlint-tsgolint 0.23.0
typescript/require-await (TS, type-aware) yes oxlint-tsgolint 0.23.0

The intentional violations these rules guard (a placeholder async helper in the apidocs generator, the mixed-enum test fixtures, and the dynamic BROKEN_LOCALE_METHODS access) are suppressed inline with oxlint-disable-next-line, exactly as they were under ESLint.

Rules that are still not enforced

Not all ESLint rules have an oxlint equivalent yet. Below is what we're still temporarily losing, grouped by how far away support is.

Rules not yet implemented (no type info needed)

Rule What it does Tracking
jsdoc/require-jsdoc Require JSDoc on public API (src/**/*.ts) - this is a big one for us since it guards our public API docs Listed as TODO in oxc#1170
jsdoc/sort-tags Auto-sort JSDoc tags by our configured order (@template, @internal, @remark, @param, @returns, ...) Listed as TODO in oxc#1170
jsdoc/tag-lines Enforce blank lines between JSDoc tag groups (was off, but noting for completeness) Listed as TODO in oxc#1170

logical-assignment-operators (oxc#479) is now implemented and has been re-enabled.

unicorn rules not yet implemented by oxlint

Rebasing onto the latest next (which bumped eslint-plugin-unicorn) pulled in code suppressing these unicorn rules. oxlint does not flag them, so the eslint-disable directives were removed and these checks are currently not enforced:

Rule What it guards
unicorn/no-unreadable-array-destructuring swap via array destructuring (src/modules/helpers/module.ts)
unicorn/no-declarations-before-early-exit declaration ordering (src/modules/commerce/module.ts)
unicorn/no-top-level-assignment-in-function lazy module-renderer init (scripts/shared/markdown.ts)
unicorn/prefer-iterator-to-array matchAll spread, needs Node 22+ (test/scripts/apidocs/verify-jsdoc-tags.spec.ts)
unicorn/no-nonstandard-builtin-properties Error.prototype.stack access (test/support/seeded-runs.ts)
unicorn/no-top-level-side-effects console.log in vitest configs (vitest.config.ts, vitest.it-config.ts)

Rules not yet implemented (need type-aware linting via tsgolint)

Rule What it does Tracking
typescript/naming-convention Enforces our PascalCase for types/classes, T-prefix for type params convention Closed in oxc (oxc#6361) because it needs type info, open in tsgolint#186

no-mixed-enums, no-unsafe-argument, and require-await (the other three type-aware rules from the original list) are now supported by oxlint-tsgolint 0.23.0 and have been re-enabled.

Rules disabled to preserve parity with the original ESLint config

oxlint 1.71.0 categorizes some additional rules as correctness/suspicious, so they started erroring after the bump. These were not part of our original ESLint config (or, in one case, oxlint's implementation is stricter than eslint-plugin-unicorn's), so they are turned off to avoid introducing new violations. They can be evaluated and enabled separately:

Rule Why disabled
no-underscore-dangle Not in our original ESLint config; newly categorized in 1.71.0
typescript/consistent-return Not in our original ESLint config; newly categorized in 1.71.0
vitest/require-to-throw-message Not in our original ESLint config (not part of the vitest recommended set); newly categorized in 1.71.0
unicorn/consistent-function-scoping In eslint-plugin-unicorn's recommended set, but oxlint 1.71.0's implementation flags non-capturing local/arrow functions that ESLint did not, which would introduce new violations

Intentionally dropped (not needed with oxlint)

What Why dropped
@stylistic/padding-line-between-statements Stylistic formatting concern - oxlint has no @stylistic plugin. Closed as "not planned" (oxc#11435). Will be covered by oxfmt in the future.
eslint-plugin-file-progress CI convenience only (progress bar during linting). Not needed - oxlint finishes in under a second even with type-aware linting.
eslint-plugin-prettier Prettier is now run standalone via pnpm prettier --check . in CI. This was just the bridge between ESLint and Prettier. Will be replaced by oxfmt in a future PR.

Other notes

  • test/require.spec.cts is ignored by oxlint due to a parser limitation with top-level await in .cts (CommonJS) files
  • docs/.vitepress/components/api-docs/method.vue added to ignore list - oxlint's .vue support is limited
  • cypress/ added to ignore list - separate tsconfig causes a parser error
  • Two new rules from type-aware categories (no-unsafe-type-assertion, require-array-sort-compare) are explicitly turned off since they weren't in our original ESLint config - we can evaluate enabling them separately
  • oxlint automatically respects .gitignore, so no need to duplicate those patterns in ignorePatterns

Test plan

  • pnpm run lint passes with 0 errors (type-aware enabled). One intentional vitest/warn-todo warning remains on the Windows-flaky it.todo in finance.spec.ts; CI runs oxlint without --deny-warnings, so it is non-fatal
  • pnpm run ts-check passes
  • pnpm prettier --check . passes
  • pnpm run test passes
  • CI pipeline passes - lint job in ~1s vs 52s on next

@Shinigami92 Shinigami92 self-assigned this Mar 29, 2026
@Shinigami92 Shinigami92 added the c: infra Changes to our infrastructure or project setup label Mar 29, 2026
@netlify

netlify Bot commented Mar 29, 2026

Copy link
Copy Markdown

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit 901fb90
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/6a4120e2591add0008d93eeb
😎 Deploy Preview https://deploy-preview-3773.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented Mar 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.84%. Comparing base (acd5fda) to head (901fb90).

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #3773   +/-   ##
=======================================
  Coverage   98.84%   98.84%           
=======================================
  Files         923      923           
  Lines        3216     3216           
  Branches      583      566   -17     
=======================================
  Hits         3179     3179           
  Misses         33       33           
  Partials        4        4           
Files with missing lines Coverage Δ
src/internal/base64.ts 46.66% <ø> (ø)
src/internal/bind-this-to-member-functions.ts 100.00% <ø> (ø)
src/internal/deprecated.ts 100.00% <ø> (ø)
src/modules/commerce/module.ts 98.59% <ø> (ø)
src/modules/helpers/module.ts 94.84% <ø> (ø)
src/modules/internet/module.ts 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Shinigami92 Shinigami92 force-pushed the chore-migrate-eslint-to-oxlint branch 4 times, most recently from 265aa50 to 0923eac Compare April 3, 2026 07:20
@Shinigami92 Shinigami92 force-pushed the chore-migrate-eslint-to-oxlint branch 3 times, most recently from f813931 to 3c5f3b6 Compare June 22, 2026 19:01
@ST-DDT ST-DDT modified the milestones: v10.x, v11.0, vAnytime Jun 22, 2026
@Shinigami92 Shinigami92 force-pushed the chore-migrate-eslint-to-oxlint branch from 3c5f3b6 to 5b9084e Compare June 26, 2026 21:17
@Shinigami92 Shinigami92 force-pushed the chore-migrate-eslint-to-oxlint branch from 5b9084e to 901fb90 Compare June 28, 2026 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: infra Changes to our infrastructure or project setup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants