eslint 9.36.0 → 9.37.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 (86) hide show
  1. package/README.md +2 -2
  2. package/lib/cli-engine/lint-result-cache.js +47 -29
  3. package/lib/eslint/eslint-helpers.js +6 -3
  4. package/lib/eslint/eslint.js +151 -37
  5. package/lib/eslint/worker.js +1 -3
  6. package/lib/linter/esquery.js +1 -1
  7. package/lib/rules/array-bracket-newline.js +1 -1
  8. package/lib/rules/array-bracket-spacing.js +1 -1
  9. package/lib/rules/array-element-newline.js +1 -1
  10. package/lib/rules/arrow-parens.js +1 -1
  11. package/lib/rules/arrow-spacing.js +1 -1
  12. package/lib/rules/block-spacing.js +1 -1
  13. package/lib/rules/brace-style.js +1 -1
  14. package/lib/rules/comma-dangle.js +1 -1
  15. package/lib/rules/comma-spacing.js +1 -1
  16. package/lib/rules/comma-style.js +1 -1
  17. package/lib/rules/computed-property-spacing.js +1 -1
  18. package/lib/rules/dot-location.js +1 -1
  19. package/lib/rules/eol-last.js +1 -1
  20. package/lib/rules/func-call-spacing.js +2 -2
  21. package/lib/rules/function-call-argument-newline.js +1 -1
  22. package/lib/rules/function-paren-newline.js +1 -1
  23. package/lib/rules/generator-star-spacing.js +1 -1
  24. package/lib/rules/implicit-arrow-linebreak.js +1 -1
  25. package/lib/rules/indent-legacy.js +1 -0
  26. package/lib/rules/indent.js +1 -1
  27. package/lib/rules/jsx-quotes.js +1 -1
  28. package/lib/rules/key-spacing.js +1 -1
  29. package/lib/rules/keyword-spacing.js +1 -1
  30. package/lib/rules/line-comment-position.js +1 -1
  31. package/lib/rules/linebreak-style.js +1 -1
  32. package/lib/rules/lines-around-comment.js +1 -1
  33. package/lib/rules/lines-around-directive.js +1 -1
  34. package/lib/rules/lines-between-class-members.js +1 -1
  35. package/lib/rules/max-len.js +1 -1
  36. package/lib/rules/max-statements-per-line.js +1 -1
  37. package/lib/rules/multiline-comment-style.js +1 -1
  38. package/lib/rules/multiline-ternary.js +1 -1
  39. package/lib/rules/new-parens.js +1 -1
  40. package/lib/rules/newline-after-var.js +1 -1
  41. package/lib/rules/newline-before-return.js +1 -1
  42. package/lib/rules/newline-per-chained-call.js +1 -1
  43. package/lib/rules/no-confusing-arrow.js +1 -1
  44. package/lib/rules/no-extra-parens.js +1 -1
  45. package/lib/rules/no-extra-semi.js +1 -1
  46. package/lib/rules/no-floating-decimal.js +1 -1
  47. package/lib/rules/no-loss-of-precision.js +5 -8
  48. package/lib/rules/no-mixed-operators.js +1 -1
  49. package/lib/rules/no-mixed-spaces-and-tabs.js +1 -1
  50. package/lib/rules/no-multi-spaces.js +1 -1
  51. package/lib/rules/no-multiple-empty-lines.js +1 -1
  52. package/lib/rules/no-restricted-imports.js +171 -4
  53. package/lib/rules/no-spaced-func.js +1 -1
  54. package/lib/rules/no-tabs.js +1 -1
  55. package/lib/rules/no-trailing-spaces.js +1 -1
  56. package/lib/rules/no-whitespace-before-property.js +1 -1
  57. package/lib/rules/nonblock-statement-body-position.js +1 -1
  58. package/lib/rules/object-curly-newline.js +1 -1
  59. package/lib/rules/object-curly-spacing.js +1 -1
  60. package/lib/rules/object-property-newline.js +1 -1
  61. package/lib/rules/one-var-declaration-per-line.js +1 -1
  62. package/lib/rules/operator-linebreak.js +1 -1
  63. package/lib/rules/padded-blocks.js +1 -1
  64. package/lib/rules/padding-line-between-statements.js +1 -1
  65. package/lib/rules/preserve-caught-error.js +1 -5
  66. package/lib/rules/quote-props.js +1 -1
  67. package/lib/rules/quotes.js +1 -1
  68. package/lib/rules/rest-spread-spacing.js +1 -1
  69. package/lib/rules/semi-spacing.js +1 -1
  70. package/lib/rules/semi-style.js +1 -1
  71. package/lib/rules/semi.js +1 -1
  72. package/lib/rules/space-before-blocks.js +1 -1
  73. package/lib/rules/space-before-function-paren.js +1 -1
  74. package/lib/rules/space-in-parens.js +1 -1
  75. package/lib/rules/space-infix-ops.js +1 -1
  76. package/lib/rules/space-unary-ops.js +1 -1
  77. package/lib/rules/spaced-comment.js +1 -1
  78. package/lib/rules/switch-colon-spacing.js +1 -1
  79. package/lib/rules/template-curly-spacing.js +1 -1
  80. package/lib/rules/template-tag-spacing.js +1 -1
  81. package/lib/rules/wrap-iife.js +1 -1
  82. package/lib/rules/wrap-regex.js +1 -1
  83. package/lib/rules/yield-star-spacing.js +1 -1
  84. package/lib/types/index.d.ts +8 -5
  85. package/lib/types/rules.d.ts +2 -0
  86. package/package.json +6 -6
