chore: Experimenting with Oxlint & Biome#19145
Conversation
|
Label error. Requires exactly 1 of: changelog:.*. Found: 🖥️web. A maintainer will add the required label. |
|
Hi, Biome contributor popping in here :) I just wanted to let you know that we are launching Biome 2 shortly and will be introducing type-aware linting with rules such as The point about the migration not listing unsupported rules is a great point of feedback and something we intend to address! In the meantime, you can use our page with rule sources to look up rules that you feel are important to you. Cheers! |
|
Thanks a lot for letting us know @arendjr ! I have now upgraded to the biome v2 Beta, and it does look pretty good to me! Biome v2MigrationA small hiccup is that either during the migration or initialization, the What's different?We got the rules that arend mentioned, TimingWith those 2 new rules (and all the other migrated ones), the lint takes around 120ms 🎉 Drawbacks
OxlintHowever while testing those biome rules, I realized Oxlint hadn't migrated the And the same can be said about the unused-vars rule: In Oxlint, there are no reports at all of unused vars in svelte files, even when I add an actually unused var. I believe this is because Oxlint automatically ignores vue and svelte files for this rule. Another conclusionSo after this additional round of testing, biome v2 is looking more promising in my opinion, since both tools seem to struggle similarly with svelte, however biome:
|
|
Perhaps we should mix and match? I.e. use eslint for Svelte and biome for non-Svelte |
|
Unfortunately the svelte files are the main bottleneck, so switching the non-svelte files to biome would not really be worth it imo. For comparison, running the current eslint-parallel config takes around 166s, and (very crudely) stripping all svelte plugins and configs from the eslint config, results in barely 5s. So as long as I didn't make some blunder, it does seem like the main problem are the svelte files |
|
I guess my comment was a bit unclear. I mean could we have the eslint run the |
|
Oh right, yeah that's a good idea, that should be fairly straight-forward! |
|
Hey, I am going to close this for now due to it being stale for quite a long time. I'm also not sure if this is a direction we actually want to go. It might be worth trying Bens suggestion, let us know if that gets you anywhere. If you do get time to fix this please feel free to make a new PR or comment to have this one re-opened 🙂 |
What is this?
We (@danieldietzler & me) wanted to try out the newly released 🦀-based linter Oxlint so see how feasible a migration from eslint to Oxlint would be, and what performance enhancement could be gained.
I also explored how BiomeJS would fare.
Also since the main pain-point is web, I'm only taking a look at that, but the server could ofc also benefit in the same way (with probably less migration problems).
Migration
Both Oxlint and Biome offer a migration tool to migrate from eslint to their respective tool. That is needed, since both tools (re-)implement their own rules, rules written for eslint cannot simply be used.
Oxlint
For the oxlint migration, it helpfully outputs which rules are not supported (yet) which gives a great overview:
Oxlint migration output
To summarize:
Biome
For Biome unfortunately things are much more unclear. The migration does not give out any feedback on which rules are unsupported and thus not migrated. So this would be tedious manual work, to find all the rules that are not supported.
What we do know, is that it also does not support type-aware linting (yet) (biomejs/biome#3187)
And after running a first lint, I found biome flagged a lot of unused variable errors in svelte files, for variables that were only used in the svelte markup
Speed
Now even with a significant amount of rules not working in both new tools, looking at those juicy timing numbers is still very fun, so here are some very un-scientific numbers of just a few one-shot runs I did on my PC (which has 16 threads)
Current state
Single threaded:
npm run lint-> 516s (8min 16s)Parallel:
npm run lint:p-> 174s (3min 14s)Oxlint
npm run lint:ox-> 45msBiome
npx @biomejs/biome lint-> 87msFurther remarks on Oxlint
Oxlint also has a very interesting solution for rules that have not yet been implemented: eslint-plugin-oxlint
This is an eslint plugin, that disabled all eslint rules, that are now covered by Oxlint. Thus you can then run as your lint command:
However, I either didn't really manage to include this plugin correctly, or it made no significant change to the runtime of eslint. Ofc the main rules causing the slowness are the type-aware promise rules, which would fallback to eslint in this configuration. But even with those disabled and supposedly all the Oxlint rules disabled with the plugin, the eslint run time was still at least 50s which I find odd.
Conclusion
From my experimenting, Oxlint looks like a safer bet, even though biome has been around for longer. With Oxlint we know exactly which rules are still missing which is a huge plus imo.
The main blocker for now would be the svelte lint support.
Given how atrociously slow the type-aware rules currently are, and how there has already been discussions to possibly remove them (in some circumstances), I feel like those aren't that big of a blocker.
Notes
Both tools do also offer a formatter, which might be worth it to migrate to, if we ever migrate the linter, just for some extra 🦀