Skip to content

Fixing a Slow ESLint: Stop Guessing

I see it all the time: teams eventually stop running the linter.

3 min read
ESLint
Performance
Linting
CI
Tooling
Monorepo

I see it all the time: teams eventually stop running the linter. It usually starts with "we'll just let the CI handle it," but then the process takes so long that the linter actually becomes a burden rather than a help. If running pnpm lint takes so long that people avoid running it locally, something is wrong with your rules.

The problem is that we often change configurations based on "gut feeling." We feel like it's slow, but if we aren't measuring it, we're just tweaking the config based on vibes.

Before you start deleting or changing rules, do one thing: measure it.

ESLint actually has a built-in way to see which rules are eating up the most time. Just run your linter command with TIMING=1 in front of it. The output will give you a list of the most time-hungry rules. Now you have a target list. No more guessing what needs fixing.

Usually, there are a few main suspects, especially in large projects using TypeScript or React. One is type-aware linting. These rules are incredibly useful, but they come at a high cost because ESLint has to work much harder to understand your code structure. Rules that check dependencies between files, like import/no-cycle, are also frequent culprits if the file scope is too wide.

Another common issue is mistakes in your ignores section. We often forget to exclude folders like dist, .next, or other build artifacts. This is a huge waste of time because the linter ends up checking files we don't even care about.

So, how do we fix it?

Regarding caching, it’s a lifesaver locally so you aren't re-checking unchanged files. But remember, if you aren't restoring that cache in your CI, you won't see the benefits there. Don't kid yourself into thinking the CI is fast just because your local environment feels light.

For monorepos, the most effective approach is to run the linter per package rather than one massive process trying to check the whole repo at once. This makes much more sense if you want to actually leverage parallelism on your CI machines.

At the end of the day, you don't have to run everything with the strictest rules possible. You have to choose: does this rule actually add value, or is it just slowing us down? If a rule makes linting several times slower but offers very little benefit, it might be better to swap it out or narrow its scope.

Just a quick note so I don't forget.