Why eslint-plugin-import Takes 45 Seconds (And How We Fixed It)
Source: Dev.to
Your CI is slow. Your pre‑commit hooks timeout. Developers disable linting to ship faster.
The culprit? eslint-plugin-import.
Problem
┌─────────────────────────────────────────────────────┐
│ Linting 10,000 files │
├─────────────────────────────────────────────────────┤
│ eslint-plugin-import: 45.0s ███████████████████│
│ eslint-plugin-import-next: 0.4s ▏ │
└─────────────────────────────────────────────────────┘
That’s a 100× speed‑up.
// eslint-plugin-import resolves EVERY import from scratch
import { Button } from '@company/ui'; // Resolves entire package
// On every lint run. Every file. Every import.
import/no-cycle performance killer
The import/no-cycle rule builds a complete dependency graph.
- For N files with M imports each:
- Time complexity: O(N × M²)
- Memory: entire graph in RAM
Result: out‑of‑memory errors on large monorepos.
Real GitHub issues
- “import/no-cycle takes 70 % of lint time” ( #2182 )
- “OOM checking circular dependencies”
- “Minutes to lint a monorepo”
Every lint run repeats the same work—no incremental analysis.
Solution
We rebuilt module resolution with a new plugin that adds caching and memoization.
Feature comparison
| Feature | eslint-plugin-import | eslint-plugin-import-next |
|---|---|---|
| Caching | ❌ None | ✅ Cross‑file shared cache |
| Cycle detection | O(N × M²) | O(N) with memoization |
| TypeScript resolver | 🐌 Slow | ⚡ Native TS support |
| Flat Config support | ⚠️ Partial | ✅ Native |
Migration steps
npm uninstall eslint-plugin-import
npm install --save-dev eslint-plugin-import-next
// eslint.config.js
import importNext from 'eslint-plugin-import-next';
export default [importNext.configs.recommended];
That’s it—same rules, ~100× faster.
Benchmark
# With eslint-plugin-import
time npx eslint --no-cache .
# With eslint-plugin-import-next
time npx eslint --no-cache .
Get started
- 📦 npm:
eslint-plugin-import-next - ⭐ Star the project on GitHub and run the benchmark yourself.
- 🚀 If your CI is slow, drop a comment with your lint times!