eslint 9.28.0 → 9.30.0

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 (107) hide show
  1. package/README.md +1 -1
  2. package/conf/ecma-version.js +1 -1
  3. package/conf/globals.js +10 -0
  4. package/lib/cli.js +6 -11
  5. package/lib/config/config-loader.js +2 -29
  6. package/lib/config/flat-config-array.js +1 -1
  7. package/lib/eslint/eslint.js +14 -18
  8. package/lib/languages/js/source-code/source-code.js +81 -27
  9. package/lib/linter/apply-disable-directives.js +2 -4
  10. package/lib/linter/code-path-analysis/code-path-analyzer.js +8 -9
  11. package/lib/linter/linter.js +4 -4
  12. package/lib/linter/source-code-traverser.js +64 -49
  13. package/lib/linter/source-code-visitor.js +81 -0
  14. package/lib/rules/array-bracket-newline.js +3 -3
  15. package/lib/rules/array-bracket-spacing.js +3 -3
  16. package/lib/rules/array-element-newline.js +3 -3
  17. package/lib/rules/arrow-parens.js +3 -3
  18. package/lib/rules/arrow-spacing.js +3 -3
  19. package/lib/rules/block-spacing.js +3 -3
  20. package/lib/rules/brace-style.js +3 -3
  21. package/lib/rules/class-methods-use-this.js +7 -0
  22. package/lib/rules/comma-dangle.js +3 -3
  23. package/lib/rules/comma-spacing.js +3 -3
  24. package/lib/rules/comma-style.js +3 -3
  25. package/lib/rules/computed-property-spacing.js +3 -3
  26. package/lib/rules/dot-location.js +3 -3
  27. package/lib/rules/eol-last.js +3 -3
  28. package/lib/rules/func-call-spacing.js +3 -3
  29. package/lib/rules/function-call-argument-newline.js +3 -3
  30. package/lib/rules/function-paren-newline.js +3 -3
  31. package/lib/rules/generator-star-spacing.js +3 -3
  32. package/lib/rules/implicit-arrow-linebreak.js +3 -3
  33. package/lib/rules/indent-legacy.js +3 -3
  34. package/lib/rules/indent.js +3 -3
  35. package/lib/rules/jsx-quotes.js +3 -3
  36. package/lib/rules/key-spacing.js +3 -3
  37. package/lib/rules/keyword-spacing.js +3 -3
  38. package/lib/rules/line-comment-position.js +3 -3
  39. package/lib/rules/linebreak-style.js +3 -3
  40. package/lib/rules/lines-around-comment.js +3 -3
  41. package/lib/rules/lines-around-directive.js +3 -3
  42. package/lib/rules/lines-between-class-members.js +3 -3
  43. package/lib/rules/max-len.js +3 -3
  44. package/lib/rules/max-statements-per-line.js +3 -3
  45. package/lib/rules/multiline-comment-style.js +3 -3
  46. package/lib/rules/multiline-ternary.js +3 -3
  47. package/lib/rules/new-parens.js +3 -3
  48. package/lib/rules/newline-after-var.js +3 -3
  49. package/lib/rules/newline-before-return.js +3 -3
  50. package/lib/rules/newline-per-chained-call.js +3 -3
  51. package/lib/rules/no-confusing-arrow.js +3 -3
  52. package/lib/rules/no-duplicate-imports.js +65 -7
  53. package/lib/rules/no-extra-parens.js +3 -3
  54. package/lib/rules/no-extra-semi.js +3 -3
  55. package/lib/rules/no-floating-decimal.js +3 -3
  56. package/lib/rules/no-mixed-operators.js +3 -3
  57. package/lib/rules/no-mixed-spaces-and-tabs.js +3 -3
  58. package/lib/rules/no-multi-spaces.js +3 -3
  59. package/lib/rules/no-multiple-empty-lines.js +3 -3
  60. package/lib/rules/no-promise-executor-return.js +4 -35
  61. package/lib/rules/no-restricted-globals.js +35 -2
  62. package/lib/rules/no-restricted-properties.js +35 -12
  63. package/lib/rules/no-setter-return.js +13 -48
  64. package/lib/rules/no-spaced-func.js +3 -3
  65. package/lib/rules/no-tabs.js +3 -3
  66. package/lib/rules/no-trailing-spaces.js +3 -3
  67. package/lib/rules/no-unused-vars.js +1 -1
  68. package/lib/rules/no-use-before-define.js +2 -0
  69. package/lib/rules/no-var.js +14 -2
  70. package/lib/rules/no-whitespace-before-property.js +3 -3
  71. package/lib/rules/nonblock-statement-body-position.js +3 -3
  72. package/lib/rules/object-curly-newline.js +3 -3
  73. package/lib/rules/object-curly-spacing.js +3 -3
  74. package/lib/rules/object-property-newline.js +3 -3
  75. package/lib/rules/one-var-declaration-per-line.js +3 -3
  76. package/lib/rules/operator-linebreak.js +3 -3
  77. package/lib/rules/padded-blocks.js +3 -3
  78. package/lib/rules/padding-line-between-statements.js +3 -3
  79. package/lib/rules/prefer-regex-literals.js +1 -18
  80. package/lib/rules/quote-props.js +3 -3
  81. package/lib/rules/quotes.js +3 -3
  82. package/lib/rules/rest-spread-spacing.js +3 -3
  83. package/lib/rules/semi-spacing.js +3 -3
  84. package/lib/rules/semi-style.js +3 -3
  85. package/lib/rules/semi.js +3 -3
  86. package/lib/rules/space-before-blocks.js +3 -3
  87. package/lib/rules/space-before-function-paren.js +3 -3
  88. package/lib/rules/space-in-parens.js +3 -3
  89. package/lib/rules/space-infix-ops.js +3 -3
  90. package/lib/rules/space-unary-ops.js +3 -3
  91. package/lib/rules/spaced-comment.js +3 -3
  92. package/lib/rules/switch-colon-spacing.js +3 -3
  93. package/lib/rules/template-curly-spacing.js +3 -3
  94. package/lib/rules/template-tag-spacing.js +3 -3
  95. package/lib/rules/utils/ast-utils.js +45 -0
  96. package/lib/rules/wrap-iife.js +3 -3
  97. package/lib/rules/wrap-regex.js +3 -3
  98. package/lib/rules/yield-star-spacing.js +3 -3
  99. package/lib/services/suppressions-service.js +8 -0
  100. package/lib/shared/flags.js +9 -1
  101. package/lib/shared/naming.js +109 -0
  102. package/lib/shared/relative-module-resolver.js +28 -0
  103. package/lib/shared/runtime-info.js +1 -1
  104. package/lib/types/index.d.ts +15 -2
  105. package/lib/types/rules.d.ts +83 -74
  106. package/package.json +8 -8
  107. package/lib/linter/safe-emitter.js +0 -52
