eslint-plugin-import-next 2.3.5 → 2.3.7

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.
Files changed (63) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +99 -78
  3. package/package.json +21 -5
  4. package/src/index.d.ts +192 -0
  5. package/src/index.js +13 -1
  6. package/src/oxlint.d.ts +20 -0
  7. package/src/oxlint.js +21 -0
  8. package/src/rules/consistent-type-specifier-style.js +5 -1
  9. package/src/rules/default.js +1 -0
  10. package/src/rules/dynamic-import-chunkname.js +4 -1
  11. package/src/rules/enforce-dependency-direction.js +2 -1
  12. package/src/rules/enforce-import-order.js +4 -2
  13. package/src/rules/enforce-team-boundaries.js +27 -17
  14. package/src/rules/export.js +3 -0
  15. package/src/rules/exports-last.js +3 -0
  16. package/src/rules/extensions.js +1 -0
  17. package/src/rules/first.js +2 -1
  18. package/src/rules/group-exports.js +3 -0
  19. package/src/rules/max-dependencies.js +2 -1
  20. package/src/rules/named.js +1 -1
  21. package/src/rules/namespace.js +1 -0
  22. package/src/rules/newline-after-import.js +1 -0
  23. package/src/rules/no-absolute-path.js +3 -0
  24. package/src/rules/no-amd.js +2 -1
  25. package/src/rules/no-anonymous-default-export.js +2 -0
  26. package/src/rules/no-barrel-file.js +2 -1
  27. package/src/rules/no-barrel-import.js +1 -1
  28. package/src/rules/no-commonjs.js +2 -1
  29. package/src/rules/no-cross-domain-imports.js +2 -1
  30. package/src/rules/no-cycle.d.ts +1 -1
  31. package/src/rules/no-cycle.js +187 -71
  32. package/src/rules/no-default-export.js +2 -1
  33. package/src/rules/no-deprecated.js +2 -1
  34. package/src/rules/no-duplicates.js +1 -0
  35. package/src/rules/no-dynamic-require.js +3 -0
  36. package/src/rules/no-empty-named-blocks.js +4 -1
  37. package/src/rules/no-extraneous-dependencies.js +4 -1
  38. package/src/rules/no-full-package-import.js +1 -0
  39. package/src/rules/no-import-module-exports.js +3 -1
  40. package/src/rules/no-internal-modules.js +1 -0
  41. package/src/rules/no-legacy-imports.js +1 -0
  42. package/src/rules/no-mutable-exports.js +2 -1
  43. package/src/rules/no-named-as-default-member.js +3 -0
  44. package/src/rules/no-named-as-default.js +3 -0
  45. package/src/rules/no-named-default.js +3 -0
  46. package/src/rules/no-named-export.js +2 -1
  47. package/src/rules/no-namespace.js +12 -6
  48. package/src/rules/no-nodejs-modules.js +3 -1
  49. package/src/rules/no-relative-packages.js +4 -1
  50. package/src/rules/no-relative-parent-imports.js +1 -0
  51. package/src/rules/no-restricted-paths.js +1 -0
  52. package/src/rules/no-self-import.js +2 -1
  53. package/src/rules/no-unassigned-import.js +1 -0
  54. package/src/rules/no-unresolved.js +3 -2
  55. package/src/rules/no-unused-modules.js +1 -0
  56. package/src/rules/no-useless-path-segments.js +3 -0
  57. package/src/rules/prefer-default-export.js +2 -1
  58. package/src/rules/prefer-direct-import.js +1 -0
  59. package/src/rules/prefer-modern-api.js +1 -0
  60. package/src/rules/prefer-node-protocol.js +2 -0
  61. package/src/rules/prefer-tree-shakeable-imports.js +1 -0
  62. package/src/rules/require-import-approval.js +1 -0
  63. package/src/rules/unambiguous.js +3 -0