@@ -162,7 +162,7 @@ module.exports = {
162
162
  message: "Formatting rules are being moved out of ESLint core.",
163
163
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
164
164
  deprecatedSince: "8.53.0",
165
- availableUntil: "10.0.0",
165
+ availableUntil: "11.0.0",
166
166
  replacedBy: [
167
167
  {
168
168
  message:
@@ -18,7 +18,7 @@ module.exports = {
18
18
  message: "Formatting rules are being moved out of ESLint core.",
19
19
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
20
20
  deprecatedSince: "8.53.0",
21
- availableUntil: "10.0.0",
21
+ availableUntil: "11.0.0",
22
22
  replacedBy: [
23
23
  {
24
24
  message:
@@ -17,7 +17,7 @@ module.exports = {
17
17
  message: "Formatting rules are being moved out of ESLint core.",
18
18
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
19
19
  deprecatedSince: "8.53.0",
20
- availableUntil: "10.0.0",
20
+ availableUntil: "11.0.0",
21
21
  replacedBy: [
22
22
  {
23
23
  message:
@@ -16,7 +16,7 @@ module.exports = {
16
16
  message: "Formatting rules are being moved out of ESLint core.",
17
17
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
18
18
  deprecatedSince: "8.53.0",
19
- availableUntil: "10.0.0",
19
+ availableUntil: "11.0.0",
20
20
  replacedBy: [
21
21
  {
22
22
  message:
@@ -23,7 +23,7 @@ module.exports = {
23
23
  message: "Formatting rules are being moved out of ESLint core.",
24
24
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
25
25
  deprecatedSince: "8.53.0",
26
- availableUntil: "10.0.0",
26
+ availableUntil: "11.0.0",
27
27
  replacedBy: [
28
28
  {
29
29
  message:
@@ -23,7 +23,7 @@ module.exports = {
23
23
  message: "Formatting rules are being moved out of ESLint core.",
24
24
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
25
25
  deprecatedSince: "8.53.0",
26
- availableUntil: "10.0.0",
26
+ availableUntil: "11.0.0",
27
27
  replacedBy: [
28
28
  {
29
29
  message:
@@ -393,7 +393,7 @@ module.exports = {
393
393
  message: "Formatting rules are being moved out of ESLint core.",
394
394
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
395
395
  deprecatedSince: "8.53.0",
396
- availableUntil: "10.0.0",
396
+ availableUntil: "11.0.0",
397
397
  replacedBy: [
398
398
  {
399
399
  message:
@@ -82,11 +82,7 @@ function getErrorCause(throwStatement) {
82
82
  }
83
83
 
84
84
  const causeProperties = errorOptions.properties.filter(
85
- prop =>
86
- prop.type === "Property" &&
87
- prop.key.type === "Identifier" &&
88
- prop.key.name === "cause" &&
89
- !prop.computed, // It is hard to accurately identify the value of computed props
85
+ prop => astUtils.getStaticPropertyName(prop) === "cause",
90
86
  );
91
87
 
92
88
  const causeProperty = causeProperties.at(-1);
@@ -24,7 +24,7 @@ module.exports = {
24
24
  message: "Formatting rules are being moved out of ESLint core.",
25
25
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
26
26
  deprecatedSince: "8.53.0",
27
- availableUntil: "10.0.0",
27
+ availableUntil: "11.0.0",
28
28
  replacedBy: [
29
29
  {
30
30
  message:
@@ -101,7 +101,7 @@ module.exports = {
101
101
  message: "Formatting rules are being moved out of ESLint core.",
102
102
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
103
103
  deprecatedSince: "8.53.0",
104
- availableUntil: "10.0.0",
104
+ availableUntil: "11.0.0",
105
105
  replacedBy: [
106
106
  {
107
107
  message:
@@ -17,7 +17,7 @@ module.exports = {
17
17
  message: "Formatting rules are being moved out of ESLint core.",
18
18
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
19
19
  deprecatedSince: "8.53.0",
20
- availableUntil: "10.0.0",
20
+ availableUntil: "11.0.0",
21
21
  replacedBy: [
22
22
  {
23
23
  message:
@@ -19,7 +19,7 @@ module.exports = {
19
19
  message: "Formatting rules are being moved out of ESLint core.",
20
20
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
21
21
  deprecatedSince: "8.53.0",
22
- availableUntil: "10.0.0",
22
+ availableUntil: "11.0.0",
23
23
  replacedBy: [
24
24
  {
25
25
  message:
@@ -89,7 +89,7 @@ module.exports = {
89
89
  message: "Formatting rules are being moved out of ESLint core.",
90
90
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
91
91
  deprecatedSince: "8.53.0",
92
- availableUntil: "10.0.0",
92
+ availableUntil: "11.0.0",
93
93
  replacedBy: [
94
94
  {
95
95
  message:
package/lib/rules/semi.js CHANGED
@@ -23,7 +23,7 @@ module.exports = {
23
23
  message: "Formatting rules are being moved out of ESLint core.",
24
24
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
25
25
  deprecatedSince: "8.53.0",
26
- availableUntil: "10.0.0",
26
+ availableUntil: "11.0.0",
27
27
  replacedBy: [
28
28
  {
29
29
  message:
@@ -42,7 +42,7 @@ module.exports = {
42
42
  message: "Formatting rules are being moved out of ESLint core.",
43
43
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
44
44
  deprecatedSince: "8.53.0",
45
- availableUntil: "10.0.0",
45
+ availableUntil: "11.0.0",
46
46
  replacedBy: [
47
47
  {
48
48
  message:
@@ -22,7 +22,7 @@ module.exports = {
22
22
  message: "Formatting rules are being moved out of ESLint core.",
23
23
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
24
24
  deprecatedSince: "8.53.0",
25
- availableUntil: "10.0.0",
25
+ availableUntil: "11.0.0",
26
26
  replacedBy: [
27
27
  {
28
28
  message:
@@ -18,7 +18,7 @@ module.exports = {
18
18
  message: "Formatting rules are being moved out of ESLint core.",
19
19
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
20
20
  deprecatedSince: "8.53.0",
21
- availableUntil: "10.0.0",
21
+ availableUntil: "11.0.0",
22
22
  replacedBy: [
23
23
  {
24
24
  message:
@@ -18,7 +18,7 @@ module.exports = {
18
18
  message: "Formatting rules are being moved out of ESLint core.",
19
19
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
20
20
  deprecatedSince: "8.53.0",
21
- availableUntil: "10.0.0",
21
+ availableUntil: "11.0.0",
22
22
  replacedBy: [
23
23
  {
24
24
  message:
@@ -22,7 +22,7 @@ module.exports = {
22
22
  message: "Formatting rules are being moved out of ESLint core.",
23
23
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
24
24
  deprecatedSince: "8.53.0",
25
- availableUntil: "10.0.0",
25
+ availableUntil: "11.0.0",
26
26
  replacedBy: [
27
27
  {
28
28
  message:
@@ -147,7 +147,7 @@ module.exports = {
147
147
  message: "Formatting rules are being moved out of ESLint core.",
148
148
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
149
149
  deprecatedSince: "8.53.0",
150
- availableUntil: "10.0.0",
150
+ availableUntil: "11.0.0",
151
151
  replacedBy: [
152
152
  {
153
153
  message:
@@ -23,7 +23,7 @@ module.exports = {
23
23
  message: "Formatting rules are being moved out of ESLint core.",
24
24
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
25
25
  deprecatedSince: "8.53.0",
26
- availableUntil: "10.0.0",
26
+ availableUntil: "11.0.0",
27
27
  replacedBy: [
28
28
  {
29
29
  message:
@@ -23,7 +23,7 @@ module.exports = {
23
23
  message: "Formatting rules are being moved out of ESLint core.",
24
24
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
25
25
  deprecatedSince: "8.53.0",
26
- availableUntil: "10.0.0",
26
+ availableUntil: "11.0.0",
27
27
  replacedBy: [
28
28
  {
29
29
  message:
@@ -17,7 +17,7 @@ module.exports = {
17
17
  message: "Formatting rules are being moved out of ESLint core.",
18
18
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
19
19
  deprecatedSince: "8.53.0",
20
- availableUntil: "10.0.0",
20
+ availableUntil: "11.0.0",
21
21
  replacedBy: [
22
22
  {
23
23
  message:
@@ -44,7 +44,7 @@ module.exports = {
44
44
  message: "Formatting rules are being moved out of ESLint core.",
45
45
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
46
46
  deprecatedSince: "8.53.0",
47
- availableUntil: "10.0.0",
47
+ availableUntil: "11.0.0",
48
48
  replacedBy: [
49
49
  {
50
50
  message:
@@ -17,7 +17,7 @@ module.exports = {
17
17
  message: "Formatting rules are being moved out of ESLint core.",
18
18
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
19
19
  deprecatedSince: "8.53.0",
20
- availableUntil: "10.0.0",
20
+ availableUntil: "11.0.0",
21
21
  replacedBy: [
22
22
  {
23
23
  message:
@@ -17,7 +17,7 @@ module.exports = {
17
17
  message: "Formatting rules are being moved out of ESLint core.",
18
18
  url: "https://eslint.org/blog/2023/10/deprecating-formatting-rules/",
19
19
  deprecatedSince: "8.53.0",
20
- availableUntil: "10.0.0",
20
+ availableUntil: "11.0.0",
21
21
  replacedBy: [
22
22
  {
23
23
  message:
@@ -47,12 +47,14 @@ export namespace AST {
47
47
  | "Boolean"
48
48
  | "Null"
49
49
  | "Identifier"
50
+ | "PrivateIdentifier"
50
51
  | "Keyword"
51
52
  | "Punctuator"
52
53
  | "JSXIdentifier"
53
54
  | "JSXText"
54
55
  | "Numeric"
55
56
  | "String"
57
+ | "Template"
56
58
  | "RegularExpression";
57
59
 
58
60
  interface Token {
@@ -1963,7 +1965,7 @@ export class ESLint {
1963
1965
 
1964
1966
  calculateConfigForFile(filePath: string): Promise<any>;
1965
1967
 
1966
- findConfigFile(): Promise<string | undefined>;
1968
+ findConfigFile(filePath?: string): Promise<string | undefined>;
1967
1969
 
1968
1970
  isPathIgnored(filePath: string): Promise<boolean>;
1969
1971
 
@@ -2045,7 +2047,7 @@ export namespace ESLint {
2045
2047
 
2046
2048
  // Autofix
2047
2049
  fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined;
2048
- fixTypes?: FixType[] | undefined;
2050
+ fixTypes?: FixType[] | null | undefined;
2049
2051
 
2050
2052
  // Cache-related
2051
2053
  cache?: boolean | undefined;
@@ -2079,7 +2081,7 @@ export namespace ESLint {
2079
2081
 
2080
2082
  // Autofix
2081
2083
  fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined;
2082
- fixTypes?: FixType[] | undefined;
2084
+ fixTypes?: FixType[] | null | undefined;
2083
2085
 
2084
2086
  // Cache-related
2085
2087
  cache?: boolean | undefined;
@@ -2168,9 +2170,10 @@ export namespace ESLint {
2168
2170
 
2169
2171
  /**
2170
2172
  * The raw deprecated info provided by the rule.
2171
- * Unset if the rule's `meta.deprecated` property is a boolean.
2173
+ * - Undefined if the rule's `meta.deprecated` property is a boolean.
2174
+ * - Unset when using the legacy eslintrc configuration.
2172
2175
  */
2173
- info?: DeprecatedInfo;
2176
+ info?: DeprecatedInfo | undefined;
2174
2177
  }
2175
2178
 
2176
2179
  /**
@@ -38,6 +38,7 @@ import { Linter } from "./index";
38
38
  interface NoRestrictedImportPathCommonOptions {
39
39
  name: string;
40
40
  message?: string;
41
+ allowTypeImports?: boolean;
41
42
  }
42
43
 
43
44
  type EitherImportNamesOrAllowImportName =
@@ -50,6 +51,7 @@ type ValidNoRestrictedImportPathOptions = NoRestrictedImportPathCommonOptions &
50
51
  interface NoRestrictedImportPatternCommonOptions {
51
52
  message?: string;
52
53
  caseSensitive?: boolean;
54
+ allowTypeImports?: boolean;
53
55
  }
54
56
 
55
57
  // Base type for group or regex constraint, ensuring mutual exclusivity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "9.36.0",
3
+ "version": "9.37.0",
4
4
  "author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
5
5
  "description": "An AST-based pattern checker for JavaScript.",
6
6
  "type": "commonjs",
@@ -107,11 +107,11 @@
107
107
  "@eslint-community/eslint-utils": "^4.8.0",
108
108
  "@eslint-community/regexpp": "^4.12.1",
109
109
  "@eslint/config-array": "^0.21.0",
110
- "@eslint/config-helpers": "^0.3.1",
111
- "@eslint/core": "^0.15.2",
110
+ "@eslint/config-helpers": "^0.4.0",
111
+ "@eslint/core": "^0.16.0",
112
112
  "@eslint/eslintrc": "^3.3.1",
113
- "@eslint/js": "9.36.0",
114
- "@eslint/plugin-kit": "^0.3.5",
113
+ "@eslint/js": "9.37.0",
114
+ "@eslint/plugin-kit": "^0.4.0",
115
115
  "@humanfs/node": "^0.16.6",
116
116
  "@humanwhocodes/module-importer": "^1.0.1",
117
117
  "@humanwhocodes/retry": "^0.4.2",
@@ -173,7 +173,7 @@
173
173
  "globals": "^16.2.0",
174
174
  "got": "^11.8.3",
175
175
  "gray-matter": "^4.0.3",
176
- "jiti": "^2.5.1",
176
+ "jiti": "^2.6.1",
177
177
  "jiti-v2.0": "npm:jiti@2.0.x",
178
178
  "jiti-v2.1": "npm:jiti@2.1.x",
179
179
  "knip": "^5.60.2",