eslint-plugin-import-next
v2.2.1
Published
Drop-in replacement for eslint-plugin-import. 100x faster no-cycle detection, AI-optimized fixes, zero config migration.
Maintainers
Readme
Description
This plugin represents the next evolution of import validation, offering advanced features like granular import sorting and strictly enforced architectural boundaries. It is designed to modernize your development workflow by providing tools that prevent circular dependencies and enforce clean module structures. By integrating these rules, you can maintain a scalable and organized codebase that is easy to navigate and refactor.
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-devAI-Optimized Messages
This plugin is optimized for ESLint's Model Context Protocol (MCP), enabling AI assistants like Cursor, GitHub Copilot, and Claude to:
- Understand the exact vulnerability type via CWE references
- Apply the correct fix using structured guidance
- Provide educational context to developers
Unlike legacy plugins, we analyze the type of issue and suggest the correct fix:
# Type-only Cycle
🧩 CWE-407 | Circular Dependency (Types Only)
Path: auth.ts → user.ts → auth.ts
Fix: Extract shared types to 'types.ts' or use 'import type'
# Hard Dependency Cycle
🏗️ CWE-407 | Circular Dependency (Runtime)
Path: ServiceA → ServiceB → ServiceA
Fix: Use Dependency Injection or split into Core/Extended modules
# Deep Cycle (previously undetectable)
⚠️ CWE-407 | Deep Circular Dependency (depth: 7)
Path: A → B → C → D → E → F → G → A
Impact: May cause Vite/Next.js build failures
Fix: Introduce an abstraction layer between A and G// .cursor/mcp.json
{
"mcpServers": {
"eslint": {
"command": "npx",
"args": ["@eslint/mcp@latest"]
}
}
}By providing this structured context (CWE, OWASP, Fix), we enable AI tools to reason about the security flaw rather than hallucinating. This allows Copilot/Cursor to suggest the exact correct fix immediately.
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. |
| Rule | Pattern/Concept | Description | 💼 | ⚠️ | 🔧 | 💡 | 🚫 |
| :------------------------------------------------------------------------------------------------------------------------- | :--------------- | :-------------------------------------------------- | :-: | :-: | :-: | :-: | :-: |
| no-unresolved | Static Analysis | Ensure imports resolve | 💼 | | | 💡 | |
| named | Static Analysis | Ensure named imports exist | 💼 | | | | |
| default | Static Analysis | Ensure default export exists | 💼 | | | | |
| namespace | Static Analysis | Ensure namespace properties exist | 💼 | | | | |
| no-absolute-path | Static Analysis | Forbid absolute paths | | | 🔧 | | |
| no-dynamic-require | Static Analysis | Forbid dynamic require() | | | | | |
| no-internal-modules | Static Analysis | Enforce entry points only | | | | 💡 | |
| no-relative-packages | Static Analysis | Use package names | | | 🔧 | | |
| no-relative-parent-imports | Static Analysis | Prevent ../ imports | | | | | |
| no-self-import | Static Analysis | Prevent self-imports | 💼 | | | 💡 | |
| no-cycle | Static Analysis | 100x faster cycle detection | 💼 | | | 💡 | |
| no-useless-path-segments | Static Analysis | Simplify paths | | | 🔧 | | |
| no-restricted-paths | Static Analysis | Custom path restrictions | | | | | |
| export | Helpful Warnings | Forbid duplicate exports | 💼 | | | | |
| no-deprecated | Helpful Warnings | Warn on @deprecated imports | | | | | |
| no-empty-named-blocks | Helpful Warnings | Forbid empty {} imports | | | 🔧 | 💡 | |
| no-extraneous-dependencies | Helpful Warnings | Prevent unlisted deps | 💼 | | | 💡 | |
| no-mutable-exports | Helpful Warnings | Forbid let/var exports | | | | | |
| no-named-as-default | Helpful Warnings | Warn on default shadowing | 💼 | | | | |
| no-named-as-default-member | Helpful Warnings | Warn on property access | 💼 | | | | |
| no-unused-modules | Helpful Warnings | Find dead code | | | | 💡 | |
| no-amd | Module Systems | Forbid AMD require/define | | | | | |
| no-commonjs | Module Systems | Forbid CommonJS | | | | | |
| no-nodejs-modules | Module Systems | Forbid Node.js builtins | | | | | |
| no-import-module-exports | Module Systems | No mixed ES/CJS | | | | | |
| unambiguous | Module Systems | Warn on ambiguous modules | | | | | |
| consistent-type-specifier-style | Style Guide | Type import style | | | 🔧 | | |
| dynamic-import-chunkname | Style Guide | Require webpack chunk names | | | | 💡 | |
| exports-last | Style Guide | Exports at end of file | | | | | |
| extensions | Style Guide | Enforce file extension usage | | | | | |
| first | Style Guide | Imports must be first | | | 🔧 | | |
| group-exports | Style Guide | Group exports together | | | | | |
| max-dependencies | Style Guide | Limit module dependencies | | | | | |
| newline-after-import | Style Guide | Newline after imports | | | 🔧 | | |
| no-anonymous-default-export | Style Guide | Require named default exports | | | | | |
| no-default-export | Style Guide | Forbid default exports | | | | 💡 | |
| no-duplicates | Style Guide | Merge duplicate imports | 💼 | | 🔧 | | |
| no-named-default | Style Guide | Use default import syntax | | | | | |
| no-named-export | Style Guide | Forbid named exports | | | | | |
| no-namespace | Style Guide | Forbid * as imports | | | | | |
| no-unassigned-import | Style Guide | Forbid side-effect imports | | | | | |
| order | Style Guide | Sort and group imports | 💼 | | 🔧 | | |
| prefer-default-export | Style Guide | Prefer default for single exports | | | | | |
| no-cross-domain-imports | Architecture | Enforce clean architecture boundaries | | | | | |
| enforce-dependency-direction | Architecture | Enforce layered architecture (UI → Services → Data) | | | | | |
| prefer-node-protocol | Architecture | Prefer node:fs over fs | | | | | |
| no-barrel-file | Architecture | Detect barrel files that harm build performance | | | | | |
| no-barrel-import | Architecture | Flag imports from barrel files | | | | | |
| prefer-tree-shakeable-imports | Architecture | Enforce tree-shakeable import patterns | | | | | |
| prefer-direct-import | Architecture | Suggest direct imports with autofix | | | | | |
| no-full-package-import | Architecture | Block full imports from large packages | | | | | |
| enforce-team-boundaries | Architecture | Prevent unauthorized cross-team imports | | | | | |
| no-legacy-imports | Architecture | Detect deprecated imports with autofix | | | | | |
🔄 Compatibility Matrix
| Rule | Original Plugin | Status | Notes |
| :-------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------- | :----------------------- |
| All Rules | eslint-plugin-import | ✅ Supported | Full drop-in replacement |
⚙️ 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 |
🔗 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-crypto | | NodeJS Cryptography security rules. |
|
eslint-plugin-jwt | | JWT security & best practices. |
|
eslint-plugin-browser-security | | Browser-specific security & XSS prevention. |
|
eslint-plugin-vercel-ai-security | | Vercel AI SDK security rules. |
|
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-import-next | | Next-gen import sorting & architecture. |
📄 License
MIT © Ofri Peretz
