eslint-plugin-import-next 2.3.9 → 2.3.11
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/README.md +47 -0
- package/package.json +16 -12
- package/src/files/foo.js +0 -5
- package/src/files/no-default.js +0 -5
- package/src/index.d.ts +15 -2812
- package/src/index.js +5 -147
- package/src/oxlint.d.ts +17 -20
- package/src/oxlint.js +0 -18
- package/src/rules/consistent-type-specifier-style.js +0 -19
- package/src/rules/default.js +0 -7
- package/src/rules/dynamic-import-chunkname.js +0 -8
- package/src/rules/enforce-dependency-direction.js +2 -39
- package/src/rules/enforce-import-order.js +3 -33
- package/src/rules/enforce-team-boundaries.js +0 -49
- package/src/rules/export.js +0 -9
- package/src/rules/exports-last.js +0 -10
- package/src/rules/extensions.js +2 -11
- package/src/rules/first.js +0 -6
- package/src/rules/group-exports.js +0 -13
- package/src/rules/max-dependencies.js +0 -16
- package/src/rules/named.js +1 -10
- package/src/rules/namespace.js +1 -11
- package/src/rules/newline-after-import.js +2 -13
- package/src/rules/no-absolute-path.js +0 -7
- package/src/rules/no-amd.js +1 -18
- package/src/rules/no-anonymous-default-export.js +0 -13
- package/src/rules/no-barrel-file.js +0 -32
- package/src/rules/no-barrel-import.js +0 -25
- package/src/rules/no-commonjs.js +0 -18
- package/src/rules/no-cross-domain-imports.js +2 -47
- package/src/rules/no-cycle.js +2 -135
- package/src/rules/no-default-export.js +0 -28
- package/src/rules/no-deprecated.js +0 -32
- package/src/rules/no-duplicates.js +2 -10
- package/src/rules/no-dynamic-require.js +0 -6
- package/src/rules/no-empty-named-blocks.js +1 -17
- package/src/rules/no-extraneous-dependencies.js +0 -38
- package/src/rules/no-full-package-import.js +0 -19
- package/src/rules/no-import-module-exports.js +0 -8
- package/src/rules/no-internal-modules.js +0 -40
- package/src/rules/no-legacy-imports.js +1 -11
- package/src/rules/no-mutable-exports.js +0 -14
- package/src/rules/no-named-as-default-member.js +0 -11
- package/src/rules/no-named-as-default.js +0 -17
- package/src/rules/no-named-default.js +0 -5
- package/src/rules/no-named-export.js +1 -22
- package/src/rules/no-namespace.js +0 -10
- package/src/rules/no-nodejs-modules.js +0 -15
- package/src/rules/no-relative-packages.js +0 -15
- package/src/rules/no-relative-parent-imports.js +0 -11
- package/src/rules/no-restricted-paths.js +0 -6
- package/src/rules/no-self-import.js +0 -22
- package/src/rules/no-unassigned-import.js +0 -14
- package/src/rules/no-unresolved.js +0 -16
- package/src/rules/no-unused-modules.js +0 -7
- package/src/rules/no-useless-path-segments.js +0 -15
- package/src/rules/prefer-default-export.js +0 -18
- package/src/rules/prefer-direct-import.js +1 -21
- package/src/rules/prefer-modern-api.js +0 -21
- package/src/rules/prefer-node-protocol.js +0 -15
- package/src/rules/prefer-tree-shakeable-imports.js +0 -14
- package/src/rules/require-import-approval.js +0 -21
- package/src/rules/unambiguous.js +0 -11
- package/src/types/index.js +0 -5
- package/AGENTS.md +0 -95
- package/CHANGELOG.md +0 -170
- package/src/files/foo.d.ts +0 -7
- package/src/files/no-default.d.ts +0 -6
- package/src/rules/consistent-type-specifier-style.d.ts +0 -13
- package/src/rules/default.d.ts +0 -9
- package/src/rules/dynamic-import-chunkname.d.ts +0 -26
- package/src/rules/enforce-dependency-direction.d.ts +0 -27
- package/src/rules/enforce-import-order.d.ts +0 -29
- package/src/rules/enforce-team-boundaries.d.ts +0 -47
- package/src/rules/export.d.ts +0 -17
- package/src/rules/exports-last.d.ts +0 -15
- package/src/rules/extensions.d.ts +0 -17
- package/src/rules/first.d.ts +0 -13
- package/src/rules/group-exports.d.ts +0 -15
- package/src/rules/max-dependencies.d.ts +0 -26
- package/src/rules/named.d.ts +0 -13
- package/src/rules/namespace.d.ts +0 -13
- package/src/rules/newline-after-import.d.ts +0 -13
- package/src/rules/no-absolute-path.d.ts +0 -25
- package/src/rules/no-amd.d.ts +0 -21
- package/src/rules/no-anonymous-default-export.d.ts +0 -24
- package/src/rules/no-barrel-file.d.ts +0 -55
- package/src/rules/no-barrel-import.d.ts +0 -48
- package/src/rules/no-commonjs.d.ts +0 -28
- package/src/rules/no-cross-domain-imports.d.ts +0 -41
- package/src/rules/no-cycle.d.ts +0 -102
- package/src/rules/no-default-export.d.ts +0 -24
- package/src/rules/no-deprecated.d.ts +0 -26
- package/src/rules/no-duplicates.d.ts +0 -13
- package/src/rules/no-dynamic-require.d.ts +0 -22
- package/src/rules/no-empty-named-blocks.d.ts +0 -17
- package/src/rules/no-extraneous-dependencies.d.ts +0 -45
- package/src/rules/no-full-package-import.d.ts +0 -42
- package/src/rules/no-import-module-exports.d.ts +0 -21
- package/src/rules/no-internal-modules.d.ts +0 -28
- package/src/rules/no-legacy-imports.d.ts +0 -47
- package/src/rules/no-mutable-exports.d.ts +0 -22
- package/src/rules/no-named-as-default-member.d.ts +0 -15
- package/src/rules/no-named-as-default.d.ts +0 -15
- package/src/rules/no-named-default.d.ts +0 -15
- package/src/rules/no-named-export.d.ts +0 -26
- package/src/rules/no-namespace.d.ts +0 -21
- package/src/rules/no-nodejs-modules.d.ts +0 -24
- package/src/rules/no-relative-packages.d.ts +0 -21
- package/src/rules/no-relative-parent-imports.d.ts +0 -22
- package/src/rules/no-restricted-paths.d.ts +0 -20
- package/src/rules/no-self-import.d.ts +0 -15
- package/src/rules/no-unassigned-import.d.ts +0 -20
- package/src/rules/no-unresolved.d.ts +0 -20
- package/src/rules/no-unused-modules.d.ts +0 -19
- package/src/rules/no-useless-path-segments.d.ts +0 -23
- package/src/rules/prefer-default-export.d.ts +0 -24
- package/src/rules/prefer-direct-import.d.ts +0 -51
- package/src/rules/prefer-modern-api.d.ts +0 -47
- package/src/rules/prefer-node-protocol.d.ts +0 -19
- package/src/rules/prefer-tree-shakeable-imports.d.ts +0 -49
- package/src/rules/require-import-approval.d.ts +0 -52
- package/src/rules/unambiguous.d.ts +0 -15
package/src/index.js
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.clearCircularDependencyCache = exports.configs = exports.plugin = exports.rules = void 0;
|
|
9
|
-
// Module Resolution Rules
|
|
10
4
|
const no_duplicates_1 = require("./rules/no-duplicates");
|
|
11
5
|
const named_1 = require("./rules/named");
|
|
12
6
|
const default_1 = require("./rules/default");
|
|
@@ -18,13 +12,11 @@ const no_absolute_path_1 = require("./rules/no-absolute-path");
|
|
|
18
12
|
const no_dynamic_require_1 = require("./rules/no-dynamic-require");
|
|
19
13
|
const no_relative_packages_1 = require("./rules/no-relative-packages");
|
|
20
14
|
const no_useless_path_segments_1 = require("./rules/no-useless-path-segments");
|
|
21
|
-
// Module System Rules
|
|
22
15
|
const no_amd_1 = require("./rules/no-amd");
|
|
23
16
|
const no_commonjs_1 = require("./rules/no-commonjs");
|
|
24
17
|
const no_nodejs_modules_1 = require("./rules/no-nodejs-modules");
|
|
25
18
|
const no_import_module_exports_1 = require("./rules/no-import-module-exports");
|
|
26
19
|
const unambiguous_1 = require("./rules/unambiguous");
|
|
27
|
-
// Dependency Boundaries Rules
|
|
28
20
|
const no_cycle_1 = require("./rules/no-cycle");
|
|
29
21
|
Object.defineProperty(exports, "clearCircularDependencyCache", { enumerable: true, get: function () { return no_cycle_1.clearCircularDependencyCache; } });
|
|
30
22
|
const no_internal_modules_1 = require("./rules/no-internal-modules");
|
|
@@ -32,7 +24,6 @@ const no_cross_domain_imports_1 = require("./rules/no-cross-domain-imports");
|
|
|
32
24
|
const enforce_dependency_direction_1 = require("./rules/enforce-dependency-direction");
|
|
33
25
|
const no_restricted_paths_1 = require("./rules/no-restricted-paths");
|
|
34
26
|
const no_relative_parent_imports_1 = require("./rules/no-relative-parent-imports");
|
|
35
|
-
// Export Style Rules
|
|
36
27
|
const export_1 = require("./rules/export");
|
|
37
28
|
const no_default_export_1 = require("./rules/no-default-export");
|
|
38
29
|
const no_named_export_1 = require("./rules/no-named-export");
|
|
@@ -42,7 +33,6 @@ const no_mutable_exports_1 = require("./rules/no-mutable-exports");
|
|
|
42
33
|
const no_deprecated_1 = require("./rules/no-deprecated");
|
|
43
34
|
const exports_last_1 = require("./rules/exports-last");
|
|
44
35
|
const group_exports_1 = require("./rules/group-exports");
|
|
45
|
-
// Import Style Rules
|
|
46
36
|
const enforce_import_order_1 = require("./rules/enforce-import-order");
|
|
47
37
|
const no_unassigned_import_1 = require("./rules/no-unassigned-import");
|
|
48
38
|
const first_1 = require("./rules/first");
|
|
@@ -54,28 +44,20 @@ const no_named_default_1 = require("./rules/no-named-default");
|
|
|
54
44
|
const no_namespace_1 = require("./rules/no-namespace");
|
|
55
45
|
const consistent_type_specifier_style_1 = require("./rules/consistent-type-specifier-style");
|
|
56
46
|
const dynamic_import_chunkname_1 = require("./rules/dynamic-import-chunkname");
|
|
57
|
-
// Dependency Management Rules
|
|
58
47
|
const no_extraneous_dependencies_1 = require("./rules/no-extraneous-dependencies");
|
|
59
48
|
const no_unused_modules_1 = require("./rules/no-unused-modules");
|
|
60
49
|
const max_dependencies_1 = require("./rules/max-dependencies");
|
|
61
50
|
const prefer_node_protocol_1 = require("./rules/prefer-node-protocol");
|
|
62
|
-
// Bundle Optimization Rules (Phase 2)
|
|
63
51
|
const no_barrel_file_1 = require("./rules/no-barrel-file");
|
|
64
52
|
const no_barrel_import_1 = require("./rules/no-barrel-import");
|
|
65
53
|
const prefer_tree_shakeable_imports_1 = require("./rules/prefer-tree-shakeable-imports");
|
|
66
54
|
const prefer_direct_import_1 = require("./rules/prefer-direct-import");
|
|
67
55
|
const no_full_package_import_1 = require("./rules/no-full-package-import");
|
|
68
|
-
// Enterprise Governance Rules (Phase 4)
|
|
69
56
|
const enforce_team_boundaries_1 = require("./rules/enforce-team-boundaries");
|
|
70
57
|
const no_legacy_imports_1 = require("./rules/no-legacy-imports");
|
|
71
58
|
const require_import_approval_1 = require("./rules/require-import-approval");
|
|
72
59
|
const prefer_modern_api_1 = require("./rules/prefer-modern-api");
|
|
73
|
-
/**
|
|
74
|
-
* Collection of all ESLint rules provided by this plugin
|
|
75
|
-
* Full backwards compatibility with eslint-plugin-import
|
|
76
|
-
*/
|
|
77
60
|
exports.rules = {
|
|
78
|
-
// Module Resolution Rules
|
|
79
61
|
'no-duplicates': no_duplicates_1.noDuplicates,
|
|
80
62
|
named: named_1.named,
|
|
81
63
|
default: default_1.defaultRule,
|
|
@@ -87,20 +69,17 @@ exports.rules = {
|
|
|
87
69
|
'no-dynamic-require': no_dynamic_require_1.noDynamicRequire,
|
|
88
70
|
'no-relative-packages': no_relative_packages_1.noRelativePackages,
|
|
89
71
|
'no-useless-path-segments': no_useless_path_segments_1.noUselessPathSegments,
|
|
90
|
-
// Module System Rules
|
|
91
72
|
'no-amd': no_amd_1.noAmd,
|
|
92
73
|
'no-commonjs': no_commonjs_1.noCommonjs,
|
|
93
74
|
'no-nodejs-modules': no_nodejs_modules_1.noNodejsModules,
|
|
94
75
|
'no-import-module-exports': no_import_module_exports_1.noImportModuleExports,
|
|
95
76
|
unambiguous: unambiguous_1.unambiguous,
|
|
96
|
-
// Dependency Boundaries Rules
|
|
97
77
|
'no-cycle': no_cycle_1.noCycle,
|
|
98
78
|
'no-internal-modules': no_internal_modules_1.noInternalModules,
|
|
99
79
|
'no-cross-domain-imports': no_cross_domain_imports_1.noCrossDomainImports,
|
|
100
80
|
'enforce-dependency-direction': enforce_dependency_direction_1.enforceDependencyDirection,
|
|
101
81
|
'no-restricted-paths': no_restricted_paths_1.noRestrictedPaths,
|
|
102
82
|
'no-relative-parent-imports': no_relative_parent_imports_1.noRelativeParentImports,
|
|
103
|
-
// Export Style Rules
|
|
104
83
|
export: export_1.exportRule,
|
|
105
84
|
'no-default-export': no_default_export_1.noDefaultExport,
|
|
106
85
|
'no-named-export': no_named_export_1.noNamedExport,
|
|
@@ -110,9 +89,8 @@ exports.rules = {
|
|
|
110
89
|
'no-deprecated': no_deprecated_1.noDeprecated,
|
|
111
90
|
'exports-last': exports_last_1.exportsLast,
|
|
112
91
|
'group-exports': group_exports_1.groupExports,
|
|
113
|
-
// Import Style Rules
|
|
114
92
|
'enforce-import-order': enforce_import_order_1.enforceImportOrder,
|
|
115
|
-
order: enforce_import_order_1.enforceImportOrder,
|
|
93
|
+
order: enforce_import_order_1.enforceImportOrder,
|
|
116
94
|
'no-unassigned-import': no_unassigned_import_1.noUnassignedImport,
|
|
117
95
|
first: first_1.first,
|
|
118
96
|
'newline-after-import': newline_after_import_1.newlineAfterImport,
|
|
@@ -123,98 +101,62 @@ exports.rules = {
|
|
|
123
101
|
'no-namespace': no_namespace_1.noNamespace,
|
|
124
102
|
'consistent-type-specifier-style': consistent_type_specifier_style_1.consistentTypeSpecifierStyle,
|
|
125
103
|
'dynamic-import-chunkname': dynamic_import_chunkname_1.dynamicImportChunkname,
|
|
126
|
-
// Dependency Management Rules
|
|
127
104
|
'no-extraneous-dependencies': no_extraneous_dependencies_1.noExtraneousDependencies,
|
|
128
105
|
'no-unused-modules': no_unused_modules_1.noUnusedModules,
|
|
129
106
|
'max-dependencies': max_dependencies_1.maxDependencies,
|
|
130
107
|
'prefer-node-protocol': prefer_node_protocol_1.preferNodeProtocol,
|
|
131
|
-
// Bundle Optimization Rules (Phase 2)
|
|
132
108
|
'no-barrel-file': no_barrel_file_1.noBarrelFile,
|
|
133
109
|
'no-barrel-import': no_barrel_import_1.noBarrelImport,
|
|
134
110
|
'prefer-tree-shakeable-imports': prefer_tree_shakeable_imports_1.preferTreeShakeableImports,
|
|
135
111
|
'prefer-direct-import': prefer_direct_import_1.preferDirectImport,
|
|
136
112
|
'no-full-package-import': no_full_package_import_1.noFullPackageImport,
|
|
137
|
-
// Enterprise Governance Rules (Phase 4)
|
|
138
113
|
'enforce-team-boundaries': enforce_team_boundaries_1.enforceTeamBoundaries,
|
|
139
114
|
'no-legacy-imports': no_legacy_imports_1.noLegacyImports,
|
|
140
115
|
'require-import-approval': require_import_approval_1.requireImportApproval,
|
|
141
116
|
'prefer-modern-api': prefer_modern_api_1.preferModernApi,
|
|
142
117
|
};
|
|
143
|
-
/**
|
|
144
|
-
* ESLint Plugin object following the official plugin structure
|
|
145
|
-
*/
|
|
146
118
|
exports.plugin = {
|
|
147
119
|
meta: {
|
|
148
120
|
name: 'eslint-plugin-import-next',
|
|
149
|
-
version: '2.3.
|
|
121
|
+
version: '2.3.11',
|
|
150
122
|
},
|
|
151
123
|
rules: exports.rules,
|
|
152
124
|
};
|
|
153
|
-
/**
|
|
154
|
-
* Preset configurations for common use cases
|
|
155
|
-
*/
|
|
156
125
|
exports.configs = {
|
|
157
|
-
/**
|
|
158
|
-
* Flagship preset — exactly the rule from this plugin that appears in the
|
|
159
|
-
* ecosystem-wide flagship list (`.agent/flagship-rules.md`). Use this when
|
|
160
|
-
* you want the highest-signal subset shippable in CI gates without the
|
|
161
|
-
* noise of `recommended`.
|
|
162
|
-
*/
|
|
163
126
|
flagship: {
|
|
164
127
|
plugins: { 'import-next': exports.plugin },
|
|
165
128
|
rules: {
|
|
166
129
|
'import-next/no-cycle': 'error',
|
|
167
130
|
},
|
|
168
131
|
},
|
|
169
|
-
/**
|
|
170
|
-
* Recommended configuration for most projects
|
|
171
|
-
*
|
|
172
|
-
* Includes essential rules with sensible defaults:
|
|
173
|
-
* - Errors on unresolved imports
|
|
174
|
-
* - Errors on circular dependencies
|
|
175
|
-
* - Warns on module system violations
|
|
176
|
-
* - Warns on import order issues
|
|
177
|
-
*/
|
|
178
132
|
recommended: {
|
|
179
133
|
plugins: {
|
|
180
134
|
'import-next': exports.plugin,
|
|
181
135
|
},
|
|
182
136
|
rules: {
|
|
183
|
-
// Module Resolution - Critical
|
|
184
137
|
'import-next/no-unresolved': 'error',
|
|
185
138
|
'import-next/named': 'error',
|
|
186
139
|
'import-next/default': 'error',
|
|
187
140
|
'import-next/namespace': 'warn',
|
|
188
141
|
'import-next/no-duplicates': 'error',
|
|
189
142
|
'import-next/export': 'error',
|
|
190
|
-
// Dependency Boundaries - Critical
|
|
191
143
|
'import-next/no-cycle': 'error',
|
|
192
144
|
'import-next/no-self-import': 'error',
|
|
193
|
-
// Helpful Warnings
|
|
194
145
|
'import-next/no-named-as-default': 'warn',
|
|
195
146
|
'import-next/no-named-as-default-member': 'warn',
|
|
196
|
-
// Module System - Recommended
|
|
197
147
|
'import-next/no-amd': 'warn',
|
|
198
|
-
// Import Style - Recommended
|
|
199
148
|
'import-next/order': 'warn',
|
|
200
149
|
'import-next/first': 'warn',
|
|
201
150
|
'import-next/newline-after-import': 'warn',
|
|
202
151
|
'import-next/no-empty-named-blocks': 'warn',
|
|
203
|
-
// Dependency Management
|
|
204
152
|
'import-next/no-extraneous-dependencies': 'warn',
|
|
205
153
|
},
|
|
206
154
|
},
|
|
207
|
-
/**
|
|
208
|
-
* Strict configuration for maximum enforcement
|
|
209
|
-
*
|
|
210
|
-
* All rules set to error for production-ready code
|
|
211
|
-
*/
|
|
212
155
|
strict: {
|
|
213
156
|
plugins: {
|
|
214
157
|
'import-next': exports.plugin,
|
|
215
158
|
},
|
|
216
159
|
rules: {
|
|
217
|
-
// Module Resolution
|
|
218
160
|
'import-next/no-unresolved': 'error',
|
|
219
161
|
'import-next/named': 'error',
|
|
220
162
|
'import-next/default': 'error',
|
|
@@ -226,13 +168,11 @@ exports.configs = {
|
|
|
226
168
|
'import-next/no-dynamic-require': 'error',
|
|
227
169
|
'import-next/no-useless-path-segments': 'error',
|
|
228
170
|
'import-next/export': 'error',
|
|
229
|
-
// Module System
|
|
230
171
|
'import-next/no-amd': 'error',
|
|
231
172
|
'import-next/no-commonjs': 'error',
|
|
232
173
|
'import-next/no-nodejs-modules': 'error',
|
|
233
174
|
'import-next/no-import-module-exports': 'error',
|
|
234
175
|
'import-next/unambiguous': 'error',
|
|
235
|
-
// Dependency Boundaries
|
|
236
176
|
'import-next/no-cycle': 'error',
|
|
237
177
|
'import-next/no-internal-modules': 'error',
|
|
238
178
|
'import-next/no-cross-domain-imports': 'error',
|
|
@@ -240,13 +180,11 @@ exports.configs = {
|
|
|
240
180
|
'import-next/no-restricted-paths': 'error',
|
|
241
181
|
'import-next/no-relative-parent-imports': 'error',
|
|
242
182
|
'import-next/no-relative-packages': 'error',
|
|
243
|
-
// Export Style
|
|
244
183
|
'import-next/no-anonymous-default-export': 'error',
|
|
245
184
|
'import-next/no-mutable-exports': 'error',
|
|
246
185
|
'import-next/no-deprecated': 'error',
|
|
247
186
|
'import-next/exports-last': 'error',
|
|
248
187
|
'import-next/group-exports': 'error',
|
|
249
|
-
// Import Style
|
|
250
188
|
'import-next/order': 'error',
|
|
251
189
|
'import-next/no-unassigned-import': 'error',
|
|
252
190
|
'import-next/first': 'error',
|
|
@@ -257,25 +195,19 @@ exports.configs = {
|
|
|
257
195
|
'import-next/no-named-default': 'error',
|
|
258
196
|
'import-next/no-namespace': 'error',
|
|
259
197
|
'import-next/consistent-type-specifier-style': 'error',
|
|
260
|
-
// Dependency Management
|
|
261
198
|
'import-next/no-extraneous-dependencies': 'error',
|
|
262
199
|
'import-next/no-unused-modules': 'error',
|
|
263
200
|
'import-next/max-dependencies': 'error',
|
|
264
201
|
'import-next/prefer-node-protocol': 'error',
|
|
265
202
|
},
|
|
266
203
|
},
|
|
267
|
-
/**
|
|
268
|
-
* TypeScript configuration
|
|
269
|
-
*
|
|
270
|
-
* Optimized for TypeScript projects
|
|
271
|
-
*/
|
|
272
204
|
typescript: {
|
|
273
205
|
plugins: {
|
|
274
206
|
'import-next': exports.plugin,
|
|
275
207
|
},
|
|
276
208
|
rules: {
|
|
277
209
|
'import-next/no-unresolved': 'error',
|
|
278
|
-
'import-next/named': 'off',
|
|
210
|
+
'import-next/named': 'off',
|
|
279
211
|
'import-next/default': 'error',
|
|
280
212
|
'import-next/namespace': 'error',
|
|
281
213
|
'import-next/export': 'error',
|
|
@@ -287,11 +219,6 @@ exports.configs = {
|
|
|
287
219
|
'import-next/consistent-type-specifier-style': ['warn', 'prefer-inline'],
|
|
288
220
|
},
|
|
289
221
|
},
|
|
290
|
-
/**
|
|
291
|
-
* Module resolution focused configuration
|
|
292
|
-
*
|
|
293
|
-
* Ensures all imports resolve correctly
|
|
294
|
-
*/
|
|
295
222
|
'module-resolution': {
|
|
296
223
|
plugins: {
|
|
297
224
|
'import-next': exports.plugin,
|
|
@@ -308,11 +235,6 @@ exports.configs = {
|
|
|
308
235
|
'import-next/no-useless-path-segments': 'warn',
|
|
309
236
|
},
|
|
310
237
|
},
|
|
311
|
-
/**
|
|
312
|
-
* Import style focused configuration
|
|
313
|
-
*
|
|
314
|
-
* Enforces consistent import formatting
|
|
315
|
-
*/
|
|
316
238
|
'import-style': {
|
|
317
239
|
plugins: {
|
|
318
240
|
'import-next': exports.plugin,
|
|
@@ -327,11 +249,6 @@ exports.configs = {
|
|
|
327
249
|
'import-next/no-namespace': 'warn',
|
|
328
250
|
},
|
|
329
251
|
},
|
|
330
|
-
/**
|
|
331
|
-
* ESM-only configuration
|
|
332
|
-
*
|
|
333
|
-
* Enforces ES Modules and prohibits CommonJS/AMD
|
|
334
|
-
*/
|
|
335
252
|
esm: {
|
|
336
253
|
plugins: {
|
|
337
254
|
'import-next': exports.plugin,
|
|
@@ -344,11 +261,6 @@ exports.configs = {
|
|
|
344
261
|
'import-next/prefer-node-protocol': 'error',
|
|
345
262
|
},
|
|
346
263
|
},
|
|
347
|
-
/**
|
|
348
|
-
* Architecture boundaries configuration
|
|
349
|
-
*
|
|
350
|
-
* Enforces clean architecture and module boundaries
|
|
351
|
-
*/
|
|
352
264
|
architecture: {
|
|
353
265
|
plugins: {
|
|
354
266
|
'import-next': exports.plugin,
|
|
@@ -363,9 +275,6 @@ exports.configs = {
|
|
|
363
275
|
'import-next/no-relative-packages': 'error',
|
|
364
276
|
},
|
|
365
277
|
},
|
|
366
|
-
/**
|
|
367
|
-
* Errors-only configuration (matches eslint-plugin-import)
|
|
368
|
-
*/
|
|
369
278
|
errors: {
|
|
370
279
|
plugins: {
|
|
371
280
|
'import-next': exports.plugin,
|
|
@@ -378,9 +287,6 @@ exports.configs = {
|
|
|
378
287
|
'import-next/export': 'error',
|
|
379
288
|
},
|
|
380
289
|
},
|
|
381
|
-
/**
|
|
382
|
-
* Warnings-only configuration (matches eslint-plugin-import)
|
|
383
|
-
*/
|
|
384
290
|
warnings: {
|
|
385
291
|
plugins: {
|
|
386
292
|
'import-next': exports.plugin,
|
|
@@ -391,78 +297,30 @@ exports.configs = {
|
|
|
391
297
|
'import-next/no-duplicates': 'warn',
|
|
392
298
|
},
|
|
393
299
|
},
|
|
394
|
-
/**
|
|
395
|
-
* Performance optimization configuration (Phase 2)
|
|
396
|
-
*
|
|
397
|
-
* Detects import patterns that harm build performance and tree-shaking:
|
|
398
|
-
* - Barrel files that bloat bundles
|
|
399
|
-
* - Imports from barrel files
|
|
400
|
-
* - Non-tree-shakeable import patterns (namespace imports)
|
|
401
|
-
*
|
|
402
|
-
* Real-world impact:
|
|
403
|
-
* - Atlassian reduced Jira build times by 75%
|
|
404
|
-
* - Bundle size reductions of 50-85%
|
|
405
|
-
*
|
|
406
|
-
* @see https://marvinh.dev/blog/speeding-up-javascript-ecosystem-part-7/
|
|
407
|
-
*/
|
|
408
300
|
performance: {
|
|
409
301
|
plugins: {
|
|
410
302
|
'import-next': exports.plugin,
|
|
411
303
|
},
|
|
412
304
|
rules: {
|
|
413
|
-
// Bundle Optimization - Critical
|
|
414
305
|
'import-next/no-barrel-file': 'error',
|
|
415
306
|
'import-next/no-barrel-import': 'warn',
|
|
416
307
|
'import-next/prefer-tree-shakeable-imports': 'warn',
|
|
417
308
|
'import-next/prefer-direct-import': 'warn',
|
|
418
309
|
'import-next/no-full-package-import': 'warn',
|
|
419
|
-
// Dependency Boundaries - Impact on build graph
|
|
420
310
|
'import-next/no-cycle': 'error',
|
|
421
311
|
},
|
|
422
312
|
},
|
|
423
|
-
/**
|
|
424
|
-
* Enterprise governance configuration (Phase 4)
|
|
425
|
-
*
|
|
426
|
-
* Rules designed for large organizations (1000+ developers):
|
|
427
|
-
* - Team boundaries to prevent unauthorized cross-team imports
|
|
428
|
-
* - Legacy import detection for migration tracking
|
|
429
|
-
*
|
|
430
|
-
* Note: These rules require configuration. See documentation for examples.
|
|
431
|
-
*
|
|
432
|
-
* @example
|
|
433
|
-
* // eslint.config.js
|
|
434
|
-
* {
|
|
435
|
-
* plugins: { 'import-next': importNext },
|
|
436
|
-
* rules: {
|
|
437
|
-
* 'import-next/enforce-team-boundaries': ['error', {
|
|
438
|
-
* teams: [
|
|
439
|
-
* { team: 'platform', paths: ['src/platform/**'], allowedDependencies: ['shared'] },
|
|
440
|
-
* { team: 'payments', paths: ['src/payments/**'], allowedDependencies: ['platform', 'shared'] },
|
|
441
|
-
* ],
|
|
442
|
-
* }],
|
|
443
|
-
* 'import-next/no-legacy-imports': ['warn', {
|
|
444
|
-
* mappings: [
|
|
445
|
-
* { deprecated: 'moment', replacement: 'date-fns', reason: 'moment is in maintenance mode' },
|
|
446
|
-
* ],
|
|
447
|
-
* }],
|
|
448
|
-
* },
|
|
449
|
-
* }
|
|
450
|
-
*/
|
|
451
313
|
enterprise: {
|
|
452
314
|
plugins: {
|
|
453
315
|
'import-next': exports.plugin,
|
|
454
316
|
},
|
|
455
317
|
rules: {
|
|
456
|
-
|
|
457
|
-
'import-next/
|
|
458
|
-
// Legacy import tracking - requires configuration
|
|
459
|
-
'import-next/no-legacy-imports': 'off', // Disabled by default - requires mappings config
|
|
460
|
-
// Architecture boundaries
|
|
318
|
+
'import-next/enforce-team-boundaries': 'off',
|
|
319
|
+
'import-next/no-legacy-imports': 'off',
|
|
461
320
|
'import-next/no-cross-domain-imports': 'warn',
|
|
462
321
|
'import-next/enforce-dependency-direction': 'warn',
|
|
463
322
|
'import-next/no-internal-modules': 'warn',
|
|
464
323
|
},
|
|
465
324
|
},
|
|
466
325
|
};
|
|
467
|
-
// Default export for ESLint flat config
|
|
468
326
|
exports.default = exports.plugin;
|
package/src/oxlint.d.ts
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
*/
|
|
19
|
-
import { plugin } from './index';
|
|
20
|
-
export = plugin;
|
|
1
|
+
// Minimal declaration written by scripts/build-package.ts.
|
|
2
|
+
//
|
|
3
|
+
// tsc's generated entry declaration inlined every inferred rule-option type
|
|
4
|
+
// (up to 166 kB per plugin) for an API no consumer calls directly. This types
|
|
5
|
+
// what a flat config actually touches. Per-rule option types remain available
|
|
6
|
+
// from the "./types" subpath export where a plugin provides one.
|
|
7
|
+
import type { Linter, Rule } from 'eslint';
|
|
8
|
+
|
|
9
|
+
export declare const rules: Record<string, Rule.RuleModule>;
|
|
10
|
+
export declare const configs: Record<string, Linter.Config>;
|
|
11
|
+
export declare const plugin: {
|
|
12
|
+
meta: { name: string; version: string };
|
|
13
|
+
rules: Record<string, Rule.RuleModule>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
declare const _default: typeof plugin;
|
|
17
|
+
export default _default;
|
package/src/oxlint.js
CHANGED
|
@@ -1,21 +1,3 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* oxlint sub-export.
|
|
9
|
-
*
|
|
10
|
-
* Consumers wire oxlint to this entry via:
|
|
11
|
-
* { "jsPlugins": ["eslint-plugin-import-next/oxlint"] }
|
|
12
|
-
*
|
|
13
|
-
* oxlint's JS plugin loader does `require('eslint-plugin-import-next/oxlint')` and reads
|
|
14
|
-
* `.rules` off the result. The compiled output of `export = plugin` is
|
|
15
|
-
* `module.exports = plugin`, which gives oxlint the plugin object directly
|
|
16
|
-
* (`{ meta, rules }`) — no wrapper, no `.default` indirection.
|
|
17
|
-
*
|
|
18
|
-
* Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
|
|
19
|
-
*/
|
|
20
2
|
const index_1 = require("./index");
|
|
21
3
|
module.exports = index_1.plugin;
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.consistentTypeSpecifierStyle = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -50,10 +45,6 @@ exports.consistentTypeSpecifierStyle = (0, eslint_devkit_1.createRule)({
|
|
|
50
45
|
create(context) {
|
|
51
46
|
const style = context.options[0] || 'prefer-inline';
|
|
52
47
|
const sourceCode = context.sourceCode;
|
|
53
|
-
/**
|
|
54
|
-
* Get the text for a specifier, handling aliasing
|
|
55
|
-
*/
|
|
56
|
-
// oxlint-disable-next-line consistent-function-scoping
|
|
57
48
|
function getSpecifierText(spec) {
|
|
58
49
|
const imported = spec.imported.type === 'Identifier'
|
|
59
50
|
? spec.imported.name
|
|
@@ -68,7 +59,6 @@ exports.consistentTypeSpecifierStyle = (0, eslint_devkit_1.createRule)({
|
|
|
68
59
|
ImportDeclaration(node) {
|
|
69
60
|
const isTypeImport = node.importKind === 'type';
|
|
70
61
|
if (style === 'prefer-inline') {
|
|
71
|
-
// If using top-level type import with named specifiers, suggest inline
|
|
72
62
|
if (isTypeImport && node.specifiers.length > 0) {
|
|
73
63
|
const namedSpecifiers = node.specifiers.filter((s) => s.type === 'ImportSpecifier');
|
|
74
64
|
if (namedSpecifiers.length > 0) {
|
|
@@ -79,9 +69,6 @@ exports.consistentTypeSpecifierStyle = (0, eslint_devkit_1.createRule)({
|
|
|
79
69
|
name: namedSpecifiers.map((s) => s.local.name).join(', '),
|
|
80
70
|
},
|
|
81
71
|
fix(fixer) {
|
|
82
|
-
// Build the new import statement using AST
|
|
83
|
-
// Convert: import type { Foo, Bar } from 'x'
|
|
84
|
-
// To: import { type Foo, type Bar } from 'x'
|
|
85
72
|
const specifiersText = namedSpecifiers
|
|
86
73
|
.map((spec) => `type ${getSpecifierText(spec)}`)
|
|
87
74
|
.join(', ');
|
|
@@ -94,11 +81,8 @@ exports.consistentTypeSpecifierStyle = (0, eslint_devkit_1.createRule)({
|
|
|
94
81
|
}
|
|
95
82
|
}
|
|
96
83
|
else {
|
|
97
|
-
// prefer-top-level
|
|
98
|
-
// Check for inline type specifiers
|
|
99
84
|
const namedSpecifiers = node.specifiers.filter((s) => s.type === 'ImportSpecifier');
|
|
100
85
|
const inlineTypeSpecifiers = namedSpecifiers.filter((s) => s.importKind === 'type');
|
|
101
|
-
// If all named imports are type imports, suggest top-level
|
|
102
86
|
if (!isTypeImport &&
|
|
103
87
|
namedSpecifiers.length > 0 &&
|
|
104
88
|
inlineTypeSpecifiers.length === namedSpecifiers.length) {
|
|
@@ -109,9 +93,6 @@ exports.consistentTypeSpecifierStyle = (0, eslint_devkit_1.createRule)({
|
|
|
109
93
|
name: namedSpecifiers.map((s) => s.local.name).join(', '),
|
|
110
94
|
},
|
|
111
95
|
fix(fixer) {
|
|
112
|
-
// Build the new import statement using AST
|
|
113
|
-
// Convert: import { type Foo, type Bar } from 'x'
|
|
114
|
-
// To: import type { Foo, Bar } from 'x'
|
|
115
96
|
const specifiersText = namedSpecifiers
|
|
116
97
|
.map((spec) => getSpecifierText(spec))
|
|
117
98
|
.join(', ');
|
package/src/rules/default.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.defaultRule = void 0;
|
|
9
4
|
const tslib_1 = require("tslib");
|
|
@@ -46,8 +41,6 @@ exports.defaultRule = (0, eslint_devkit_1.createRule)({
|
|
|
46
41
|
const moduleNode = services.esTreeNodeToTSNodeMap.get(node.parent.source);
|
|
47
42
|
const moduleSymbol = checker?.getSymbolAtLocation?.(moduleNode);
|
|
48
43
|
if (moduleSymbol && !symbol) {
|
|
49
|
-
// If module symbol exists but we can't resolve the default import symbol,
|
|
50
|
-
// check if exports contain "default"
|
|
51
44
|
if (moduleSymbol.exports &&
|
|
52
45
|
!moduleSymbol.exports.has(typescript_1.default.InternalSymbolName.Default)) {
|
|
53
46
|
context.report({
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Copyright (c) 2025 Ofri Peretz
|
|
4
|
-
* Licensed under the MIT License. Use of this source code is governed by the
|
|
5
|
-
* MIT license that can be found in the LICENSE file.
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
3
|
exports.dynamicImportChunkname = void 0;
|
|
9
4
|
const eslint_devkit_1 = require("@interlace/eslint-devkit");
|
|
@@ -67,9 +62,7 @@ exports.dynamicImportChunkname = (0, eslint_devkit_1.createRule)({
|
|
|
67
62
|
const chunkNamePattern = new RegExp(`^${webpackChunknameFormat}$`);
|
|
68
63
|
const sourceCode = context.sourceCode;
|
|
69
64
|
function checkChunkName(node) {
|
|
70
|
-
// Get leading comments
|
|
71
65
|
const comments = sourceCode.getCommentsBefore(node.source);
|
|
72
|
-
// Look for webpackChunkName in comments
|
|
73
66
|
let foundChunkName = null;
|
|
74
67
|
let hasWebpackComment = false;
|
|
75
68
|
for (const comment of comments) {
|
|
@@ -90,7 +83,6 @@ exports.dynamicImportChunkname = (0, eslint_devkit_1.createRule)({
|
|
|
90
83
|
{
|
|
91
84
|
messageId: 'suggestChunkName',
|
|
92
85
|
fix(fixer) {
|
|
93
|
-
// Generate a chunk name from the import path
|
|
94
86
|
const source = node.source;
|
|
95
87
|
if (source.type === 'Literal' && typeof source.value === 'string') {
|
|
96
88
|
const chunkName = source.value
|