Why not rewrite ESLint in Rust?

(github.com)

52 points | by ksec an hour ago ago

34 comments

  • david_p 29 minutes ago

    In case some people here are unaware, this project seems relevant to the conversation: https://oxc.rs/docs/guide/usage/linter

      Oxlint is a high-performance linter for JavaScript and TypeScript built on the Oxc compiler stack. 
      Oxc: The Oxidation Compiler is a collection of high-performance tools for JavaScript and TypeScript written in Rust.
    • Koffiepoeder 23 minutes ago

      For people that run a lot of eslint in pipelines, for us switching to oxlint saved around 150h of compute time per week in our runners.

      Slow linting is not just a nuisance but also a real cost. FWIW the new ts compiler was around 600h runtime saved per month. And we're only a small team.

    • silverwind 2 minutes ago

      Oxlint is good for speed but still lacking in terms of rule coverage of what advanced eslint setups can provide.

    • KronisLV 8 minutes ago

      Moved to Oxlint and Oxfmt, am really happy with it! Doesn't have every feature of ESLint and Prettier, but that was inconsequential because I wanted to get at least 80% there but with much better performance, and it lived up to that.

  • geraldwhen 35 minutes ago

    ESLint is so slow and an absolute dog on memory on large codebases.

    Everyone will move on if they don’t move with the times.

    • molf 17 minutes ago

      Not only that, but the configuration is a nightmare. Try to lint a project with Typescript and React. The amount of plugins and configs needed is ridiculous. The recent configuration format change definitely did not help either.

    • Xenoamorphous 24 minutes ago

      It makes me really sad but I think you’re right. Someone will fork ESLint in Rust using some AI tokens and everyone in the JS/TS ecosystem (who, in my experience, is super willing to jump to the next brightest thing) will switch to it and all the human effort put into it (as the link mentions it’s mostly/solely volunteeers) will be forgotten or at the very least not acknowledged near enough as it should be.

      Like with many things AI, the end result will likely be better, but I find it very sad anyways.

    • etatester 25 minutes ago

      That's a what's going to happen. Eslint will make snail-paced improvements while drop-in replacements will show up every other month.

  • ch4s3 34 minutes ago

    I think the idea that dogfooding is a core reason to stay in js is very reasonable given the nature of the tool.

    • NuclearPM 32 minutes ago

      I’m not sure where your missing comma is supposed to go.

  • nobleach 7 minutes ago

    For many of our frontend projects, we use Biome (formerly Rome). Yes, it's written in Rust. It has its own plugin language (GritQL). It's an example of what happens when you don't require legacy support. The same could likely be done in JavaScript too if Nicholas' team didn't have to support years of rules/plugins. BUT, I will say this. Rust (and Go) offer quite a bit of perf out of the box. This is why the OXC projects showed such early promise. I'm kinda in a place where I say, "cool, keep working on ESLint... make it the absolute best it can be. Let the users decide if it's fast enough."

  • austin-cheney 23 minutes ago

    For this tool speed is entirely the wrong point of focus.

    1. While the tool may not be as fast as possible it is reasonably fast and certainly enough given that it’s a dev tool and not a part of consumer end services.

    2. Security and size are much greater problems that require overwhelmingly less labor to accomplish. ESLint has too many dependencies at too great a nested depth. This really blows out the size of the application far beyond its initial footprint and completely opens it to the various exploits that come from malicious dependency injection.

    3. ESLint cannot be rewritten into another language without solving for the prior concern first.

    • vikramkr 12 minutes ago

      CI speed and lint speed is a bottleneck and increasingly large percentage of time and cost with agent driven dev. It's a bottleneck

    • IshKebab 13 minutes ago

      "Speed is not the focus" doesn't sound so good when another tool is just as competent and much faster.

      > given that it’s a dev tool

      So devs don't deserve fast tools?

  • chpatrick 40 minutes ago

    There's oxlint for that.

  • ternaus 22 minutes ago

    All reasons in the post are valid, but still...

    Rust alternative will be faster...

    And rewriting from one language to the other using LLMs becomes easier and easier with every new model release...

    Hence we got Biome.

    Moved all my websites to use it.

  • eterm 42 minutes ago

    This is a decent enough explanation, it's not dogmatic or anti-AI, just a calm explanation of where they stand.

  • fwlr 30 minutes ago

    Rewriting ESLint in Rust will produce up to 1 Rust-based JavaScript linters.

    Not rewriting ESLint in Rust has already produced >1 Rust-based JavaScript linters and that number will likely continue to increase.

    Therefore both parties’ needs are best served by not rewriting.

    • notdefio 11 minutes ago

      There's already Biome and Oxlint.

  • sherburt3 an hour ago

    The worst part about rust is rust evangelists

    • sevenzero 41 minutes ago

      Idk considering we get like 1 once a decade CVE every week now, mostly due to using tech that doesn't have secure memory access, it kinda makes sense to switch shit to Rust.

    • Ygg2 43 minutes ago

      Categorically false.

      Worst part about Rust is vibe coders using Rust, while hating the language.

  • thimabi 32 minutes ago

    > When someone asks, “why don’t you rewrite ESLint in Rust?” what they’re really asking is, “why can’t ESLint be faster?” […] People have equated Rust with fast executables, so instead of asking the real question, they jump directly to what they believe is the solution. Rust is fast, ESLint is not, therefore ESLint built on Rust is the answer.

    I’ve never heard this framed in this way and this is, in fact, a very powerful argument. Rust code benefits from memory safety, from the compile-time guarantees that make it easier for AI agents to write and maintain it… but at the end of the day many people like Rust mostly because it facilitates building more performant software.

    I wonder if the vast majority of that performance boost could be obtained if efforts were directed towards improving programs in their own language, like the ESLint team is doing, rather than going straight for a full-on rewrite in Rust. My nagging suspicion is that this is very much possible, as seen for instance in VS Code pushing the boundaries of Electron apps. But that does require some effort.

    • insanitybit 25 minutes ago

      > I wonder if the vast majority of that performance boost could be obtained if efforts were directed towards improving programs in their own language, like the ESLint team is doing, rather than going straight for a full-on rewrite in Rust. My nagging suspicion is that this is very much possible, as seen for instance in VS Code pushing the boundaries of Electron apps. But that does require some effort.

      I just don't think so, personally. You just really don't have to try when it comes to things like 0 allocation in Rust, and when you do put in effort it's for things like explicit SIMD. For something like typescript you have to put in a lot of effort for 0 allocations and then something like explicit SIMD just isn't really on the table.

      In Rust I have real threads, I can manage IO, etc.

      I'm sure you can push these languages and runtimes very far but there just are limits.

      I've seen this so many times. Even with binaries or services that people say spend 90% of time in IO, I've sped them up with naive ports to Rust. Why? Because IO in Rust is going to be faster - freeing up your event loop by reducing contention will reduce latency, reducing allocations will reduce latency, control over task allocation will reduce latency, etc. I've just seen it too many times where "it's just a dumb pipe between services, language doesn't matter" turns out to be "language bound".

      I'm sure they will improve performance by optimizing their use of the language but it's just not going to compete with a rust implementation.

    • __s 25 minutes ago

      IME Rust is easier way to reach perf improvements & has higher ceiling, & this goes back to rewriting a cardgame engine pre-AI (both engine in wasm & server from node)

      I'd spent years tuning for JITs & it was so nice to not have to worry about their fickle nature

      But I also don't think people should think they're helping by opening issues rambling about RIIR. It's up to the project leads & don't worry they know about Rust. Rewrites are not something for flyby PRs to implement

    • cavoirom 20 minutes ago

      > Rust code benefits from memory safety, from the compile-time guarantees that make it easier for AI agents to write and maintain it…

      Rust is not "safe" as you think unless there is no "unsafe", no FFI, no link to C library and libc.

      For example, Java is memory safe but the recent Java4Shell happen because it uses unsafe code to handle base64.

  • etatester 33 minutes ago

    Sure, nobody has time, everyone is a volunteer, nevermind the $100k/year being donated to eslint.

    The rest reads like a bunch of excuses. It's clear that linting via rust is very much possible, you're only lacking intent. Which is perfectly fine, but at least be honest.

    A good way forward would be for oxlint to reach 100% and for it to be merged into eslint's repo. But of course that would hurt OP's feelings.

    • throw-the-towel 31 minutes ago

      100k/year would barely cover one full-time dev.

    • flufluflufluffy 10 minutes ago

      One doesn’t need an excuse to do what they want with their own project.

    • netsharc 11 minutes ago

      Someone enjoys cooking Japanese food. Then some bunch of commenters tells him what he needs to do is manage a bunch of robot cooks cooking Italian food, and he better like it. But it'll all still be volunteer work. As to his enjoyment, who cares?

      I can see OP's viewpoints, why change my life to something worse to satisfy a bunch of commenters? If the people with hard-on for Rust want it, then they should just do it themselves, or donate to the people who want to do it.

  • HackerThemAll 18 minutes ago

    So that people would want a JavaScript tool that works with JavaScript to get rewritten to Rust to make spitting more JavaScript faster.

    That just doesn't make sense.

    If you want to benefit Rust, switch to Rust for backend and switch to Rust for frontend (wasm).

    • elryry 13 minutes ago

      This is an extreme, all or nothing response. JavaScript tooling written in Rust is and has been very successful at saving teams lots of money and lots of time.

    • 100721 11 minutes ago

      What if you’re not concerned with benefitting Rust and you’re more concerned with saving money on CI/CD pipelines?

      That makes a lot more sense.

  • morkalork 36 minutes ago

    Very reasonable take