package/src/index.js CHANGED
@@ -146,7 +146,7 @@ exports.rules = {
146
146
  exports.plugin = {
147
147
  meta: {
148
148
  name: 'eslint-plugin-import-next',
149
- version: '2.0.0',
149
+ version: '2.3.7',
150
150
  },
151
151
  rules: exports.rules,
152
152
  };
@@ -154,6 +154,18 @@ exports.plugin = {
154
154
  * Preset configurations for common use cases
155
155
  */
156
156
  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
+ flagship: {
164
+ plugins: { 'import-next': exports.plugin },
165
+ rules: {
166
+ 'import-next/no-cycle': 'error',
167
+ },
168
+ },
157
169
  /**
158
170
  * Recommended configuration for most projects
159
171
  *
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2025 Ofri Peretz
3
+ * Licensed under the MIT License. Use of this source code is governed by the
4
+ * MIT license that can be found in the LICENSE file.
5
+ */
6
+ /**
7
+ * oxlint sub-export.
8
+ *
9
+ * Consumers wire oxlint to this entry via:
10
+ * { "jsPlugins": ["eslint-plugin-import-next/oxlint"] }
11
+ *
12
+ * oxlint's JS plugin loader does `require('eslint-plugin-import-next/oxlint')` and reads
13
+ * `.rules` off the result. The compiled output of `export = plugin` is
14
+ * `module.exports = plugin`, which gives oxlint the plugin object directly
15
+ * (`{ meta, rules }`) — no wrapper, no `.default` indirection.
16
+ *
17
+ * Generated by scripts/generate-oxlint-shims.mjs. Do not edit by hand.
18
+ */
19
+ import { plugin } from './index';
20
+ export = plugin;
package/src/oxlint.js ADDED
@@ -0,0 +1,21 @@
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
+ const index_1 = require("./index");
21
+ module.exports = index_1.plugin;
@@ -12,7 +12,10 @@ exports.consistentTypeSpecifierStyle = (0, eslint_devkit_1.createRule)({
12
12
  meta: {
13
13
  type: 'suggestion',
14
14
  docs: {
15
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/consistent-type-specifier-style.md',
15
16
  description: 'Enforce or ban the use of inline type-only markers for named imports',
17
+ cwe: 'CWE-1078',
18
+ cvss: 2.5,
16
19
  },
17
20
  fixable: 'code',
18
21
  messages: {
@@ -46,10 +49,11 @@ exports.consistentTypeSpecifierStyle = (0, eslint_devkit_1.createRule)({
46
49
  defaultOptions: ['prefer-inline'],
47
50
  create(context) {
48
51
  const style = context.options[0] || 'prefer-inline';
49
- const sourceCode = context.getSourceCode();
52
+ const sourceCode = context.sourceCode;
50
53
  /**
51
54
  * Get the text for a specifier, handling aliasing
52
55
  */
56
+ // oxlint-disable-next-line consistent-function-scoping
53
57
  function getSpecifierText(spec) {
54
58
  const imported = spec.imported.type === 'Identifier'
55
59
  ? spec.imported.name
@@ -15,6 +15,7 @@ exports.defaultRule = (0, eslint_devkit_1.createRule)({
15
15
  meta: {
16
16
  type: 'problem',
17
17
  docs: {
18
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/default.md',
18
19
  description: 'Ensure a default export is present, given a default import',
19
20
  },
20
21
  messages: {
@@ -12,7 +12,10 @@ exports.dynamicImportChunkname = (0, eslint_devkit_1.createRule)({
12
12
  meta: {
13
13
  type: 'suggestion',
14
14
  docs: {
15
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/dynamic-import-chunkname.md',
15
16
  description: 'Enforce a leading comment with the webpackChunkName for dynamic imports',
17
+ cwe: 'CWE-1078',
18
+ cvss: 2.5,
16
19
  },
17
20
  hasSuggestions: true,
18
21
  messages: {
@@ -62,7 +65,7 @@ exports.dynamicImportChunkname = (0, eslint_devkit_1.createRule)({
62
65
  const options = context.options[0] || {};
63
66
  const { allowEmpty = false, webpackChunknameFormat = '[a-zA-Z0-9-_/.]+' } = options;
64
67
  const chunkNamePattern = new RegExp(`^${webpackChunknameFormat}$`);
65
- const sourceCode = context.getSourceCode();
68
+ const sourceCode = context.sourceCode;
66
69
  function checkChunkName(node) {
67
70
  // Get leading comments
68
71
  const comments = sourceCode.getCommentsBefore(node.source);
@@ -48,6 +48,7 @@ exports.enforceDependencyDirection = (0, eslint_devkit_2.createRule)({
48
48
  meta: {
49
49
  type: 'problem',
50
50
  docs: {
51
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/enforce-dependency-direction.md',
51
52
  description: 'Ensures dependencies flow in the correct architectural direction',
52
53
  },
53
54
  messages: {
@@ -129,7 +130,7 @@ exports.enforceDependencyDirection = (0, eslint_devkit_2.createRule)({
129
130
  },
130
131
  ],
131
132
  create(context, [options = {}]) {
132
- const filename = context.getFilename();
133
+ const filename = context.filename;
133
134
  const { layers: providedLayers, layerPatterns: providedLayerPatterns, allowSameLayer = true, } = options || {};
134
135
  // Use provided layers or defaults
135
136
  const layers = providedLayers || [
@@ -30,6 +30,7 @@ exports.enforceImportOrder = (0, eslint_devkit_1.createRule)({
30
30
  meta: {
31
31
  type: 'suggestion',
32
32
  docs: {
33
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/enforce-import-order.md',
33
34
  description: 'Enforces a specific order for import statements',
34
35
  },
35
36
  fixable: 'code',
@@ -121,7 +122,7 @@ exports.enforceImportOrder = (0, eslint_devkit_1.createRule)({
121
122
  defaultOptions.alphabetize.caseInsensitive,
122
123
  },
123
124
  };
124
- const sourceCode = context.getSourceCode();
125
+ const sourceCode = context.sourceCode;
125
126
  const imports = [];
126
127
  function getImportType(node) {
127
128
  const source = node.source.value;
@@ -237,7 +238,8 @@ exports.enforceImportOrder = (0, eslint_devkit_1.createRule)({
237
238
  }
238
239
  }
239
240
  const originalImports = [...imports];
240
- const sortedImports = [...imports].sort((a, b) => {
241
+ // oxlint-disable-next-line unicorn/no-array-sort
242
+ const sortedImports = Array.from(imports).sort((a, b) => {
241
243
  const typeA = getImportType(a);
242
244
  const typeB = getImportType(b);
243
245
  const rankA = getGroupRank(typeA);
@@ -7,18 +7,35 @@
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.enforceTeamBoundaries = void 0;
9
9
  const eslint_devkit_1 = require("@interlace/eslint-devkit");
10
+ /**
11
+ * Translate a user-supplied glob (`foo/**\/*.ts`) into a RegExp.
12
+ *
13
+ * Important: regex metacharacters in the input must be escaped BEFORE the
14
+ * glob tokens are translated. Without escaping, a pattern like `lib\foo` is
15
+ * interpreted as `\f` (form feed) and `lib.foo` matches `libXfoo` rather
16
+ * than the literal dot the user wrote. CodeQL flags the un-escaped backslash
17
+ * specifically (`js/incomplete-sanitization`).
18
+ *
19
+ * Algorithm: escape all regex metas (including `\`), then unescape and
20
+ * translate just the glob tokens `**` and `*` back to their regex form.
21
+ */
22
+ function globToRegex(pattern) {
23
+ // Escape regex metacharacters INCLUDING `*`, so the subsequent replaces
24
+ // can find the now-escaped `\*\*` / `\*` and translate them back to their
25
+ // glob meanings. Without escaping `*`, the `**` in `src/platform/**`
26
+ // reaches `new RegExp()` raw and throws "Nothing to repeat".
27
+ const escaped = pattern.replace(/[.+?^${}()|[\]\\*]/g, '\\$&');
28
+ return new RegExp(escaped
29
+ .replace(/\\\*\\\*/g, '.*')
30
+ .replace(/\\\*/g, '[^/]*'));
31
+ }
10
32
  /**
11
33
  * Determine which team owns this file based on path patterns
12
34
  */
13
35
  function getFileTeam(filePath, teams) {
14
36
  for (const team of teams) {
15
37
  for (const pattern of team.paths) {
16
- // Support glob patterns (simplified)
17
- const regex = new RegExp(pattern
18
- .replace(/\*\*/g, '.*')
19
- .replace(/\*/g, '[^/]*')
20
- .replace(/\//g, '\\/'));
21
- if (regex.test(filePath)) {
38
+ if (globToRegex(pattern).test(filePath)) {
22
39
  return team;
23
40
  }
24
41
  }
@@ -31,11 +48,7 @@ function getFileTeam(filePath, teams) {
31
48
  function getImportTeam(importPath, teams) {
32
49
  for (const team of teams) {
33
50
  for (const pattern of team.paths) {
34
- const regex = new RegExp(pattern
35
- .replace(/\*\*/g, '.*')
36
- .replace(/\*/g, '[^/]*')
37
- .replace(/\//g, '\\/'));
38
- if (regex.test(importPath)) {
51
+ if (globToRegex(pattern).test(importPath)) {
39
52
  return team;
40
53
  }
41
54
  }
@@ -77,11 +90,7 @@ function isExternalImport(importPath) {
77
90
  */
78
91
  function isSharedPath(importPath, sharedPaths) {
79
92
  for (const shared of sharedPaths) {
80
- const regex = new RegExp(shared
81
- .replace(/\*\*/g, '.*')
82
- .replace(/\*/g, '[^/]*')
83
- .replace(/\//g, '\\/'));
84
- if (regex.test(importPath)) {
93
+ if (globToRegex(shared).test(importPath)) {
85
94
  return true;
86
95
  }
87
96
  }
@@ -92,6 +101,7 @@ exports.enforceTeamBoundaries = (0, eslint_devkit_1.createRule)({
92
101
  meta: {
93
102
  type: 'problem',
94
103
  docs: {
104
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/enforce-team-boundaries.md',
95
105
  description: 'Prevent unauthorized cross-team imports in large codebases',
96
106
  },
97
107
  messages: {
@@ -154,7 +164,7 @@ exports.enforceTeamBoundaries = (0, eslint_devkit_1.createRule)({
154
164
  create(context, [options]) {
155
165
  const { teams, sharedPaths = [], allowExternalPackages = true } = options;
156
166
  // Get the file's team ownership
157
- const filename = context.filename || context.getFilename();
167
+ const filename = context.filename;
158
168
  const sourceTeam = getFileTeam(filename, teams);
159
169
  // If file doesn't belong to any team, skip checking
160
170
  if (!sourceTeam) {
@@ -12,7 +12,10 @@ exports.exportRule = (0, eslint_devkit_1.createRule)({
12
12
  meta: {
13
13
  type: 'problem',
14
14
  docs: {
15
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/export.md',
15
16
  description: 'Forbid any invalid exports, i.e. re-export of the same name',
17
+ cwe: 'CWE-694',
18
+ cvss: 7.5,
16
19
  },
17
20
  messages: {
18
21
  duplicateExport: (0, eslint_devkit_1.formatLLMMessage)({
@@ -12,7 +12,10 @@ exports.exportsLast = (0, eslint_devkit_1.createRule)({
12
12
  meta: {
13
13
  type: 'suggestion',
14
14
  docs: {
15
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/exports-last.md',
15
16
  description: 'Ensure all exports appear after other statements',
17
+ cwe: 'CWE-1078',
18
+ cvss: 2.5,
16
19
  },
17
20
  messages: {
18
21
  exportNotLast: (0, eslint_devkit_1.formatLLMMessage)({
@@ -15,6 +15,7 @@ exports.extensions = (0, eslint_devkit_1.createRule)({
15
15
  meta: {
16
16
  type: 'suggestion',
17
17
  docs: {
18
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/extensions.md',
18
19
  description: 'Ensure consistent use of file extensions in imports',
19
20
  },
20
21
  fixable: 'code',
@@ -13,9 +13,9 @@ exports.first = (0, eslint_devkit_1.createRule)({
13
13
  meta: {
14
14
  type: 'suggestion',
15
15
  docs: {
16
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/first.md',
16
17
  description: 'Ensure all imports appear before other statements',
17
18
  },
18
- fixable: 'code',
19
19
  messages: {
20
20
  first: (0, eslint_devkit_2.formatLLMMessage)({
21
21
  icon: eslint_devkit_2.MessageIcons.ARCHITECTURE,
@@ -48,6 +48,7 @@ exports.first = (0, eslint_devkit_1.createRule)({
48
48
  }
49
49
  },
50
50
  };
51
+ // oxlint-disable-next-line consistent-function-scoping
51
52
  function isDirective(node) {
52
53
  return (node.type === 'ExpressionStatement' &&
53
54
  node.expression.type === 'Literal' &&
@@ -12,7 +12,10 @@ exports.groupExports = (0, eslint_devkit_1.createRule)({
12
12
  meta: {
13
13
  type: 'suggestion',
14
14
  docs: {
15
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/group-exports.md',
15
16
  description: 'Prefer named exports to be grouped together in a single export declaration',
17
+ cwe: 'CWE-1078',
18
+ cvss: 2.5,
16
19
  },
17
20
  messages: {
18
21
  groupExports: (0, eslint_devkit_1.formatLLMMessage)({
@@ -13,6 +13,7 @@ exports.maxDependencies = (0, eslint_devkit_1.createRule)({
13
13
  meta: {
14
14
  type: 'suggestion',
15
15
  docs: {
16
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/max-dependencies.md',
16
17
  description: 'Enforce the maximum number of dependencies a module can have',
17
18
  },
18
19
  hasSuggestions: false,
@@ -87,7 +88,7 @@ exports.maxDependencies = (0, eslint_devkit_1.createRule)({
87
88
  create(context) {
88
89
  const [options] = context.options;
89
90
  const { max = 10, ignoreTypeImports = true, ignoreImports = [], ignoreFiles = [], } = options || {};
90
- const filename = context.getFilename();
91
+ const filename = context.filename;
91
92
  if (!filename) {
92
93
  return {};
93
94
  }
@@ -15,9 +15,9 @@ exports.named = (0, eslint_devkit_1.createRule)({
15
15
  meta: {
16
16
  type: 'problem',
17
17
  docs: {
18
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/named.md',
18
19
  description: 'Ensure named imports correspond to a named export in the remote file',
19
20
  },
20
- fixable: 'code',
21
21
  messages: {
22
22
  named: (0, eslint_devkit_2.formatLLMMessage)({
23
23
  icon: eslint_devkit_2.MessageIcons.SECURITY, // Using SECURITY as incorrect imports can be dangerous or break build
@@ -15,6 +15,7 @@ exports.namespace = (0, eslint_devkit_1.createRule)({
15
15
  meta: {
16
16
  type: 'problem',
17
17
  docs: {
18
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/namespace.md',
18
19
  description: 'Ensure imported namespaces contain dereferenced properties as they are dereferenced',
19
20
  },
20
21
  messages: {
@@ -13,6 +13,7 @@ exports.newlineAfterImport = (0, eslint_devkit_1.createRule)({
13
13
  meta: {
14
14
  type: 'layout',
15
15
  docs: {
16
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/newline-after-import.md',
16
17
  description: 'Enforce a newline after import statements',
17
18
  },
18
19
  fixable: 'whitespace',
@@ -14,7 +14,10 @@ exports.noAbsolutePath = (0, eslint_devkit_1.createRule)({
14
14
  meta: {
15
15
  type: 'suggestion',
16
16
  docs: {
17
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/no-absolute-path.md',
17
18
  description: 'Forbid import of modules using absolute paths',
19
+ cwe: 'CWE-426',
20
+ cvss: 5,
18
21
  },
19
22
  fixable: 'code',
20
23
  messages: {
@@ -13,6 +13,7 @@ exports.noAmd = (0, eslint_devkit_1.createRule)({
13
13
  meta: {
14
14
  type: 'problem',
15
15
  docs: {
16
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/no-amd.md',
16
17
  description: 'Prevents AMD require/define calls',
17
18
  },
18
19
  hasSuggestions: false,
@@ -58,7 +59,7 @@ exports.noAmd = (0, eslint_devkit_1.createRule)({
58
59
  const { allow = [],
59
60
  // suggestES6 = true // Reserved for future use when hasSuggestions is enabled
60
61
  } = options || {};
61
- const filename = context.getFilename();
62
+ const filename = context.filename;
62
63
  function shouldAllow() {
63
64
  // Check if the call is in an allowed pattern
64
65
  return allow.some((pattern) => {
@@ -13,6 +13,7 @@ exports.noAnonymousDefaultExport = (0, eslint_devkit_1.createRule)({
13
13
  meta: {
14
14
  type: 'suggestion',
15
15
  docs: {
16
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/no-anonymous-default-export.md',
16
17
  description: 'Forbid anonymous values as default exports',
17
18
  },
18
19
  messages: {
@@ -114,6 +115,7 @@ exports.noAnonymousDefaultExport = (0, eslint_devkit_1.createRule)({
114
115
  return true;
115
116
  }
116
117
  }
118
+ // oxlint-disable-next-line consistent-function-scoping
117
119
  function getSuggestionText(node) {
118
120
  const declaration = node.declaration;
119
121
  switch (declaration.type) {
@@ -74,6 +74,7 @@ exports.noBarrelFile = (0, eslint_devkit_1.createRule)({
74
74
  meta: {
75
75
  type: 'problem',
76
76
  docs: {
77
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/no-barrel-file.md',
77
78
  description: 'Disallow barrel files that harm build performance and tree-shaking efficiency',
78
79
  },
79
80
  hasSuggestions: true,
@@ -148,7 +149,7 @@ exports.noBarrelFile = (0, eslint_devkit_1.createRule)({
148
149
  ],
149
150
  create(context, [options = {}]) {
150
151
  const { threshold = 3, allowedPaths = [], barrelPatterns = DEFAULT_BARREL_PATTERNS, allowWithLocalExports = false, reexportRatio = 0.8, } = options || {};
151
- const filename = context.filename || context.getFilename();
152
+ const filename = context.filename;
152
153
  // Check if file matches barrel patterns
153
154
  if (!matchesPattern(filename, barrelPatterns)) {
154
155
  return {};
@@ -45,9 +45,9 @@ exports.noBarrelImport = (0, eslint_devkit_1.createRule)({
45
45
  meta: {
46
46
  type: 'suggestion',
47
47
  docs: {
48
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/no-barrel-import.md',
48
49
  description: 'Disallow imports from barrel files to improve build performance and tree-shaking',
49
50
  },
50
- fixable: 'code',
51
51
  hasSuggestions: true,
52
52
  messages: {
53
53
  barrelImportDetected: (0, eslint_devkit_1.formatLLMMessage)({
@@ -13,6 +13,7 @@ exports.noCommonjs = (0, eslint_devkit_1.createRule)({
13
13
  meta: {
14
14
  type: 'problem',
15
15
  docs: {
16
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/no-commonjs.md',
16
17
  description: 'Prevents CommonJS require/module.exports',
17
18
  },
18
19
  hasSuggestions: true,
@@ -98,7 +99,7 @@ exports.noCommonjs = (0, eslint_devkit_1.createRule)({
98
99
  create(context) {
99
100
  const [options] = context.options;
100
101
  const { allowRequire = false, allowModuleExports = false, allowExports = false, allowInFiles = [], suggestES6 = true, } = options || {};
101
- const filename = context.getFilename();
102
+ const filename = context.filename;
102
103
  function shouldAllow() {
103
104
  if (!filename) {
104
105
  return false;
@@ -130,6 +130,7 @@ exports.noCrossDomainImports = (0, eslint_devkit_2.createRule)({
130
130
  meta: {
131
131
  type: 'problem',
132
132
  docs: {
133
+ url: 'https://github.com/ofri-peretz/eslint/blob/main/packages/eslint-plugin-import-next/docs/rules/no-cross-domain-imports.md',
133
134
  description: 'Prevents imports across domain/feature boundaries',
134
135
  },
135
136
  messages: {
@@ -221,7 +222,7 @@ exports.noCrossDomainImports = (0, eslint_devkit_2.createRule)({
221
222
  },
222
223
  ],
223
224
  create(context, [options = {}]) {
224
- const filename = context.getFilename();
225
+ const filename = context.filename;
225
226
  /**
226
227
  * Check import declarations
227
228
  */
@@ -50,7 +50,7 @@ export interface IncrementalOptions {
50
50
  maxCacheAge?: number;
51
51
  }
52
52
  export interface Options {
53
- /** Maximum allowed import depth. Default: 5 */
53
+ /** Maximum allowed import depth. Default: Infinity (unlimited) */
54
54
  maxDepth?: number;
55
55
  /** Patterns to ignore when checking for cycles (glob patterns) */
56
56
  ignorePatterns?: string[];