Repository navigation
chore: Migrate from ESLint to Oxlint - #603 - #604
jdalrymple wants to merge 4 commits into
Conversation
Additionally increases performance of linting # Conflicts: # package-lock.json # package.json
|
@lwasser Can you sanity check me on this one please 🙏 |
|
My main concern with adopting oxlint at this stage is the lack of support for other languages. I.e. no ability to lint |
|
Lint or format? Realistically speaking, our |
|
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. |
|
With that said, I do think we should move from prettier to oxfmt 👍 |
|
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 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. 🤷♀️🤖 |
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
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 |
|
@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!! |
|
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 FEEEL YOU!!!! I started with OS basically because of free GitHub Actions 😅 |
|
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. |
|
Ill mark the PR as blocked pending support for md/json/yaml |
|
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!!! |
|
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 😮💨 |
What:
Replace ESLint with Oxlint for linting, and use knip for the import-resolution checks that Oxlint doesn't have.
eslint,@eslint/js,eslint-plugin-import,eslint-plugin-vitest,globalsandeslint.config.jsoxlintandoxlint.config.mtsnpm run lintnow runsoxlint, thenknip, then Prettieroxlint --fixon staged*.jsfilesDEVELOPMENT.md, the CI step name inlint.yml, and.gitignoreWhy:
npm auditflags 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-importandeslint-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. Anoverridesentry 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:
correctnesscategory 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 existingimport/*andvitest/*rules carry over, includingvitest/prefer-to-have-length. The unused-disable-directive check is kept as an error.import/no-unresolved, which Oxlint doesn't have. Oxlint also catchesvitest/no-focused-testsandvitest/no-disabled-tests, which the old config didn't enable. Both linters report zero problems on the real code.import/no-unresolvedorimport/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 innpm run lintnow and already ran in CI via the Knip workflow. Knip only analyzes files reachable from the entry globs inknip.json, so new source files outside those globs need an entry added.oxlint.config.mtsis auto-discovered, which avoids passing-ceverywhere..mjsisn't auto-discovered in the pinned version, so oxlint would silently fall back to defaults. I tested the.mtsconfig on Node 22.22.0 (the version in.nvmrc) and 24.16.0. On 22.14.0 it fails with "Failed to load config".npm auditreports 0 vulnerabilities,npm run lint,knipandnpm cipass, and all 129 tests pass on Node 22.22.0 and 24.16.0.Checklist: