eslint-plugin-import-next 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +95 -0
- package/CHANGELOG.md +52 -0
- package/LICENSE +22 -0
- package/README.md +157 -0
- package/package.json +78 -0
- package/src/index.d.ts +98 -0
- package/src/index.js +252 -0
- package/src/rules/default.d.ts +1 -0
- package/src/rules/default.js +56 -0
- package/src/rules/enforce-dependency-direction.d.ts +9 -0
- package/src/rules/enforce-dependency-direction.js +247 -0
- package/src/rules/enforce-import-order.d.ts +14 -0
- package/src/rules/enforce-import-order.js +327 -0
- package/src/rules/extensions.d.ts +1 -0
- package/src/rules/extensions.js +108 -0
- package/src/rules/first.d.ts +5 -0
- package/src/rules/first.js +53 -0
- package/src/rules/max-dependencies.d.ts +11 -0
- package/src/rules/max-dependencies.js +251 -0
- package/src/rules/named.d.ts +5 -0
- package/src/rules/named.js +62 -0
- package/src/rules/namespace.d.ts +5 -0
- package/src/rules/namespace.js +70 -0
- package/src/rules/newline-after-import.d.ts +5 -0
- package/src/rules/newline-after-import.js +62 -0
- package/src/rules/no-amd.d.ts +7 -0
- package/src/rules/no-amd.js +120 -0
- package/src/rules/no-anonymous-default-export.d.ts +9 -0
- package/src/rules/no-anonymous-default-export.js +141 -0
- package/src/rules/no-circular-dependencies.d.ts +93 -0
- package/src/rules/no-circular-dependencies.js +412 -0
- package/src/rules/no-commonjs.d.ts +13 -0
- package/src/rules/no-commonjs.js +324 -0
- package/src/rules/no-cross-domain-imports.d.ts +15 -0
- package/src/rules/no-cross-domain-imports.js +274 -0
- package/src/rules/no-default-export.d.ts +9 -0
- package/src/rules/no-default-export.js +229 -0
- package/src/rules/no-deprecated.d.ts +11 -0
- package/src/rules/no-deprecated.js +342 -0
- package/src/rules/no-duplicates.d.ts +5 -0
- package/src/rules/no-duplicates.js +84 -0
- package/src/rules/no-extraneous-dependencies.d.ts +31 -0
- package/src/rules/no-extraneous-dependencies.js +415 -0
- package/src/rules/no-internal-modules.d.ts +13 -0
- package/src/rules/no-internal-modules.js +290 -0
- package/src/rules/no-mutable-exports.d.ts +7 -0
- package/src/rules/no-mutable-exports.js +134 -0
- package/src/rules/no-named-export.d.ts +11 -0
- package/src/rules/no-named-export.js +204 -0
- package/src/rules/no-nodejs-modules.d.ts +9 -0
- package/src/rules/no-nodejs-modules.js +237 -0
- package/src/rules/no-relative-parent-imports.d.ts +7 -0
- package/src/rules/no-relative-parent-imports.js +123 -0
- package/src/rules/no-restricted-paths.d.ts +5 -0
- package/src/rules/no-restricted-paths.js +89 -0
- package/src/rules/no-self-import.d.ts +5 -0
- package/src/rules/no-self-import.js +129 -0
- package/src/rules/no-unassigned-import.d.ts +5 -0
- package/src/rules/no-unassigned-import.js +111 -0
- package/src/rules/no-unresolved.d.ts +9 -0
- package/src/rules/no-unresolved.js +199 -0
- package/src/rules/no-unused-modules.d.ts +5 -0
- package/src/rules/no-unused-modules.js +83 -0
- package/src/rules/prefer-default-export.d.ts +9 -0
- package/src/rules/prefer-default-export.js +200 -0
- package/src/rules/prefer-node-protocol.d.ts +5 -0
- package/src/rules/prefer-node-protocol.js +182 -0
- package/src/types/index.d.ts +20 -0
- package/src/types/index.js +7 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
> Context for AI coding agents working on eslint-plugin-import-next
|
|
4
|
+
|
|
5
|
+
## Setup Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install dependencies (from monorepo root)
|
|
9
|
+
pnpm install
|
|
10
|
+
|
|
11
|
+
# Build this package
|
|
12
|
+
nx build eslint-plugin-import-next
|
|
13
|
+
|
|
14
|
+
# Run tests
|
|
15
|
+
nx test eslint-plugin-import-next
|
|
16
|
+
|
|
17
|
+
# Run tests with coverage
|
|
18
|
+
nx test eslint-plugin-import-next --coverage
|
|
19
|
+
|
|
20
|
+
# Lint this package
|
|
21
|
+
nx lint eslint-plugin-import-next
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Code Style
|
|
25
|
+
|
|
26
|
+
- TypeScript strict mode with `@interlace/eslint-devkit` types
|
|
27
|
+
- Use `AST_NODE_TYPES` constants, never string literals for node types
|
|
28
|
+
- Use `formatLLMMessage()` for all rule error messages
|
|
29
|
+
- Use `c8 ignore` comments with documented reasons for untestable code
|
|
30
|
+
- Single-pass AST traversal patterns (O(n) complexity)
|
|
31
|
+
|
|
32
|
+
## Testing Instructions
|
|
33
|
+
|
|
34
|
+
- Tests use `@typescript-eslint/rule-tester` with Vitest
|
|
35
|
+
- Each rule has `index.ts` (implementation) and `*.test.ts` (tests) in same directory
|
|
36
|
+
- Run specific rule test: `nx test eslint-plugin-import-next --testPathPattern="no-circular"`
|
|
37
|
+
- Coverage target: ≥90% lines, ≥95% functions
|
|
38
|
+
- All tests must pass before committing
|
|
39
|
+
|
|
40
|
+
## Project Structure
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
src/
|
|
44
|
+
├── index.ts # Plugin entry, 6 configs
|
|
45
|
+
└── rules/ # 30 rule directories
|
|
46
|
+
└── [rule-name]/
|
|
47
|
+
├── index.ts # Rule implementation
|
|
48
|
+
└── *.test.ts # Rule tests
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Plugin Purpose
|
|
52
|
+
|
|
53
|
+
ESLint plugin for **dependency management** with 30 LLM-optimized rules. Covers module resolution, ES module enforcement, architecture boundaries, export/import style, and dependency management.
|
|
54
|
+
|
|
55
|
+
## Available Presets
|
|
56
|
+
|
|
57
|
+
| Preset | Description |
|
|
58
|
+
| ------------------- | ------------------------------------------- |
|
|
59
|
+
| `recommended` | Balanced configuration (13 rules) |
|
|
60
|
+
| `strict` | All 30 rules as errors |
|
|
61
|
+
| `module-resolution` | Focus on import/export validation (7 rules) |
|
|
62
|
+
| `import-style` | Focus on import formatting (5 rules) |
|
|
63
|
+
| `esm` | Enforce ES Modules only (3 rules) |
|
|
64
|
+
| `architecture` | Enforce module boundaries (6 rules) |
|
|
65
|
+
|
|
66
|
+
## Rule Categories
|
|
67
|
+
|
|
68
|
+
| Category | Rules |
|
|
69
|
+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
70
|
+
| Module Resolution | `no-unresolved`, `named`, `default`, `namespace`, `extensions`, `no-self-import`, `no-duplicates` |
|
|
71
|
+
| Module System | `no-amd`, `no-commonjs`, `no-nodejs-modules` |
|
|
72
|
+
| Dependency Boundaries | `no-circular-dependencies`, `no-internal-modules`, `no-cross-domain-imports`, `enforce-dependency-direction`, `no-restricted-paths`, `no-relative-parent-imports` |
|
|
73
|
+
| Export Style | `no-default-export`, `no-named-export`, `prefer-default-export`, `no-anonymous-default-export`, `no-mutable-exports`, `no-deprecated` |
|
|
74
|
+
| Import Style | `enforce-import-order`, `first`, `newline-after-import`, `no-unassigned-import` |
|
|
75
|
+
| Dependency Management | `no-extraneous-dependencies`, `no-unused-modules`, `max-dependencies`, `prefer-node-protocol` |
|
|
76
|
+
|
|
77
|
+
## Common Fix Patterns
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
// Circular dependencies (CWE-407)
|
|
81
|
+
// BAD: A.ts imports B.ts, B.ts imports A.ts
|
|
82
|
+
// GOOD: Extract shared code to types.ts, break cycle
|
|
83
|
+
|
|
84
|
+
// Node.js protocol
|
|
85
|
+
// BAD: import { readFile } from 'fs'
|
|
86
|
+
// GOOD: import { readFile } from 'node:fs'
|
|
87
|
+
|
|
88
|
+
// Import order
|
|
89
|
+
// BAD: import local from './local'; import external from 'external';
|
|
90
|
+
// GOOD: import external from 'external'; import local from './local';
|
|
91
|
+
|
|
92
|
+
// No CommonJS
|
|
93
|
+
// BAD: const x = require('./module')
|
|
94
|
+
// GOOD: import x from './module'
|
|
95
|
+
```
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - 2024-12-05
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release with 30 LLM-optimized dependency rules
|
|
13
|
+
- **Module Resolution Rules** (7 rules):
|
|
14
|
+
- `no-unresolved` - Ensure imports resolve to a module
|
|
15
|
+
- `named` - Ensure named imports exist
|
|
16
|
+
- `default` - Ensure default export exists
|
|
17
|
+
- `namespace` - Ensure namespace imports are valid
|
|
18
|
+
- `extensions` - Enforce file extension usage
|
|
19
|
+
- `no-self-import` - Prevent module from importing itself
|
|
20
|
+
- `no-duplicates` - Prevent duplicate imports
|
|
21
|
+
- **Module System Rules** (3 rules):
|
|
22
|
+
- `no-amd` - Disallow AMD imports
|
|
23
|
+
- `no-commonjs` - Disallow CommonJS imports
|
|
24
|
+
- `no-nodejs-modules` - Disallow Node.js built-in modules
|
|
25
|
+
- **Dependency Boundaries Rules** (6 rules):
|
|
26
|
+
- `no-circular-dependencies` - Detect circular dependency chains
|
|
27
|
+
- `no-internal-modules` - Forbid deep/internal module imports
|
|
28
|
+
- `no-cross-domain-imports` - Enforce domain boundaries
|
|
29
|
+
- `enforce-dependency-direction` - Enforce layered architecture
|
|
30
|
+
- `no-restricted-paths` - Restrict imports between paths
|
|
31
|
+
- `no-relative-parent-imports` - Disallow `../` imports
|
|
32
|
+
- **Export Style Rules** (6 rules):
|
|
33
|
+
- `no-default-export` - Disallow default exports
|
|
34
|
+
- `no-named-export` - Disallow named exports
|
|
35
|
+
- `prefer-default-export` - Prefer default for single exports
|
|
36
|
+
- `no-anonymous-default-export` - Disallow anonymous default exports
|
|
37
|
+
- `no-mutable-exports` - Disallow mutable exports
|
|
38
|
+
- `no-deprecated` - Disallow deprecated exports
|
|
39
|
+
- **Import Style Rules** (4 rules):
|
|
40
|
+
- `enforce-import-order` - Enforce import ordering
|
|
41
|
+
- `first` - Ensure imports are at the top
|
|
42
|
+
- `newline-after-import` - Require newline after imports
|
|
43
|
+
- `no-unassigned-import` - Disallow side-effect imports
|
|
44
|
+
- **Dependency Management Rules** (4 rules):
|
|
45
|
+
- `no-extraneous-dependencies` - Disallow unlisted dependencies
|
|
46
|
+
- `no-unused-modules` - Detect unused exports/modules
|
|
47
|
+
- `max-dependencies` - Limit number of dependencies
|
|
48
|
+
- `prefer-node-protocol` - Prefer `node:` protocol for builtins
|
|
49
|
+
- Preset configurations: `recommended`, `strict`, `module-resolution`, `import-style`, `esm`, `architecture`
|
|
50
|
+
- Full ESLint 9 flat config support
|
|
51
|
+
- ESLint MCP integration for AI assistants
|
|
52
|
+
- TypeScript type exports for all rule options
|
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Ofri Peretz
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# eslint-plugin-import-next
|
|
2
|
+
|
|
3
|
+
> **The high-performance, agentic alternative to `eslint-plugin-import`.** Detect cycles 100x faster with caching, and fix them automatically with AI-optimized suggestions.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/eslint-plugin-import-next)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
[](https://app.codecov.io/gh/ofri-peretz/eslint/components?components%5B0%5D=import_next)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 💡 What you get
|
|
12
|
+
|
|
13
|
+
- **100x faster cycle detection:** Uses **shared filesystem caching** for instant feedback, even in large monorepos.
|
|
14
|
+
- **LLM-optimized & MCP-ready:** Structured 2-line messages with CWE + concrete fixes so humans _and_ AI auto-fixers stay aligned.
|
|
15
|
+
- **Smart refactoring suggestions:** Doesn't just say "Cycle Detected" - tells you exactly how to refactor (e.g., "Extract types to `types.ts`" vs "Use Dependency Injection").
|
|
16
|
+
- **Tiered presets:** `recommended`, `architecture` for fast policy rollout.
|
|
17
|
+
- **Zero false positives:** Precise detection with incremental caching.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 📊 OWASP Coverage Matrix
|
|
22
|
+
|
|
23
|
+
> **Note:** This plugin focuses on **code architecture and dependency management** rather than OWASP security. For security rules, see [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding).
|
|
24
|
+
|
|
25
|
+
| Category | CWE | Rules |
|
|
26
|
+
| ------------------------- | -------- | ----------------------------------------------------- |
|
|
27
|
+
| **Circular Dependencies** | CWE-407 | `no-circular-dependencies` |
|
|
28
|
+
| **Module Resolution** | CWE-829 | `no-unresolved`, `no-self-import`, `no-duplicates` |
|
|
29
|
+
| **Architecture** | CWE-1047 | `no-internal-modules`, `enforce-dependency-direction` |
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## ⚡ Performance: The "Killer Feature"
|
|
34
|
+
|
|
35
|
+
`import/no-cycle` is notorious for slowing down builds because it re-analyzes the entire graph for every file.
|
|
36
|
+
**`import-next/no-circular-dependencies`** uses a **smart incremental cache** that persists across lint runs.
|
|
37
|
+
|
|
38
|
+
| Rule | Time (10k files) | Memory |
|
|
39
|
+
| ------------------------------------------ | ------------------ | ------ |
|
|
40
|
+
| `import/no-cycle` | ~45s | High |
|
|
41
|
+
| **`import-next/no-circular-dependencies`** | **~0.4s** (cached) | Low |
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🤖 Smart Fixes (Agentic)
|
|
46
|
+
|
|
47
|
+
Unlike legacy plugins, we analyze the _type_ of cycle and suggest the correct architectural pattern.
|
|
48
|
+
|
|
49
|
+
### Scenario A: Type-only Cycle
|
|
50
|
+
|
|
51
|
+
**Error:**
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
Cycle: User.ts -> Post.ts -> User.ts
|
|
55
|
+
Message: 🧩 CWE-407 | Circular dependency detected (Types only)
|
|
56
|
+
Fix: Extract shared types to 'types.ts'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Scenario B: Hard Dependency
|
|
60
|
+
|
|
61
|
+
**Error:**
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
Cycle: ServiceA.ts -> ServiceB.ts -> ServiceA.ts
|
|
65
|
+
Message: 🏗️ CWE-407 | Circular dependency detected (Hard Coupling)
|
|
66
|
+
Fix: Use Dependency Injection pattern or split 'ServiceA' into Core/Extended
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## 📦 Installation
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install --save-dev eslint-plugin-dependencies
|
|
75
|
+
# or
|
|
76
|
+
pnpm add -D eslint-plugin-dependencies
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
## 🚀 Quick Start (Flat Config)
|
|
80
|
+
|
|
81
|
+
```javascript
|
|
82
|
+
// eslint.config.js
|
|
83
|
+
import dependencies from 'eslint-plugin-dependencies';
|
|
84
|
+
|
|
85
|
+
export default [
|
|
86
|
+
// 1. Recommended (Balanced)
|
|
87
|
+
dependencies.configs.recommended,
|
|
88
|
+
|
|
89
|
+
// 2. OR Architecture Strict (Good for Monorepos)
|
|
90
|
+
dependencies.configs.architecture,
|
|
91
|
+
];
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## 🔧 Rule Categories
|
|
97
|
+
|
|
98
|
+
### ⚡ Performance & Architecture (The Good Stuff)
|
|
99
|
+
|
|
100
|
+
| Rule | Description | Fix |
|
|
101
|
+
| ------------------------------------------------------------------------------ | -------------------------------------------------------------- | -------- |
|
|
102
|
+
| [`no-circular-dependencies`](./docs/rules/no-circular-dependencies.md) | **Fast**, cached cycle detection. | 🧠 Smart |
|
|
103
|
+
| [`no-internal-modules`](./docs/rules/no-internal-modules.md) | Enforce entry points (no `import .../dist/utils`). | |
|
|
104
|
+
| [`enforce-dependency-direction`](./docs/rules/enforce-dependency-direction.md) | Enforce layered architecture (e.g., `feature` imports `core`). | |
|
|
105
|
+
|
|
106
|
+
### 📦 Module Resolution
|
|
107
|
+
|
|
108
|
+
| Rule | Description |
|
|
109
|
+
| -------------------------------------------------- | -------------------------------- |
|
|
110
|
+
| [`no-unresolved`](./docs/rules/no-unresolved.md) | Ensure imports verify. |
|
|
111
|
+
| [`no-duplicates`](./docs/rules/no-duplicates.md) | Merge duplicate imports. |
|
|
112
|
+
| [`no-self-import`](./docs/rules/no-self-import.md) | Prevent importing the same file. |
|
|
113
|
+
|
|
114
|
+
### 🧹 Clean Code
|
|
115
|
+
|
|
116
|
+
| Rule | Description |
|
|
117
|
+
| -------------------------------------------------------------------------- | ------------------------------------------ |
|
|
118
|
+
| [`enforce-import-order`](./docs/rules/enforce-import-order.md) | Group imports automatically. |
|
|
119
|
+
| [`no-unused-modules`](./docs/rules/no-unused-modules.md) | Find dead code. |
|
|
120
|
+
| [`no-extraneous-dependencies`](./docs/rules/no-extraneous-dependencies.md) | Prevent importing devDependencies in prod. |
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## 🤖 LLM & MCP Integration
|
|
125
|
+
|
|
126
|
+
This plugin is optimized for **Cursor** and **GitHub Copilot**. Add this to your `.cursor/mcp.json` to let the AI run and fix these rules directly:
|
|
127
|
+
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"mcpServers": {
|
|
131
|
+
"eslint": {
|
|
132
|
+
"command": "npx",
|
|
133
|
+
"args": ["@eslint/mcp@latest"]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 🔗 Related ESLint Plugins
|
|
142
|
+
|
|
143
|
+
Part of the **Forge-JS ESLint Ecosystem** — AI-native security plugins with LLM-optimized error messages:
|
|
144
|
+
|
|
145
|
+
| Plugin | Description | Rules |
|
|
146
|
+
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | :---: |
|
|
147
|
+
| [`eslint-plugin-secure-coding`](https://www.npmjs.com/package/eslint-plugin-secure-coding) | Universal security (OWASP Top 10 Web + Mobile) | 89 |
|
|
148
|
+
| [`eslint-plugin-jwt`](https://www.npmjs.com/package/eslint-plugin-jwt) | JWT security (algorithm confusion, weak secrets, claims) | 13 |
|
|
149
|
+
| [`eslint-plugin-crypto`](https://www.npmjs.com/package/eslint-plugin-crypto) | Cryptographic best practices (weak algorithms, key handling) | 24 |
|
|
150
|
+
| [`eslint-plugin-pg`](https://www.npmjs.com/package/eslint-plugin-pg) | PostgreSQL/node-postgres security | 13 |
|
|
151
|
+
| [`eslint-plugin-vercel-ai-security`](https://www.npmjs.com/package/eslint-plugin-vercel-ai-security) | Vercel AI SDK security | 19 |
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT © [Ofri Peretz](https://github.com/ofri-peretz)
|
package/package.json
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "eslint-plugin-import-next",
|
|
3
|
+
"version": "2.0.1",
|
|
4
|
+
"description": "Drop-in replacement for eslint-plugin-import. 100x faster no-cycle detection, AI-optimized fixes, zero config migration.",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./src/index.js",
|
|
7
|
+
"types": "./src/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./src/index.d.ts",
|
|
11
|
+
"default": "./src/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./types": {
|
|
14
|
+
"types": "./src/types/index.d.ts",
|
|
15
|
+
"default": "./src/types/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"author": "Ofri Peretz <ofriperetzdev@gmail.com>",
|
|
19
|
+
"license": "MIT",
|
|
20
|
+
"homepage": "https://github.com/ofri-peretz/eslint#readme",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/ofri-peretz/eslint.git",
|
|
24
|
+
"directory": "packages/eslint-plugin-import-next"
|
|
25
|
+
},
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/ofri-peretz/eslint/issues"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"src/",
|
|
34
|
+
"dist/",
|
|
35
|
+
"README.md",
|
|
36
|
+
"LICENSE",
|
|
37
|
+
"CHANGELOG.md",
|
|
38
|
+
"AGENTS.md"
|
|
39
|
+
],
|
|
40
|
+
"keywords": [
|
|
41
|
+
"eslint",
|
|
42
|
+
"eslint-plugin",
|
|
43
|
+
"eslintplugin",
|
|
44
|
+
"eslint-plugin-import",
|
|
45
|
+
"eslint-plugin-import-alternative",
|
|
46
|
+
"import",
|
|
47
|
+
"imports",
|
|
48
|
+
"no-cycle",
|
|
49
|
+
"circular-dependencies",
|
|
50
|
+
"import-order",
|
|
51
|
+
"modules",
|
|
52
|
+
"module-resolution",
|
|
53
|
+
"commonjs",
|
|
54
|
+
"esm",
|
|
55
|
+
"llm-optimized",
|
|
56
|
+
"ai-assistant",
|
|
57
|
+
"auto-fix",
|
|
58
|
+
"typescript",
|
|
59
|
+
"static-analysis",
|
|
60
|
+
"mcp",
|
|
61
|
+
"agentic"
|
|
62
|
+
],
|
|
63
|
+
"engines": {
|
|
64
|
+
"node": ">=18.0.0"
|
|
65
|
+
},
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"typescript": "^5.9.3"
|
|
68
|
+
},
|
|
69
|
+
"dependencies": {
|
|
70
|
+
"tslib": "^2.3.0",
|
|
71
|
+
"@interlace/eslint-devkit": "workspace:*"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@typescript-eslint/parser": "^8.46.2",
|
|
75
|
+
"@typescript-eslint/rule-tester": "^8.46.2",
|
|
76
|
+
"vitest": "^4.0.4"
|
|
77
|
+
}
|
|
78
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* eslint-plugin-import-next
|
|
3
|
+
*
|
|
4
|
+
* Drop-in replacement for eslint-plugin-import with 30 LLM-optimized rules.
|
|
5
|
+
* Covers import validation, module resolution, circular dependencies,
|
|
6
|
+
* and export style enforcement.
|
|
7
|
+
*
|
|
8
|
+
* Compatible with ESLint 8+ and ESLint 9+
|
|
9
|
+
*
|
|
10
|
+
* @see https://eslint.org/docs/latest/extend/plugins - ESLint Plugin Documentation
|
|
11
|
+
*/
|
|
12
|
+
import { clearCircularDependencyCache } from './rules/no-circular-dependencies';
|
|
13
|
+
/**
|
|
14
|
+
* Collection of all ESLint rules provided by this plugin
|
|
15
|
+
*/
|
|
16
|
+
export declare const rules: {
|
|
17
|
+
'no-duplicates': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
18
|
+
named: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
19
|
+
default: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
20
|
+
namespace: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
21
|
+
extensions: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
22
|
+
'no-self-import': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
23
|
+
'no-unresolved': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
24
|
+
'no-amd': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
25
|
+
'no-commonjs': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
26
|
+
'no-nodejs-modules': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
27
|
+
'no-circular-dependencies': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
28
|
+
'no-internal-modules': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
29
|
+
'no-cross-domain-imports': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
30
|
+
'enforce-dependency-direction': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
31
|
+
'no-restricted-paths': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
32
|
+
'no-relative-parent-imports': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
33
|
+
'no-default-export': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
34
|
+
'no-named-export': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
35
|
+
'prefer-default-export': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
36
|
+
'no-anonymous-default-export': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
37
|
+
'no-mutable-exports': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
38
|
+
'no-deprecated': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
39
|
+
'enforce-import-order': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
40
|
+
'no-unassigned-import': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
41
|
+
first: ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
42
|
+
'newline-after-import': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
43
|
+
'no-extraneous-dependencies': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
44
|
+
'no-unused-modules': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
45
|
+
'max-dependencies': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
46
|
+
'prefer-node-protocol': ESLintUtils.RuleModule<MessageIds, Options, unknown, ESLintUtils.RuleListener>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* ESLint Plugin object following the official plugin structure
|
|
50
|
+
*/
|
|
51
|
+
export declare const plugin: TSESLint.FlatConfig.Plugin;
|
|
52
|
+
/**
|
|
53
|
+
* Preset configurations for common use cases
|
|
54
|
+
*/
|
|
55
|
+
export declare const configs: {
|
|
56
|
+
/**
|
|
57
|
+
* Recommended configuration for most projects
|
|
58
|
+
*
|
|
59
|
+
* Includes essential rules with sensible defaults:
|
|
60
|
+
* - Errors on unresolved imports
|
|
61
|
+
* - Errors on circular dependencies
|
|
62
|
+
* - Warns on module system violations
|
|
63
|
+
* - Warns on import order issues
|
|
64
|
+
*/
|
|
65
|
+
recommended: TSESLint.FlatConfig.Config;
|
|
66
|
+
/**
|
|
67
|
+
* Strict configuration for maximum enforcement
|
|
68
|
+
*
|
|
69
|
+
* All rules set to error for production-ready code
|
|
70
|
+
*/
|
|
71
|
+
strict: TSESLint.FlatConfig.Config;
|
|
72
|
+
/**
|
|
73
|
+
* Module resolution focused configuration
|
|
74
|
+
*
|
|
75
|
+
* Ensures all imports resolve correctly
|
|
76
|
+
*/
|
|
77
|
+
'module-resolution': TSESLint.FlatConfig.Config;
|
|
78
|
+
/**
|
|
79
|
+
* Import style focused configuration
|
|
80
|
+
*
|
|
81
|
+
* Enforces consistent import formatting
|
|
82
|
+
*/
|
|
83
|
+
'import-style': TSESLint.FlatConfig.Config;
|
|
84
|
+
/**
|
|
85
|
+
* ESM-only configuration
|
|
86
|
+
*
|
|
87
|
+
* Enforces ES Modules and prohibits CommonJS/AMD
|
|
88
|
+
*/
|
|
89
|
+
esm: TSESLint.FlatConfig.Config;
|
|
90
|
+
/**
|
|
91
|
+
* Architecture boundaries configuration
|
|
92
|
+
*
|
|
93
|
+
* Enforces clean architecture and module boundaries
|
|
94
|
+
*/
|
|
95
|
+
architecture: TSESLint.FlatConfig.Config;
|
|
96
|
+
};
|
|
97
|
+
export { clearCircularDependencyCache };
|
|
98
|
+
export default plugin;
|