@@ -51,12 +51,12 @@ module.exports = {
51
51
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
52
52
  url: "https://eslint.style/guide/migration",
53
53
  plugin: {
54
- name: "@stylistic/eslint-plugin-js",
55
- url: "https://eslint.style/packages/js",
54
+ name: "@stylistic/eslint-plugin",
55
+ url: "https://eslint.style",
56
56
  },
57
57
  rule: {
58
58
  name: "jsx-quotes",
59
- url: "https://eslint.style/rules/js/jsx-quotes",
59
+ url: "https://eslint.style/rules/jsx-quotes",
60
60
  },
61
61
  },
62
62
  ],
@@ -158,12 +158,12 @@ module.exports = {
158
158
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
159
159
  url: "https://eslint.style/guide/migration",
160
160
  plugin: {
161
- name: "@stylistic/eslint-plugin-js",
162
- url: "https://eslint.style/packages/js",
161
+ name: "@stylistic/eslint-plugin",
162
+ url: "https://eslint.style",
163
163
  },
164
164
  rule: {
165
165
  name: "key-spacing",
166
- url: "https://eslint.style/rules/js/key-spacing",
166
+ url: "https://eslint.style/rules/key-spacing",
167
167
  },
168
168
  },
169
169
  ],
@@ -89,12 +89,12 @@ module.exports = {
89
89
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
90
90
  url: "https://eslint.style/guide/migration",
91
91
  plugin: {
92
- name: "@stylistic/eslint-plugin-js",
93
- url: "https://eslint.style/packages/js",
92
+ name: "@stylistic/eslint-plugin",
93
+ url: "https://eslint.style",
94
94
  },
95
95
  rule: {
96
96
  name: "keyword-spacing",
97
- url: "https://eslint.style/rules/js/keyword-spacing",
97
+ url: "https://eslint.style/rules/keyword-spacing",
98
98
  },
99
99
  },
