Why not rewrite ESLint in Rust?

(github.com)

78 points | by ksec 1 hour ago

19 comments

  • david_p 1 hour 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 1 hour 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.

      • tobz1000 1 hour ago
        Switching from native [TS + prettier + eslint], to [tsgo + oxfmt + oxlint], lowered my laptop's average temperature by 10-15 degrees at work.
        • prokopton 22 minutes ago
          Void Zero put out a tsrs package too.
        • uncooks 1 hour ago
          [dead]
      • sorahn 1 hour ago
        switching one of our repos from eslint to oxlint:

        - macbook pro: 50s => ~3ms

        - ci server: 3m => ~6s

      • rozenmd 27 minutes ago
        just the move from eslint to oxlint saved my team something like 3.75 days of compute per calendar day.
    • KronisLV 1 hour 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.
    • load-bearing 38 minutes ago
      biome too, I've been using it for years after removing eslint from one of the projects and seeing about a thousand packages gone (IIRC).

      Removed it from every other project I have any control over right after that.

      biome supports all important rules and is probably 100× faster at least. Has its own dependencies of course, but statically linked native code is easier to swallow somehow.

      https://biomejs.dev/

    • silverwind 1 hour ago
      Oxlint is good for speed but still lacking in terms of rule coverage of what advanced eslint setups can provide.
      • demosthanos 52 minutes ago
        Oxlint supports most of eslint's plugin API and you can actually lift any rules from eslint that are still missing and vendor them and use them as plugins.

        Even if you find a gap where a plugin isn't supported, vibe coding an eslint/oxlint plugin for anything you need takes a few minutes at this point.

        The main gap right now is there are no type-aware plugins, but as a stopgap you can vibe code a tiny custom linter on top of the new TypeScript and reap most of the speed benefits now, then port to oxlint once type-aware is ready.

        • asztal 6 minutes ago
          Oxlint supports 61 out of 63 of typescript-eslint's rules.
  • geraldwhen 1 hour 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 1 hour 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 1 hour 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.

      • jadar 42 minutes ago
        I think this has always been the case with Open Source, though. It's largely a thankless enterprise run by volunteers. (See XKCD 2347.) People tend to move on to the new hotness pretty quickly.
    • etatester 1 hour 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.
  • austin-cheney 1 hour 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.

    • demosthanos 24 minutes ago
      I agree that ESLint's dependency problems are really bad and a higher priority for them to fix, but I think you're downplaying speed far too much, at least after the advent of AI.

      Linting is more important now than ever, and on my laptop it now gets run easily 50+ times on a typical workday.

      The difference between a 2 minute lint and a 2 second lint, on 50 lint runs per day, is the difference between 1.6 hours just spent linting versus 1.6 minutes spent on linting.

      And that's before we get to the fact that oxlint's memory usage is so low relative to ESLint that I can actually do something else while oxlint runs in the background, where ESLint would regularly force me to stop what I was doing while it ran!

    • vikramkr 1 hour 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 1 hour 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?

      • austin-cheney 17 minutes ago
        Not as much as the people who pay the bills.
  • diegof79 36 minutes ago
    It’s a reasonable take.

    However, lint tools sit in a middle ground where speed matters: the linter doesn’t catch compile errors; the compiler does that; the linter is not a unit or functional test.

    The linter serves multiple purposes related to codebase maintenance: catching minor gotchas, enforcing best practices (at the code level), enforcing code style, and catching random project constraints (like disallowing certain imports).

    And you run them all the time: automatically in an editor, when working with an agent, on CI/CD. In all these situations, a small speed gain has a lot of impact.

    My hot take: perhaps we can give the agent a list of rules in plain text, and the agent builds the code to check them once, using some native framework, to produce a highly project-specific, optimized CLI. If you need to add a rule, you can make the agent regenerate the CLI.

    So tools like eslint become the small pieces of a code validation framework.

    • demosthanos 14 minutes ago
      My feeling is that we actually underutilize linters because they're so slow that extending them too much hurts. Switching to better linters should allow us to catch more, sooner.

      In the TypeScript world the linter pairs with the type system to give you a toolkit for writing custom static analysis rules that can prove that certain types of bugs simply can't exist in any code, even new code, without anyone having to remember to write a new test for such-and-such an edge case on a new feature.

      TS plus lints can catch far, far more than most people credit them with, and with agents running amok in our codebases that's an extremely valuable resource to have.

      Fast lints mean that I can use that tool with relative impunity rather than hemming and hawing about whether it's worth an extra 10 seconds on an already-too-long lint step.

  • ch4s3 1 hour ago
    I think the idea that dogfooding is a core reason to stay in js is very reasonable given the nature of the tool.
    • demosthanos 47 minutes ago
      Dogfooding has perks for sure, but even the TypeScript team determined that it wasn't worth the 10x performance hit dogfooding necessitated.

      ESLint's performance hit is even worse (we got >60x improvements when switching to oxlint) and from what I can see the benefits of dogfooding aren't as many as they were for a whole language with a Turing-complete type system.

      • ch4s3 1 minute ago
        I guess my advice would be to use oxlint then, OSS doesn't mean 1 blessed program for each use case.
    • NuclearPM 1 hour ago
      I’m not sure where your missing comma is supposed to go.
      • minitech 1 hour ago
        There’s no missing comma. Of the two valid bracketings, only one makes sense, so it’s not that hard to find. Here you go anyway:

        > I think ([the idea that {dogfooding is a core reason to stay in js}] is very reasonable given the nature of the tool).

        • ch4s3 2 minutes ago
          I think that their explanation about dogfooding is reasonable because the tool is used on js.
        • nhinck3 1 hour ago
          I don't think this is correct. If you remove either of the two parentheticals the remaining sentence doesn't parse.
          • minitech 1 hour ago
            I wrote them as brackets to guide grouping, not parentheticals. (They’re not intended to be a standard linguistics format or anything either.)

            (And I don’t want to bog down the original comment too much, so I’ll take this opportunity to amend that there are really 3+ valid bracketings, but the most obvious 2 – the one I highlighted and “I think X given Y” – are equivalent in meaning.)

      • nhinck3 1 hour ago
        parenthetical commas around "that dogfooding is a core reason to stay in js"
  • chpatrick 1 hour ago
    There's oxlint for that.
  • hmokiguess 43 minutes ago
    Man, after the guy who was maintaining heretic unalived himself I feel like that should be a warning call to everyone to just chill... I am still sad about it.

    Very refreshing post from Nicholas, super grateful and thankful for his contributions and ESLint!

    There are humans behind things, even with AI they don't run unsupervised or fully autonomous today. Even if they did, a human's wallet would be behind it.

    There's no free lunch folks, be grateful for what you have and think hard for what you wish for. Not everything is urgent.

    • RestartKernel 18 minutes ago
      With no ill intent: do you use "unalive" ironically, or should I take its appearance on HN as an indication that the term is gaining genuine legitimacy?
  • ternaus 1 hour 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.

  • fwlr 1 hour 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 1 hour ago
      There's already Biome and Oxlint.
  • sherburt3 1 hour ago
    The worst part about rust is rust evangelists
    • locknitpicker 33 minutes ago
      > The worst part about rust is rust evangelists

      I wouldn't call them evangelists. These are mostly toxic trolls that mindlessly parrot around tired cliches they themselves do not understand and feel entitled to bully people doing actual work.

      See how those types are talking about memory safety in a thread about rewriting JavaScript command line tools in Rust. Remarkable stuff.

      As I see it, there is a group of people building up Rust to be an outstanding tool, and then there are these types. Doing nothing, knowing nothing. Achieving nothing, but feeling entitled to bully others for doing their work. Some people work hard to lift Rust up, but this abject Rust mob is hell bent on tearing it all down.

    • sevenzero 1 hour 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.
      • eterm 1 hour ago
        It makes sense to switch from non-memory safe languages to memory safe languages.

        If ESLint were written in C that'd be a compelling (ish) argument.

        But ESLint is written in Javascript, and doesn't suffer from memory access issues at this layer.

        Now if you'd said, "Let's re-write V8 in rust", then you'd have a reason to argue for memory safety.

        • sevenzero 1 hour ago
          Well OPs comment wasnt about ESLint was it?
          • jmull 43 minutes ago
            Perhaps they find rust evangelists annoying because they ignore context to post irrelevant comments in their zeal?
            • sevenzero 13 minutes ago
              Good thing im not a rust evangelist and good thing OP posted a irrelevant comment first ;)
      • uecker 1 hour ago
        Does it make sense? Soon this will get less since the flaws are removed. I worry more about supply chain issue from Rust dependencies.
        • sevenzero 12 minutes ago
          Newsflash, every language ecosystem has that dependency hell.
    • Ygg2 1 hour ago
      Categorically false.

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

      • _tardigrade_ 1 hour ago
        we rewrote most our internal apps to rust and we dont even have one rust developer
        • carlos-menezes 1 hour ago
          "we" is doing a lot of heavy lifting there.
        • Ygg2 31 minutes ago
          Is that you DHH? Or is it ESR?
      • rfgplk 1 hour ago
        Rust is a hard no-go if vibecoding. Hard hard no-go. The abysmal compile times + how resource heavy the compiler itself is makes agentic development extremely taxing. You can easily max out (CPU and mem usage wise) even a very powerful workstation.

        Also LLMs are now intelligent enough that with linting/sanitizing they can write C that's equally as safe as Rust. The last time an LLM actually generated a clear UAF or OOB read/write was during the Opus 4.8 days.

      • orbital-decay 1 hour ago
        Actual vibecoders are probably ambivalent since they don't read the code anyway.
  • thimabi 1 hour 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 1 hour 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 1 hour 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 1 hour 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.

      • IshKebab 1 hour ago
        When people use the term "memory safety" they almost always mean "unless you use the memory unsafe escape hatches that basically all languages provide".

        But you knew that. Don't nit pick.

        • uecker 1 hour ago
          As if not a lot of Rust marketing was based on blurring exactly the distinction between "completely eliminates all memory safety issue" (Safe Rust) and "competed with C/C++ as a system programming language" (Rust including its unsafe part).
          • preg_match 38 minutes ago
            Even comparing to C++ it’s a huge improvement, because all of C++ is unsafe. Unsafe rust, even in codebases that utilize it, is a small minority of the code.
  • etatester 1 hour 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 1 hour ago
      100k/year would barely cover one full-time dev.
    • flufluflufluffy 1 hour ago
      One doesn’t need an excuse to do what they want with their own project.
      • etatester 50 minutes ago
        Exactly, which is what I said.
    • netsharc 1 hour 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.

      • etatester 49 minutes ago
        Yes, I said this exactly.

        "No time" is bs. "I don't want to" is nowhere to be found in the post.

        • jmull 26 minutes ago
          If you want to know why they "don't want to" you could read the article. You're calling them dishonest, but it doesn't look like you even read what they had to say (well, you ignored it all and didn't engage with it, which is effectively the same thing). The one thing you did engage with is their point about the time it would take... but do you really think it would take trivial amounts of time to convert the team and project to rust? Silly.

          The time is one

  • morkalork 1 hour ago
    Very reasonable take
  • HackerThemAll 1 hour 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 1 hour 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 1 hour 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.

  • arbor-group 19 minutes ago
    [dead]
  • codezal 34 minutes ago
    [dead]
  • sitetoolsbox 1 hour ago
    [dead]