eslint-plugin-import가 45초 걸리는 이유 (그리고 우리가 해결한 방법)

발행: (2025년 12월 31일 오후 02:34 GMT+9)
3 min read
원문: Dev.to

Source: Dev.to

Your CI is slow. Your pre‑commit hooks timeout. Developers disable linting to ship faster.
The culprit? eslint-plugin-import.

문제

┌─────────────────────────────────────────────────────┐
│ Linting 10,000 files                                │
├─────────────────────────────────────────────────────┤
│ eslint-plugin-import:      45.0s  ███████████████████│
│ eslint-plugin-import-next:  0.4s  ▏                  │
└─────────────────────────────────────────────────────┘

That’s a 100× speed‑up.
이는 100배 속도 향상입니다.

// 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 성능 저하 요인

The import/no-cycle rule builds a complete dependency graph.
import/no-cycle 규칙은 전체 의존성 그래프를 구축합니다.

  • 파일이 N개이고 각 파일에 M개의 import가 있을 때:
    • 시간 복잡도: O(N × M²)
    • 메모리: 전체 그래프가 RAM에 저장됨

Result: out‑of‑memory errors on large monorepos.
결과: 대규모 모노레포에서 메모리 부족 오류가 발생합니다.

실제 GitHub 이슈

  • “import/no-cycle가 lint 시간의 70 %를 차지한다” ( #2182 )
  • “순환 의존성 검사 중 OOM 발생”
  • “모노레포를 lint 하는 데 몇 분이 걸림”

Every lint run repeats the same work—no incremental analysis.
각 lint 실행마다 동일한 작업을 반복합니다—증분 분석이 없습니다.

해결책

We rebuilt module resolution with a new plugin that adds caching and memoization.
우리는 캐싱과 메모이제이션을 추가하는 새로운 플러그인으로 모듈 해석을 재구축했습니다.

기능 비교

기능eslint-plugin-importeslint-plugin-import-next
캐싱❌ 없음✅ 파일 간 공유 캐시
사이클 감지O(N × M²)O(N) (메모이제이션 적용)
TypeScript 해석기🐌 느림⚡ 네이티브 TS 지원
Flat Config 지원⚠️ 부분적✅ 네이티브

마이그레이션 단계

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.
그게 전부입니다—동일한 규칙, 약 100배 빠름.

벤치마크

# With eslint-plugin-import
time npx eslint --no-cache .
# With eslint-plugin-import-next
time npx eslint --no-cache .

시작하기

  • 📦 npm: eslint-plugin-import-next
  • ⭐ 프로젝트를 GitHub에 별표하고 직접 벤치마크를 실행하세요.
  • 🚀 CI가 느리다면, lint 시간을 댓글로 남겨 주세요!

더 많은 성능 심층 분석을 원한다면 팔로우하세요: GitHub | LinkedIn

Back to Blog

관련 글

더 보기 »

eslint-plugin-secure-coding 시작하기

!Getting Started with eslint-plugin-secure-coding의 표지 이미지 https://media2.dev.to/dynamic/image/width=1000,height=420,fit=cover,gravity=auto,format=auto/ht...

eslint-plugin-pg 시작하기

빠른 설치 bash npm install --save-dev eslint-plugin-pg Flat Config js // eslint.config.js import pg from 'eslint-plugin-pg'; export default pg.configs.reco...