100
100
  ],
@@ -25,12 +25,12 @@ module.exports = {
25
25
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
26
26
  url: "https://eslint.style/guide/migration",
27
27
  plugin: {
28
- name: "@stylistic/eslint-plugin-js",
29
- url: "https://eslint.style/packages/js",
28
+ name: "@stylistic/eslint-plugin",
29
+ url: "https://eslint.style",
30
30
  },
31
31
  rule: {
32
32
  name: "line-comment-position",
33
- url: "https://eslint.style/rules/js/line-comment-position",
33
+ url: "https://eslint.style/rules/line-comment-position",
34
34
  },
35
35
  },
36
36
  ],
@@ -38,12 +38,12 @@ module.exports = {
38
38
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
39
39
  url: "https://eslint.style/guide/migration",
40
40
  plugin: {
41
- name: "@stylistic/eslint-plugin-js",
42
- url: "https://eslint.style/packages/js",
41
+ name: "@stylistic/eslint-plugin",
42
+ url: "https://eslint.style",
43
43
  },
44
44
  rule: {
45
45
  name: "linebreak-style",
46
- url: "https://eslint.style/rules/js/linebreak-style",
46
+ url: "https://eslint.style/rules/linebreak-style",
47
47
  },
48
48
  },
49
49
  ],
@@ -67,12 +67,12 @@ module.exports = {
67
67
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
68
68
  url: "https://eslint.style/guide/migration",
69
69
  plugin: {
70
- name: "@stylistic/eslint-plugin-js",
71
- url: "https://eslint.style/packages/js",
70
+ name: "@stylistic/eslint-plugin",
71
+ url: "https://eslint.style",
72
72
  },
73
73
  rule: {
74
74
  name: "lines-around-comment",
75
- url: "https://eslint.style/rules/js/lines-around-comment",
75
+ url: "https://eslint.style/rules/lines-around-comment",
76
76
  },
77
77
  },
78
78
  ],
@@ -62,12 +62,12 @@ module.exports = {
62
62
  message: "The new rule moved to a plugin.",
63
63
  url: "https://eslint.org/docs/latest/rules/padding-line-between-statements#examples",
64
64
  plugin: {
65
- name: "@stylistic/eslint-plugin-js",
66
- url: "https://eslint.style/packages/js",
65
+ name: "@stylistic/eslint-plugin",
66
+ url: "https://eslint.style",
67
67
  },
68
68
  rule: {
69
69
  name: "padding-line-between-statements",
70
- url: "https://eslint.style/rules/js/padding-line-between-statements",
70
+ url: "https://eslint.style/rules/padding-line-between-statements",
71
71
  },
72
72
  },
73
73
  ],
@@ -44,12 +44,12 @@ module.exports = {
44
44
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
45
45
  url: "https://eslint.style/guide/migration",
46
46
  plugin: {
47
- name: "@stylistic/eslint-plugin-js",
48
- url: "https://eslint.style/packages/js",
47
+ name: "@stylistic/eslint-plugin",
48
+ url: "https://eslint.style",
49
49
  },
50
50
  rule: {
51
51
  name: "lines-between-class-members",
52
- url: "https://eslint.style/rules/js/lines-between-class-members",
52
+ url: "https://eslint.style/rules/lines-between-class-members",
53
53
  },
54
54
  },
