Skip to content

ci: Switch from ESLint to Oxlint - #1428

Open
dangotbanned wants to merge 14 commits into
mainfrom
ci/eslint-to-oxlint
Open

dangotbanned wants to merge 14 commits into
mainfrom
ci/eslint-to-oxlint

Conversation

@dangotbanned

@dangotbanned dangotbanned commented Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

This PR begins (see #1428 (comment)) a transition from ESLint to a considerably faster alternative (Oxlint).

How much faster?

Measured after checking out the branch and running pnpm test to warm up

main (10.7s)

pnpm lint
Show output

$ lerna run lint && eslint dev bin
lerna notice cli v10.1.2

   √  @uwdata/mosaic-duckdb:lint (1s)
   √  @uwdata/mosaic-sql:lint (2s)
   √  @uwdata/mosaic-core:lint (2s)
   √  @uwdata/mosaic-inputs:lint (1s)
   √  @uwdata/mosaic-plot:lint (2s)
   √  @uwdata/vgplot:lint (1s)
   √  @uwdata/mosaic-spec:lint (2s)
   √  mosaic-widget:lint (1s)


 Lerna (powered by Nx)   Successfully ran target lint for 8 projects (11s)

  Run duration:      10.7s
  Cache:             0/8 hit (0%)
  Critical path:     10.6s (7 tasks)
  Recoverable time:  <1ms

This PR (29ms)

pnpm oxlint
Show output

...
  ⚠ Unused eslint-disable directive (no problems were reported).
    ╭─[packages/vgplot/plot/src/interactors/Nearest.js:56:5]
 55 │   init(svg) {
 56 │     // eslint-disable-next-line @typescript-eslint/no-this-alias
    ·     ────────────────────────────────────────────────────────────
 57 │     const that = this;
    ╰────

Found 64 warnings and 0 errors.
Finished in 29ms on 625 files with 115 rules using 24 threads.

That 29ms is over before Lerna has even printed lerna notice cli v10.1.2 😅

What's changed?

The `.js` lints have been fixed in the `.ts` PRs

https://github.com/uwdata/mosaic/stack/1375
already present in `lib.es5.d.ts
they weren't at all reported previously
- Was only added in (#1266), but the rule is deprecated
  - https://eslint.org/blog/2023/10/deprecating-formatting-rules/
- `oxlint` doesn't have it
- `oxfmt` diff is too noisy to add here
`test.yml` depends on `"lint"` as a gate
it ain't much but it's something
@dangotbanned

Copy link
Copy Markdown
Collaborator Author

What do you mean by "begin"?

The singular hiccup I encountered is due to there being no equivalent to the quotes rule added in (#1266) to enforce single quotes.

Per the ESLint rule documentation:

This rule was deprecated in ESLint v8.53.0.

This rule was deprecated in ESLint v8.53.0.

It will be removed in v11.0.0.
Please use the corresponding rule in @stylistic/eslint-plugin.
Learn more

Oxlint is not intending to implement deprecated rules.
But even if they were, this rule would conflict with the equivalent option (singleQuote) in their formatter Oxfmt.

I absolutely want to introduce Oxfmt as well (#1364 (comment)), but in this PR I was aiming for a minimal change.
There is no option to enable only singleQuote, without the rest of the formattter, and the smallest changeset I could make with it was 280+ files.
At that point, I'd need to start (#1375) from scratch if that monster landed first 😔

Temporary solution

Oxlint has docs for what to do in this pickle, so I've stripped ESLint down to just checking that single rule after running Oxlint.

Full solution

  1. Merge this PR
  2. Rebase, review, merge (#1375)
    i. Since there are many files that no longer exist there
  3. "Schedule" an Oxfmt PR for when it can be reviewed quickly, to avoid going stale like (chore: add prettier #949)

@dangotbanned dangotbanned added the dependencies Pull requests that update a dependency file label Nov 23, 2026
Comment thread .oxlintrc.jsonc
Comment on lines +2 to +4
"categories": {
"correctness": "error",
},

@dangotbanned dangotbanned Nov 23, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This category + the tweaks in "rules" is a superset of the old config, without introducing new errors/warns on existing code.

I want to do follow-up PRs with enabling more, since this is only 115/875 rules.
Not everything is relevant, but there are many things I've found make for an easier read 🙂

@dangotbanned
dangotbanned marked this pull request as ready for review November 23, 2026 19:48
Comment thread package.json
Comment on lines +24 to +27
"format": "lerna run format && eslint dev bin",
"format:fix": "lerna run format -- --fix && eslint --fix dev bin",
"lint": "pnpm oxlint && pnpm format",
"lint:fix": "pnpm oxlint --fix && pnpm format:fix",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awkward. In the future, I definitely want to get rid of the format/lint distinction. When you have the oxfmt pull request up, I can merge it quickly as long as it doesn't change a ton of formatting for a worse version.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants