Skip to content

chore: Migrate from ESLint to Oxlint - #603 - #604

Draft
jdalrymple wants to merge 4 commits into
mainfrom
chore/eslint-to-oxlint
Draft

jdalrymple wants to merge 4 commits into
mainfrom
chore/eslint-to-oxlint

Conversation

@jdalrymple

@jdalrymple jdalrymple commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What:

Replace ESLint with Oxlint for linting, and use knip for the import-resolution checks that Oxlint doesn't have.

  • Remove eslint, @eslint/js, eslint-plugin-import, eslint-plugin-vitest, globals and eslint.config.js
  • Add oxlint and oxlint.config.mts
  • npm run lint now runs oxlint, then knip, then Prettier
  • The lint-staged hook runs oxlint --fix on staged *.js files
  • Update DEVELOPMENT.md, the CI step name in lint.yml, and .gitignore

Why:

npm audit flags minimatch (< 11.0.1) for a potential denial of service via globparts amplification (GHSA-g3hv-75wg-m249). Only 11.0.1+ is patched. The vulnerable copies (3.x and 9.x) came only from the ESLint toolchain: eslint, eslint-plugin-import and eslint-plugin-vitest (via @typescript-eslint). I checked the latest releases of each, and none allows minimatch 11. ESLint 10 is also blocked, because both plugins only declare peer support up to ESLint 9. An overrides entry would work, but it forces a major version onto packages that don't expect it. Oxlint is a native binary with no minimatch dependency, so the vulnerable packages are gone entirely.

Fixes #70

How:

  • Rules: Oxlint's correctness category plus a handful of ESLint-recommended rules that sit outside it (no-undef, no-empty, no-fallthrough, no-redeclare, no-case-declarations, no-prototype-builtins, no-regex-spaces, no-unexpected-multiline, no-useless-backreference, require-yield). The existing import/* and vitest/* rules carry over, including vitest/prefer-to-have-length. The unused-disable-directive check is kept as an error.
  • Parity check: I ran both linters on 75 deliberately broken probe files, one per ESLint recommended rule plus the import and vitest cases. After enabling the extra rules above, every rule fires in both except import/no-unresolved, which Oxlint doesn't have. Oxlint also catches vitest/no-focused-tests and vitest/no-disabled-tests, which the old config didn't enable. Both linters report zero problems on the real code.
  • Missing import rules: Oxlint has no import/no-unresolved or import/no-extraneous-dependencies. Knip covers the same ground, and I verified with a probe that it reports a bad relative import and an unlisted package. It runs in npm run lint now and already ran in CI via the Knip workflow. Knip only analyzes files reachable from the entry globs in knip.json, so new source files outside those globs need an entry added.
  • Config format: oxlint.config.mts is auto-discovered, which avoids passing -c everywhere. .mjs isn't auto-discovered in the pinned version, so oxlint would silently fall back to defaults. I tested the .mts config on Node 22.22.0 (the version in .nvmrc) and 24.16.0. On 22.14.0 it fails with "Failed to load config".
  • Verified locally: npm audit reports 0 vulnerabilities, npm run lint, knip and npm ci pass, and all 129 tests pass on Node 22.22.0 and 24.16.0.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

@jdalrymple

Copy link
Copy Markdown
Contributor Author

@lwasser Can you sanity check me on this one please 🙏

@michaelfaith

Copy link
Copy Markdown
Contributor

My main concern with adopting oxlint at this stage is the lack of support for other languages. I.e. no ability to lint yml, json, md, all of which we have in the repo.

@jdalrymple

Copy link
Copy Markdown
Contributor Author

Lint or format? Realistically speaking, our yml, json and md files shouldnt be changing often, and most often, they only need formatting, not linting.

@michaelfaith

michaelfaith commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Linting (i.e. #607). And our markdown docs are contributor facing, so important to keep those to a high standard. That PR already revealed a couple of table of contents with invalid section refs, missing alt attribute on an image tag in markdown, and unused named links. I find myself working in yml files a lot, because I'm a nerd for workflows 😅 . In my mind, it's all code, and it's important to hold a high bar for all of the code in the repo, not just js/ts.

@michaelfaith

Copy link
Copy Markdown
Contributor

With that said, I do think we should move from prettier to oxfmt 👍

@lwasser

lwasser commented Nov 7, 2026

Copy link
Copy Markdown
Member

Hi @jdalrymple 👋 @michaelfaith to simplify the conversation further 🤣🤣🤣 what do you both think about biome? Thats what ive had my eye on for this project

https://biomejs.dev/

I started playing w biome but haven't done a thorough comparison like Justin has done here.🔎 Eslint seems like a lot of config and plug-ins to me. 🤷‍♀️🤖

@michaelfaith

michaelfaith commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

what do you both think about biome?

I think biome is probably closer to be something we could move to. They just released support for multiple languages in their latest version. But they haven't really built up enough rules for those languages yet (though, they do seem to be porting them fairly quickly, so it may not be that long before they're close enough). With that said, I do generally favor the oxc ecosystem, and if oxlint was further along I would be super in favor of moving to it. They're just not there yet, imo.

Eslint seems like a lot of config and plug-ins to me.

I think that's because it's able to do a lot. 😆 Oxlint and Biome have less configuration because they're less capable (currently). Well, that's not the entire story. The first-party-ness of their rules certainly helps also. But the thing is, though, once you set up your lint config, whichever linter you go with, it probably isn't something you have to mess with very often. So, does that really matter, much? 🤷

My recommendation would be to land #607, so we have a better linting story in the repo (i.e. part the more guardrails conversation we were having in the renovate thread), and migrate formatting from prettier to oxfmt; keep an eye on biome, and when they get far enough along with porting the rules from other languages, then consider switching to them. And then maybe, at some point down the road, when oxlint has multi-language support, assess the move to oxlint/oxfmt as the longer-term play. What do y'all think?

@lwasser

lwasser commented Nov 7, 2026

Copy link
Copy Markdown
Member

@trueberryless would love your thoughts here 💫

This exact thing (formatters and linters moving to rust w sensible defaults & fast rust implementations) happened in python.

Im open to pausing on moving for now because i dont have strong opinions right now! I want to note one thing. When we started rebuilding the cli I was struck by how much setup and config was in place. We had a dependency that a previous maintainer Kent had built that was made to create sensible defaults across I think Eslint if I remember so you could add it as a single dep and not worry about plug-ins and settings . There were dozens of settings in that dep!! Iw ent through them All phew!! Some had become defaults in newer versions. We had to drop it as it wasnt maintained.

So my point here is broadly im in favor of moving to tools that are modern and carry sensible defaults with less config to worry about because its a lot to take over as a new maintainer and also broadly i really support that direction to simplfy and make maintainence more efficient both now and for new maintainers. Lets like Felix and @jdalrymple weigh in here im really in support of whatever decision the group feels is best!!

@trueberryless

Copy link
Copy Markdown
Member

Oh, I love this thread. I have the feeling that every single word in here resembles my heart. To keep it short: Yes, let's keep eslint for now and switch prettier to oxfmt. I love the oxc ecosystem and can't wait for them to support yaml, md, etc.

The one thing I might disagree a bit with is if it is worth switching to Biome if we plan to switch to oxlint in the long run anyways. But since I am not that aware of the current state of support as well as you, I'm open for either 👍

I find myself working in yml files a lot, because I'm a nerd for workflows 😅

I FEEEL YOU!!!! I started with OS basically because of free GitHub Actions 😅

@jdalrymple

jdalrymple commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor Author

heheh, reading this thread is a joy. I'm generally in favour of the proposed plan. My main interest for making the move (beyond performance improvements) was addressing the vulnerability concern. If we can squash/mitigate that in the short term, i'm less pressed to speed to the next iteration of a linting tool.

I quickly looked at what yaml/markdown/json support exists for oxlint, and i did find a eslint plugin port for markdown and json, just not yaml. It could honestly be a small thing to contribute to, to round off the missing piece impeding that migration. Ill see what's involved there and write up a PoC to see if its valuable.

I also tested with a biome migration (@lwasser i totally forgot about this one, i didn't realise they were a rename of the original "rome" project). It works decently well, but as @michaelfaith mentioned, their yaml/md support is still in its infancy. They JUST released very basic experimental support for each so its not a significant improvement beyond what oxlint/oxc tools will support in the future.

@jdalrymple jdalrymple added the status: blocked Blocked by another issue or an external factor label Nov 7, 2026
@jdalrymple

Copy link
Copy Markdown
Contributor Author

Ill mark the PR as blocked pending support for md/json/yaml

@jdalrymple

Copy link
Copy Markdown
Contributor Author

@lwasser

lwasser commented Nov 7, 2026

Copy link
Copy Markdown
Member

Amazing so. Weve decided for now

Keep eslint and add plugins as already proposed in #607

And move from prettier to oxfmt !!

We have a plan!! Lets implement across all repos ! 💥💥💥y'all are so great to work with here. Thanks for being awesome 🎉 ill turn this into an issue with a link to related prs that we can reference so we dont lose the convo in this pr as well!!!

@lwasser

lwasser commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

So i realized why i was getting so confused - github not orders comments most recent at the top. Github changed the UI changed again and it impacts notifications as well. 😆 i thought i was going crazy. but now i can't turn a comment into an issue directly 😮‍💨

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

status: blocked Blocked by another issue or an external factor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unknown error on adding contributors via expanded syntax

4 participants