55
55
  ],
@@ -78,12 +78,12 @@ module.exports = {
78
78
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
79
79
  url: "https://eslint.style/guide/migration",
80
80
  plugin: {
81
- name: "@stylistic/eslint-plugin-js",
82
- url: "https://eslint.style/packages/js",
81
+ name: "@stylistic/eslint-plugin",
82
+ url: "https://eslint.style",
83
83
  },
84
84
  rule: {
85
85
  name: "max-len",
86
- url: "https://eslint.style/rules/js/max-len",
86
+ url: "https://eslint.style/rules/max-len",
87
87
  },
88
88
  },
89
89
  ],
@@ -29,12 +29,12 @@ module.exports = {
29
29
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
30
30
  url: "https://eslint.style/guide/migration",
31
31
  plugin: {
32
- name: "@stylistic/eslint-plugin-js",
33
- url: "https://eslint.style/packages/js",
32
+ name: "@stylistic/eslint-plugin",
33
+ url: "https://eslint.style",
34
34
  },
35
35
  rule: {
36
36
  name: "max-statements-per-line",
37
- url: "https://eslint.style/rules/js/max-statements-per-line",
37
+ url: "https://eslint.style/rules/max-statements-per-line",
38
38
  },
39
39
  },
40
40
  ],
@@ -25,12 +25,12 @@ module.exports = {
25
25
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
26
26
  url: "https://eslint.style/guide/migration",
27
27
  plugin: {
28
- name: "@stylistic/eslint-plugin-js",
29
- url: "https://eslint.style/packages/js",
28
+ name: "@stylistic/eslint-plugin",
29
+ url: "https://eslint.style",
30
30
  },
31
31
  rule: {
32
32
  name: "multiline-comment-style",
33
- url: "https://eslint.style/rules/js/multiline-comment-style",
33
+ url: "https://eslint.style/rules/multiline-comment-style",
34
34
  },
35
35
  },
36
36
  ],
@@ -26,12 +26,12 @@ module.exports = {
26
26
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
27
27
  url: "https://eslint.style/guide/migration",
28
28
  plugin: {
29
- name: "@stylistic/eslint-plugin-js",
30
- url: "https://eslint.style/packages/js",
29
+ name: "@stylistic/eslint-plugin",
30
+ url: "https://eslint.style",
31
31
  },
32
32
  rule: {
33
33
  name: "multiline-ternary",
34
- url: "https://eslint.style/rules/js/multiline-ternary",
34
+ url: "https://eslint.style/rules/multiline-ternary",
35
35
  },
36
36
  },
37
37
  ],
@@ -34,12 +34,12 @@ module.exports = {
34
34
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
35
35
  url: "https://eslint.style/guide/migration",
36
36
  plugin: {
37
- name: "@stylistic/eslint-plugin-js",
38
- url: "https://eslint.style/packages/js",
37
+ name: "@stylistic/eslint-plugin",
38
+ url: "https://eslint.style",
39
39
  },
40
40
  rule: {
41
41
  name: "new-parens",
42
- url: "https://eslint.style/rules/js/new-parens",
42
+ url: "https://eslint.style/rules/new-parens",
43
43
  },
44
44
  },
45
45
  ],
@@ -48,12 +48,12 @@ module.exports = {
48
48
  message: "The new rule moved to a plugin.",
49
49
  url: "https://eslint.org/docs/latest/rules/padding-line-between-statements#examples",
50
50
  plugin: {
51
- name: "@stylistic/eslint-plugin-js",
52
- url: "https://eslint.style/packages/js",
51
+ name: "@stylistic/eslint-plugin",
52
+ url: "https://eslint.style",
53
53
  },
54
54
  rule: {
55
55
  name: "padding-line-between-statements",
56
- url: "https://eslint.style/rules/js/padding-line-between-statements",
56
+ url: "https://eslint.style/rules/padding-line-between-statements",
57
57
  },
58
58
  },
59
59
  ],
