eslint-plugin-import-next
v2.3.18
Published
ESLint plugin for imports and module boundaries — drop-in replacement for eslint-plugin-import, 3.1x faster end-to-end, zero-config migration.
Maintainers
Keywords
Readme
⭐ If this plugin caught a real bug for you, star the repo — it's the signal that keeps these rules maintained.
Description
This plugin provides Next-generation import sorting, validation, and architectural boundaries.
Philosophy
Interlace fosters strength through integration. Instead of stacking isolated rules, we interlace security directly into your workflow to create a resilient fabric of code. We believe tools should guide rather than gatekeep, providing educational feedback that strengthens the developer with every interaction.
Getting Started
- To check out the guide, visit eslint.interlace.tools. 📚
- 要查看中文 指南, 请访问 eslint.interlace.tools. 📚
- 가이드 문서는 eslint.interlace.tools에서 확인하실 수 있습니다. 📚
- ガイドは eslint.interlace.toolsでご確認ください。 📚
- Para ver la guía, visita eslint.interlace.tools. 📚
- للاطلاع على الدليل، قم بزيارة eslint.interlace.tools. 📚
npm install eslint-plugin-import-next --save-dev⚙️ Configuration Presets
| Preset | Description |
| :------------------ | :----------------------------------------------- |
| recommended | Warns on import order issues |
| strict | All rules set to error for production-ready code |
| typescript | Optimized for TypeScript projects |
| module-resolution | Focus on import resolution |
| import-style | Focus on import formatting |
| esm | Enforce ES Modules only |
| architecture | Clean architecture boundaries |
| performance | Bundle optimization (barrel detection) |
| enterprise | Team boundaries & legacy import tracking |
| errors | Matches eslint-plugin-import errors preset |
| warnings | Matches eslint-plugin-import warnings preset |
🔄 Parity with eslint-plugin-import
| Rule | Original Plugin | Status | Notes |
| :-------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------- | :----------------------- |
| All Rules | eslint-plugin-import | ✅ Supported | Full drop-in replacement |
🧬 Deep dependency graphs
import/no-cycle crashes on deep import chains. import-next/no-cycle does not.
Cycle detection is a strongly-connected-components pass over your module graph. Done recursively — one JavaScript stack frame per module — a chain deeper than the engine's call stack throws RangeError: Maximum call stack size exceeded. ESLint then exits 2 with no results at all: not a slow lint, no lint. Both rules default to unlimited traversal depth, so nothing caps the descent.
import-next runs the same traversal on an explicit stack, so its ceiling is heap rather than stack.
See it yourself
npm i -D eslint eslint-plugin-import eslint-plugin-import-next
curl -O https://raw.githubusercontent.com/ofri-peretz/eslint/main/benchmarks/scripts/repro-deep-chain.mjs
node repro-deep-chain.mjs 6000chain depth: 6000 modules
eslint-plugin-import FAILED after 93.6s — RangeError: Error while loading rule 'import/no-cycle': Maximum call stack size exceeded
eslint-plugin-import-next completed in 18.2sMeasured on Node 24 / darwin-arm64 with ESLint 10.7. The exact depth at which the recursive implementation dies varies with Node version and platform stack size — around 5,000 modules here.
Chains get deep by accident
Hand-written 5,000-module chains are rare. These are not:
- generated clients and schema bindings, where each type re-exports the next
- barrel files (
index.ts) re-exporting barrels, several layers down - long
export … fromladders in a monorepo's shared packages
Depth accumulates through re-export edges, which is exactly what the rule follows.
Speed, for completeness
Across graph shapes at 5,000 files each, import-next is ~1.1× faster on dense cyclic graphs and on cold single-file runs, and ties on graphs with no cycles to find. The wide/shallow shape is unresolved — two runs disagree (0.8× sequential, 1.01× interleaved) and the machine has not been quiet enough to settle it, so no claim is made there. On a real 455K-line React codebase it is 8× faster in rule time and 3.1× end-to-end at 100% detection parity.
Speed is the smaller story. The deep-chain result above is a difference in kind, not degree.
Detection parity is checked per shape before any timing is trusted, and every number comes from a committed result file:
📦 Compatibility
| Package | Version |
| :--- | :--- |
| ESLint | ^8.40.0 \|\| ^9.0.0 \|\| ^10.0.0 |
| Node.js | >=18.0.0 |
See the ESLint Version Support Policy for the full matrix.
Rules
Legend
| Icon | Description |
| :---: | :--- |
| 💼 | Recommended: Included in the recommended preset. |
| ⚠️ | Warns: Set to warn in recommended preset. |
| 🔧 | Auto-fixable: Automatically fixable by the --fix CLI option. |
| 💡 | Suggestions: Providing code suggestions in IDE. |
| 🚫 | Deprecated: This rule is deprecated. |
| 🟢 | Type-unaware: AST-only, runs in oxlint JS-plugin tier. |
| 🟡 | Type-aware (refining): pure-AST primary path; types refine precision. |
| 🟠 | Type-aware (graceful): requires TS program; silent without it. |
| Rule | CWE | OWASP | CVSS | Description | 🧠 | 💼 | ⚠️ | 🔧 | 💡 | 🚫 | | :--- | :---: | :---: | :---: | :--- | :---: | :---: | :---: | :---: | :---: | :---: | | consistent-type-specifier-style | | | | | 🟢 | | | | | | | default | | | | | 🟡 | 💼 | | | | | | dynamic-import-chunkname | | | | | 🟢 | | | | | | | enforce-dependency-direction | | | | | 🟢 | | | | | | | enforce-import-order | | | | | 🟢 | | | | | | | enforce-team-boundaries | | | | | 🟢 | | | | | | | export | | | | | 🟢 | 💼 | | | | | | exports-last | | | | | 🟢 | | | | | | | extensions | | | | | 🟢 | | | | | | | first | | | | | 🟢 | | ⚠️ | | | | | group-exports | | | | | 🟢 | | | | | | | max-dependencies | | | | | 🟢 | | | | | | | named | | | | | 🟡 | 💼 | | | | | | namespace | | | | | 🟡 | | ⚠️ | | | | | newline-after-import | | | | | 🟢 | | ⚠️ | | | | | no-absolute-path | | | | | 🟢 | | | | | | | no-amd | | | | | 🟢 | | ⚠️ | | | | | no-anonymous-default-export | | | | | 🟢 | | | | | | | no-barrel-file | | | | | 🟢 | | | | | | | no-barrel-import | | | | | 🟢 | | | | | | | no-commonjs | | | | | 🟢 | | | | | | | no-cross-domain-imports | | | | | 🟢 | | | | | | | no-cycle | | A05:2021 | | | 🟢 | 💼 | | | | | | no-default-export | | | | | 🟢 | | | | | | | no-deprecated | | A09:2021 | | | 🟢 | | | | | | | no-duplicates | | | | | 🟢 | 💼 | | | | | | no-dynamic-require | | | | | 🟢 | | | | | | | no-empty-named-blocks | | | | | 🟢 | | ⚠️ | | | | | no-extraneous-dependencies | | | | | 🟢 | | ⚠️ | | | | | no-full-package-import | | | | | 🟢 | | | | | | | no-import-module-exports | | | | | 🟢 | | | | | | | no-internal-modules | | | | | 🟢 | | | | | | | no-legacy-imports | | | | | 🟢 | | | | | | | no-mutable-exports | | | | | 🟢 | | | | | | | no-named-as-default | | | | | 🟢 | | ⚠️ | | | | | no-named-as-default-member | | | | | 🟢 | | ⚠️ | | | | | no-named-default | | | | | 🟢 | | | | | | | no-named-export | | | | | 🟢 | | | | | | | no-namespace | | | | | 🟢 | | | | | | | no-nodejs-modules | | | | | 🟢 | | | | | | | no-relative-packages | | | | | 🟢 | | | | | | | no-relative-parent-imports | | | | | 🟢 | | | | | | | no-restricted-paths | | | | | 🟢 | | | | | | | no-self-import | | | | | 🟢 | 💼 | | | | | | no-unassigned-import | | | | | 🟢 | | | | | | | no-unresolved | | A03:2021 | | | 🟢 | 💼 | | | | | | no-unused-modules | | | | | 🟢 | | | | | | | no-useless-path-segments | | | | | 🟢 | | | | | | | order | | | | | 🟢 | | ⚠️ | | | | | prefer-default-export | | | | | 🟢 | | | | | | | prefer-direct-import | | | | | 🟢 | | | | | | | prefer-modern-api | | | | | 🟢 | | | | | | | prefer-node-protocol | | | | | 🟢 | | | | | | | prefer-tree-shakeable-imports | | | | | 🟢 | | | | | | | require-import-approval | | | | | 🟢 | | | | | | | unambiguous | | | | | 🟢 | | | | | |
🔗 Related ESLint Plugins
Part of the Interlace ESLint Ecosystem — AI-native security plugins with LLM-optimized error messages:
| Plugin | Downloads | Description |
| :--- | :---: | :--- |
| eslint-plugin-secure-coding | | General security rules & OWASP guidelines. |
|
eslint-plugin-pg | | PostgreSQL security & best practices. |
|
eslint-plugin-node-security | | Node.js core-module security (fs, child_process, vm, crypto, Buffer). |
|
eslint-plugin-jwt | | JWT security & best practices. |
|
eslint-plugin-browser-security | | Browser-specific security & XSS prevention. |
|
eslint-plugin-express-security | | Express.js security hardening rules. |
|
eslint-plugin-lambda-security | | AWS Lambda security best practices. |
|
eslint-plugin-nestjs-security | | NestJS security rules & patterns. |
|
eslint-plugin-mongodb-security | | MongoDB security best practices. |
|
eslint-plugin-vercel-ai-security | | Vercel AI SDK security hardening. |
|
eslint-plugin-import-next | | Next-gen import sorting & architecture. |
⭐ Support & follow
If this plugin caught a real bug for you, star the repo — stars are the signal that keeps the Interlace ESLint ecosystem maintained — and follow the writeups on Dev.to for the benchmarks and security research behind these rules.
📄 License
MIT © Ofri Peretz
