Skip to main content
interlace
Plugin: import-next

eslint-plugin-import-next

Drop-in replacement for eslint-plugin-import with 8x faster cycle detection

3.1x Faster End-to-End, 8x in Rule Time

Measured on a 5,736-file / 455K-LoC React codebase: full lint 51.7s → 16.7s, no-cycle rule time 39.2s → 4.9s, with 100% detection parity. See benchmarks.

Install

npm install -D eslint-plugin-import-next

Live from GitHub

This content is fetched directly from README.md on GitHub and cached for 1 hour.

Live README from GitHubfrom eslint-plugin-import-next/README.md, cached for 1 hour.Edit on GitHub

⭐ 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.

  • Why — a linter nobody reads protects nothing. We would rather miss a finding than spend your attention on one that was never real.
  • How — evidence, not names. A rule fires on what the code does, resolved through the AST and ESLint's own scope analysis.
  • What — every finding carries its fix, in prose for a human and as structured JSON for an agent. Security rules add a CWE mapping and, where assigned, a CVSS score.

That trade costs recall, and we measure it: methodology · results · a false positive is a bug.

Getting Started

npm install eslint-plugin-import-next --save-dev

⚙️ Configuration Presets

PresetDescription
recommendedWarns on import order issues
strictAll rules set to error for production-ready code
typescriptOptimized for TypeScript projects
module-resolutionFocus on import resolution
import-styleFocus on import formatting
esmEnforce ES Modules only
architectureClean architecture boundaries
performanceBundle optimization (barrel detection)
enterpriseTeam boundaries & legacy import tracking
errorsMatches eslint-plugin-import errors preset
warningsMatches eslint-plugin-import warnings preset

🔄 Parity with eslint-plugin-import

RuleOriginal PluginStatusNotes
All Ruleseslint-plugin-import npm✅ SupportedFull 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 6000
chain 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.2s

Measured 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 … from ladders 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

PackageVersion
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

IconDescription
💼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.

Part of the Interlace ESLint ecosystem — AI-native rules with LLM-optimized error messages:

Security

PluginDownloadsDescription
eslint-plugin-anthropic-securitydownloadsAnthropic SDK security.
eslint-plugin-browser-securitydownloadsXSS, DOM security.
eslint-plugin-drizzle-securitydownloadsDrizzle security.
eslint-plugin-express-securitydownloadsExpress middleware hardening.
eslint-plugin-gemini-securitydownloadsGoogle Gemini SDK security.
eslint-plugin-jwt-securitydownloadsToken security.
eslint-plugin-knex-securitydownloadsKnex security.
eslint-plugin-lambda-securitydownloadsAWS Lambda hardening.
eslint-plugin-mcp-sdk-securitydownloadsMCP SDK security.
eslint-plugin-mongodb-securitydownloadsMongoDB injection.
eslint-plugin-mysql-securitydownloadsMySQL security.
eslint-plugin-nestjs-securitydownloadsNestJS framework hardening.
eslint-plugin-node-securitydownloadsServer-side patterns.
eslint-plugin-openai-securitydownloadsOpenAI SDK security.
eslint-plugin-postgresql-securitydownloadsPostgreSQL security.
eslint-plugin-prisma-securitydownloadsPrisma security.
eslint-plugin-secure-codingdownloadsInjection prevention.
eslint-plugin-sequelize-securitydownloadsSequelize ORM security.
eslint-plugin-sqlite-securitydownloadsSQLite security.
eslint-plugin-typeorm-securitydownloadsTypeORM security.
eslint-plugin-vercel-ai-securitydownloadsAI SDK security.

Code quality

PluginDownloadsDescription
eslint-plugin-conventionsdownloadsTeam-specific habits and styles.
eslint-plugin-maintainabilitydownloadsCognitive load and clean-code patterns.
eslint-plugin-modernizationdownloadsESNext migration + syntax evolution.
eslint-plugin-modularitydownloadsStructural integrity and DDD patterns.
eslint-plugin-operabilitydownloadsProduction readiness and resource health.
eslint-plugin-react-a11ydownloadsReact accessibility / WCAG.
eslint-plugin-react-featuresdownloadsReact best practices and optimization.
eslint-plugin-reliabilitydownloadsRuntime stability and error safety.

⭐ 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.

GitHub stars

📄 License

MIT © Ofri Peretz

View README.md on GitHub →

Building secure JavaScript with Interlace? Star the repo to get new rules and CWE coverage as we ship them — or follow the AI-code-security benchmarks behind them.