@@ -36,12 +36,12 @@ module.exports = {
36
36
  message: "The new rule moved to a plugin.",
37
37
  url: "https://eslint.org/docs/latest/rules/padding-line-between-statements#examples",
38
38
  plugin: {
39
- name: "@stylistic/eslint-plugin-js",
40
- url: "https://eslint.style/packages/js",
39
+ name: "@stylistic/eslint-plugin",
40
+ url: "https://eslint.style",
41
41
  },
42
42
  rule: {
43
43
  name: "padding-line-between-statements",
44
- url: "https://eslint.style/rules/js/padding-line-between-statements",
44
+ url: "https://eslint.style/rules/padding-line-between-statements",
45
45
  },
46
46
  },
47
47
  ],
@@ -27,12 +27,12 @@ module.exports = {
27
27
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
28
28
  url: "https://eslint.style/guide/migration",
29
29
  plugin: {
30
- name: "@stylistic/eslint-plugin-js",
31
- url: "https://eslint.style/packages/js",
30
+ name: "@stylistic/eslint-plugin",
31
+ url: "https://eslint.style",
32
32
  },
33
33
  rule: {
34
34
  name: "newline-per-chained-call",
35
- url: "https://eslint.style/rules/js/newline-per-chained-call",
35
+ url: "https://eslint.style/rules/newline-per-chained-call",
36
36
  },
37
37
  },
38
38
  ],
@@ -40,12 +40,12 @@ module.exports = {
40
40
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
41
41
  url: "https://eslint.style/guide/migration",
42
42
  plugin: {
43
- name: "@stylistic/eslint-plugin-js",
44
- url: "https://eslint.style/packages/js",
43
+ name: "@stylistic/eslint-plugin",
44
+ url: "https://eslint.style",
45
45
  },
46
46
  rule: {
47
47
  name: "no-confusing-arrow",
48
- url: "https://eslint.style/rules/js/no-confusing-arrow",
48
+ url: "https://eslint.style/rules/no-confusing-arrow",
49
49
  },
50
50
  },
51
51
  ],
