DEV Community

Sergey Korsik
Sergey Korsik

Posted on

Fix Your Slow ESLint: 3 Quick Tips

If your linting takes 3-4 minutes, it's a bottleneck. Here are three ways to fix it.

1. Use the Cache

The --cache flag tells ESLint to only check files that have changed. It's the biggest win for local development. Add it to your package.json script. For more details, see the ESLint CLI documentation.

// package.json
"scripts": {
  "lint": "eslint . --cache"
}
Enter fullscreen mode Exit fullscreen mode

2. Add Concurrency in CI

Use the --concurrency flag to run ESLint on multiple threads. This helps most in CI environments. Add it to your CI run command.

Warning: A value that's too high can exhaust your runner's memory. Start with 2 or 4. You can find the flag in the same ESLint CLI documentation.

3. Integrate Oxlint

If it's still slow, use Oxlint. It's a linter written in Rust and is 50-100x faster. It doesn't replace every ESLint plugin, but it covers the most common rules instantly.

You can find the project on GitHub at the Oxc repository. Just install the oxlint package and run it.

Top comments (0)