@@ -91,13 +91,33 @@ function isImportExportCanBeMerged(node1, node2) {
91
91
  * Returns a boolean if we should report (import|export).
92
92
  * @param {ASTNode} node A node to be reported or not.
93
93
  * @param {[ASTNode]} previousNodes An array contains previous nodes of the module imported or exported.
94
+ * @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
94
95
  * @returns {boolean} True if the (import|export) should be reported.
95
96
  */
96
- function shouldReportImportExport(node, previousNodes) {
97
+ function shouldReportImportExport(
98
+ node,
99
+ previousNodes,
100
+ allowSeparateTypeImports,
101
+ ) {
97
102
  let i = 0;
98
103
 
99
104
  while (i < previousNodes.length) {
100
- if (isImportExportCanBeMerged(node, previousNodes[i])) {
105
+ const previousNode = previousNodes[i];
106
+
107
+ if (allowSeparateTypeImports) {
108
+ const isTypeNode =
109
+ node.importKind === "type" || node.exportKind === "type";
110
+ const isTypePrevious =
111
+ previousNode.importKind === "type" ||
112
+ previousNode.exportKind === "type";
113
+
114
+ if (isTypeNode !== isTypePrevious) {
115
+ i++;
116
+ continue;
117
+ }
118
+ }
119
+
120
+ if (isImportExportCanBeMerged(node, previousNode)) {
101
121
  return true;
102
122
  }
103
123
  i++;
@@ -136,6 +156,7 @@ function getModule(node) {
136
156
  * @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
137
157
  * @param {string} declarationType A declaration type can be an import or export.
138
158
  * @param {boolean} includeExports Whether or not to check for exports in addition to imports.
159
+ * @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
139
160
  * @returns {void} No return value.
140
161
  */
141
162
  function checkAndReport(
@@ -144,6 +165,7 @@ function checkAndReport(
144
165
  modules,
145
166
  declarationType,
146
167
  includeExports,
168
+ allowSeparateTypeImports,
147
169
  ) {
148
170
  const module = getModule(node);
149
171
 
@@ -157,19 +179,43 @@ function checkAndReport(
157
179
  exportNodes = getNodesByDeclarationType(previousNodes, "export");
158
180
  }
159
181
  if (declarationType === "import") {
160
- if (shouldReportImportExport(node, importNodes)) {
182
+ if (
183
+ shouldReportImportExport(
184
+ node,
185
+ importNodes,
186
+ allowSeparateTypeImports,
187
+ )
188
+ ) {
161
189
  messagesIds.push("import");
162
190
  }
163
191
  if (includeExports) {
164
- if (shouldReportImportExport(node, exportNodes)) {
192
+ if (
193
+ shouldReportImportExport(
194
+ node,
195
+ exportNodes,
196
+ allowSeparateTypeImports,
197
+ )
198
+ ) {
165
199
  messagesIds.push("importAs");
166
200
  }
167
201
  }
168
202
  } else if (declarationType === "export") {
169
- if (shouldReportImportExport(node, exportNodes)) {
203
+ if (
204
+ shouldReportImportExport(
205
+ node,
206
+ exportNodes,
207
+ allowSeparateTypeImports,
208
+ )
209
+ ) {
170
210
  messagesIds.push("export");
171
211
  }
172
- if (shouldReportImportExport(node, importNodes)) {
212
+ if (
213
+ shouldReportImportExport(
214
+ node,
215
+ importNodes,
216
+ allowSeparateTypeImports,
217
+ )
218
+ ) {
173
219
  messagesIds.push("exportAs");
174
220
  }
175
221
  }
@@ -196,6 +242,7 @@ function checkAndReport(
196
242
  * @param {Map} modules A Map object contains as a key a module name and as value an array contains objects, each object contains a node and a declaration type.
197
243
  * @param {string} declarationType A declaration type can be an import or export.
198
244
  * @param {boolean} includeExports Whether or not to check for exports in addition to imports.
245
+ * @param {boolean} allowSeparateTypeImports Whether to allow separate type and value imports.
199
246
  * @returns {nodeCallback} A function passed to ESLint to handle the statement.
200
247
  */
201
248
  function handleImportsExports(
@@ -203,6 +250,7 @@ function handleImportsExports(
203
250
  modules,
204
251
  declarationType,
205
252
  includeExports,
253
+ allowSeparateTypeImports,
206
254
  ) {
207
255
  return function (node) {
208
256
  const module = getModule(node);
@@ -214,6 +262,7 @@ function handleImportsExports(
214
262
  modules,
215
263
  declarationType,
216
264
  includeExports,
265
+ allowSeparateTypeImports,
217
266
  );
218
267
  const currentNode = { node, declarationType };
219
268
  let nodes = [currentNode];
@@ -231,11 +280,14 @@ function handleImportsExports(
231
280
  /** @type {import('../types').Rule.RuleModule} */
232
281
  module.exports = {
233
282
  meta: {
283
+ dialects: ["javascript", "typescript"],
284
+ language: "javascript",
234
285
  type: "problem",
235
286
 
236
287
  defaultOptions: [
237
288
  {
238
289
  includeExports: false,
290
+ allowSeparateTypeImports: false,
239
291
  },
240
292
  ],
241
293
 
@@ -252,6 +304,9 @@ module.exports = {
252
304
  includeExports: {
253
305
  type: "boolean",
254
306
  },
307
+ allowSeparateTypeImports: {
308
+ type: "boolean",
309
+ },
255
310
  },
256
311
  additionalProperties: false,
257
312
  },
@@ -266,7 +321,7 @@ module.exports = {
266
321
  },
267
322
 
268
323
  create(context) {
269
- const [{ includeExports }] = context.options;
324
+ const [{ includeExports, allowSeparateTypeImports }] = context.options;
270
325
  const modules = new Map();
271
326
  const handlers = {
272
327
  ImportDeclaration: handleImportsExports(
@@ -274,6 +329,7 @@ module.exports = {
274
329
  modules,
275
330
  "import",
276
331
  includeExports,
332
+ allowSeparateTypeImports,
277
333
  ),
278
334
  };
279
335
 
@@ -283,12 +339,14 @@ module.exports = {
283
339
  modules,
284
340
  "export",
285
341
  includeExports,
342
+ allowSeparateTypeImports,
286
343
  );
287
344
  handlers.ExportAllDeclaration = handleImportsExports(
288
345
  context,
289
346
  modules,
290
347
  "export",
291
348
  includeExports,
349
+ allowSeparateTypeImports,
292
350
  );
293
351
  }
294
352
  return handlers;
@@ -28,12 +28,12 @@ module.exports = {
28
28
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
29
29
  url: "https://eslint.style/guide/migration",
30
30
  plugin: {
31
- name: "@stylistic/eslint-plugin-js",
32
- url: "https://eslint.style/packages/js",
31
+ name: "@stylistic/eslint-plugin",
32
+ url: "https://eslint.style",
33
33
  },
34
34
  rule: {
35
35
  name: "no-extra-parens",
36
- url: "https://eslint.style/rules/js/no-extra-parens",
36
+ url: "https://eslint.style/rules/no-extra-parens",
37
37
  },
38
38
  },
39
39
  ],
@@ -31,12 +31,12 @@ module.exports = {
31
31
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
32
32
  url: "https://eslint.style/guide/migration",
33
33
  plugin: {
34
- name: "@stylistic/eslint-plugin-js",
35
- url: "https://eslint.style/packages/js",
34
+ name: "@stylistic/eslint-plugin",
35
+ url: "https://eslint.style",
36
36
  },
37
37
  rule: {
38
38
  name: "no-extra-semi",
39
- url: "https://eslint.style/rules/js/no-extra-semi",
39
+ url: "https://eslint.style/rules/no-extra-semi",
40
40
  },
41
41
  },
42
42
  ],
@@ -30,12 +30,12 @@ module.exports = {
30
30
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
31
31
  url: "https://eslint.style/guide/migration",
32
32
  plugin: {
33
- name: "@stylistic/eslint-plugin-js",
34
- url: "https://eslint.style/packages/js",
33
+ name: "@stylistic/eslint-plugin",
34
+ url: "https://eslint.style",
35
35
  },
36
36
  rule: {
37
37
  name: "no-floating-decimal",
38
- url: "https://eslint.style/rules/js/no-floating-decimal",
38
+ url: "https://eslint.style/rules/no-floating-decimal",
39
39
  },
40
40
  },
41
41
  ],
@@ -97,12 +97,12 @@ module.exports = {
97
97
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
98
98
  url: "https://eslint.style/guide/migration",
99
99
  plugin: {
100
- name: "@stylistic/eslint-plugin-js",
101
- url: "https://eslint.style/packages/js",
100
+ name: "@stylistic/eslint-plugin",
101
+ url: "https://eslint.style",
102
102
  },
103
103
  rule: {
104
104
  name: "no-mixed-operators",
105
- url: "https://eslint.style/rules/js/no-mixed-operators",
105
+ url: "https://eslint.style/rules/no-mixed-operators",
106
106
  },
107
107
  },
108
108
  ],
@@ -23,12 +23,12 @@ module.exports = {
23
23
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
24
24
  url: "https://eslint.style/guide/migration",
25
25
  plugin: {
26
- name: "@stylistic/eslint-plugin-js",
27
- url: "https://eslint.style/packages/js",
26
+ name: "@stylistic/eslint-plugin",
27
+ url: "https://eslint.style",
28
28
  },
29
29
  rule: {
30
30
  name: "no-mixed-spaces-and-tabs",
31
- url: "https://eslint.style/rules/js/no-mixed-spaces-and-tabs",
31
+ url: "https://eslint.style/rules/no-mixed-spaces-and-tabs",
32
32
  },
33
33
  },
34
34
  ],
@@ -26,12 +26,12 @@ module.exports = {
26
26
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
27
27
  url: "https://eslint.style/guide/migration",
28
28
  plugin: {
29
- name: "@stylistic/eslint-plugin-js",
30
- url: "https://eslint.style/packages/js",
29
+ name: "@stylistic/eslint-plugin",
30
+ url: "https://eslint.style",
31
31
  },
32
32
  rule: {
33
33
  name: "no-multi-spaces",
34
- url: "https://eslint.style/rules/js/no-multi-spaces",
34
+ url: "https://eslint.style/rules/no-multi-spaces",
35
35
  },
36
36
  },
37
37
  ],
@@ -24,12 +24,12 @@ module.exports = {
24
24
  "ESLint Stylistic now maintains deprecated stylistic core rules.",
25
25
  url: "https://eslint.style/guide/migration",
26
26
  plugin: {
27
- name: "@stylistic/eslint-plugin-js",
28
- url: "https://eslint.style/packages/js",
27
+ name: "@stylistic/eslint-plugin",
28
+ url: "https://eslint.style",
29
29
  },
30
30
  rule: {
31
31
  name: "no-multiple-empty-lines",
32
- url: "https://eslint.style/rules/js/no-multiple-empty-lines",
32
+ url: "https://eslint.style/rules/no-multiple-empty-lines",
33
33
  },
34
34
  },
35
35
  ],
@@ -9,7 +9,6 @@
9
9
  // Requirements
10
10
  //------------------------------------------------------------------------------
11
11
 
12
- const { findVariable } = require("@eslint-community/eslint-utils");
13
12
  const astUtils = require("./utils/ast-utils");
14
13
 
15
14
  //------------------------------------------------------------------------------
@@ -21,43 +20,13 @@ const functionTypesToCheck = new Set([
21
20
  "FunctionExpression",
22
21
  ]);
23
22
 
24
- /**
25
- * Determines whether the given identifier node is a reference to a global variable.
26
- * @param {ASTNode} node `Identifier` node to check.
27
- * @param {Scope} scope Scope to which the node belongs.
28
- * @returns {boolean} True if the identifier is a reference to a global variable.
29
- */
30
- function isGlobalReference(node, scope) {
31
- const variable = findVariable(scope, node);
32
-
33
- return (
34
- variable !== null &&
35
- variable.scope.type === "global" &&
36
- variable.defs.length === 0
37
- );
38
- }
39
-
40
- /**
41
- * Finds function's outer scope.
42
- * @param {Scope} scope Function's own scope.
43
- * @returns {Scope} Function's outer scope.
44
- */
45
- function getOuterScope(scope) {
46
- const upper = scope.upper;
47
-
48
- if (upper.type === "function-expression-name") {
49
- return upper.upper;
50
- }
51
- return upper;
52
- }
53
-
54
23
  /**
55
24
  * Determines whether the given function node is used as a Promise executor.
56
25
  * @param {ASTNode} node The node to check.
57
- * @param {Scope} scope Function's own scope.
26
+ * @param {SourceCode} sourceCode Source code to which the node belongs.
58
27
  * @returns {boolean} `true` if the node is a Promise executor.
59
28
  */
60
- function isPromiseExecutor(node, scope) {
29
+ function isPromiseExecutor(node, sourceCode) {
61
30
  const parent = node.parent;
62
31
 
63
32
  return (
@@ -65,7 +34,7 @@ function isPromiseExecutor(node, scope) {
65
34
  parent.arguments[0] === node &&
66
35
  parent.callee.type === "Identifier" &&
67
36
  parent.callee.name === "Promise" &&
68
- isGlobalReference(parent.callee, getOuterScope(scope))
37
+ sourceCode.isGlobalReference(parent.callee)
69
38
  );
70
39
  }
71
40
 
@@ -203,7 +172,7 @@ module.exports = {
203
172
  upper: funcInfo,
204
173
  shouldCheck:
205
174
  functionTypesToCheck.has(node.type) &&
206
- isPromiseExecutor(node, sourceCode.getScope(node)),
175
+ isPromiseExecutor(node, sourceCode),
207
176
  };
208
177
 
209
178
  if (