eslint 9.14.0 → 9.16.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 (99) hide show
  1. package/README.md +1 -1
  2. package/lib/cli-engine/formatters/stylish.js +3 -3
  3. package/lib/cli-engine/lint-result-cache.js +1 -1
  4. package/lib/config/config.js +40 -24
  5. package/lib/eslint/eslint-helpers.js +9 -13
  6. package/lib/languages/js/index.js +76 -0
  7. package/lib/languages/js/source-code/token-store/index.js +1 -1
  8. package/lib/linter/code-path-analysis/code-path-analyzer.js +1 -1
  9. package/lib/linter/code-path-analysis/fork-context.js +1 -1
  10. package/lib/linter/linter.js +36 -35
  11. package/lib/linter/report-translator.js +1 -1
  12. package/lib/rule-tester/rule-tester.js +1 -1
  13. package/lib/rules/accessor-pairs.js +14 -10
  14. package/lib/rules/array-callback-return.js +10 -8
  15. package/lib/rules/arrow-body-style.js +3 -1
  16. package/lib/rules/camelcase.js +18 -12
  17. package/lib/rules/class-methods-use-this.js +9 -5
  18. package/lib/rules/complexity.js +9 -5
  19. package/lib/rules/consistent-return.js +4 -4
  20. package/lib/rules/consistent-this.js +3 -7
  21. package/lib/rules/curly.js +3 -140
  22. package/lib/rules/default-case.js +3 -1
  23. package/lib/rules/dot-notation.js +9 -6
  24. package/lib/rules/func-names.js +3 -3
  25. package/lib/rules/func-style.js +10 -8
  26. package/lib/rules/getter-return.js +7 -5
  27. package/lib/rules/grouped-accessor-pairs.js +3 -1
  28. package/lib/rules/id-denylist.js +2 -1
  29. package/lib/rules/id-length.js +11 -6
  30. package/lib/rules/id-match.js +18 -16
  31. package/lib/rules/new-cap.js +16 -35
  32. package/lib/rules/no-bitwise.js +7 -5
  33. package/lib/rules/no-compare-neg-zero.js +1 -1
  34. package/lib/rules/no-cond-assign.js +3 -3
  35. package/lib/rules/no-console.js +3 -2
  36. package/lib/rules/no-constant-condition.js +5 -4
  37. package/lib/rules/no-duplicate-imports.js +7 -4
  38. package/lib/rules/no-else-return.js +4 -5
  39. package/lib/rules/no-empty-function.js +4 -4
  40. package/lib/rules/no-empty-pattern.js +6 -4
  41. package/lib/rules/no-empty.js +6 -5
  42. package/lib/rules/no-eval.js +6 -5
  43. package/lib/rules/no-extend-native.js +3 -3
  44. package/lib/rules/no-extra-boolean-cast.js +3 -3
  45. package/lib/rules/no-fallthrough.js +12 -15
  46. package/lib/rules/no-global-assign.js +3 -2
  47. package/lib/rules/no-implicit-coercion.js +13 -24
  48. package/lib/rules/no-implicit-globals.js +6 -4
  49. package/lib/rules/no-inline-comments.js +4 -6
  50. package/lib/rules/no-inner-declarations.js +5 -3
  51. package/lib/rules/no-invalid-regexp.js +5 -4
  52. package/lib/rules/no-invalid-this.js +4 -4
  53. package/lib/rules/no-irregular-whitespace.js +24 -22
  54. package/lib/rules/no-labels.js +8 -7
  55. package/lib/rules/no-lonely-if.js +8 -2
  56. package/lib/rules/no-multi-assign.js +7 -10
  57. package/lib/rules/no-plusplus.js +6 -9
  58. package/lib/rules/no-promise-executor-return.js +6 -6
  59. package/lib/rules/no-redeclare.js +5 -8
  60. package/lib/rules/no-return-assign.js +3 -1
  61. package/lib/rules/no-self-assign.js +4 -3
  62. package/lib/rules/no-sequences.js +7 -7
  63. package/lib/rules/no-shadow.js +21 -15
  64. package/lib/rules/no-undef.js +6 -4
  65. package/lib/rules/no-underscore-dangle.js +32 -28
  66. package/lib/rules/no-unneeded-ternary.js +4 -4
  67. package/lib/rules/no-unreachable-loop.js +4 -2
  68. package/lib/rules/no-unsafe-negation.js +6 -4
  69. package/lib/rules/no-unsafe-optional-chaining.js +6 -4
  70. package/lib/rules/no-unused-expressions.js +17 -13
  71. package/lib/rules/no-use-before-define.js +15 -13
  72. package/lib/rules/no-useless-computed-key.js +10 -4
  73. package/lib/rules/no-useless-rename.js +11 -8
  74. package/lib/rules/no-void.js +6 -4
  75. package/lib/rules/no-warning-comments.js +9 -7
  76. package/lib/rules/operator-assignment.js +4 -2
  77. package/lib/rules/prefer-arrow-callback.js +5 -8
  78. package/lib/rules/prefer-const.js +9 -5
  79. package/lib/rules/prefer-promise-reject-errors.js +7 -3
  80. package/lib/rules/prefer-regex-literals.js +6 -3
  81. package/lib/rules/radix.js +3 -1
  82. package/lib/rules/require-atomic-updates.js +6 -3
  83. package/lib/rules/sort-imports.js +20 -16
  84. package/lib/rules/sort-keys.js +22 -16
  85. package/lib/rules/sort-vars.js +7 -6
  86. package/lib/rules/strict.js +3 -2
  87. package/lib/rules/unicode-bom.js +4 -2
  88. package/lib/rules/use-isnan.js +8 -6
  89. package/lib/rules/utils/ast-utils.js +141 -0
  90. package/lib/rules/valid-typeof.js +6 -4
  91. package/lib/rules/yoda.js +9 -12
  92. package/lib/shared/assert.js +22 -0
  93. package/lib/shared/deep-merge-arrays.js +60 -0
  94. package/lib/shared/text-table.js +67 -0
  95. package/lib/shared/types.js +1 -0
  96. package/lib/types/index.d.ts +3 -0
  97. package/lib/types/rules/ecmascript-6.d.ts +36 -16
  98. package/lib/types/rules/stylistic-issues.d.ts +7 -0
  99. package/package.json +11 -12
@@ -27,6 +27,37 @@
27
27
 
28
28
  import { Linter } from "../index";
29
29
 
30
+ export interface NoRestrictedImportPathCommonOptions {
31
+ name: string;
32
+ message?: string;
33
+ }
34
+
35
+ export type EitherImportNamesOrAllowImportName =
36
+ | { importNames?: string[]; allowImportNames?: never }
37
+ | { allowImportNames?: string[]; importNames?: never }
38
+
39
+ export type ValidNoRestrictedImportPathOptions = NoRestrictedImportPathCommonOptions & EitherImportNamesOrAllowImportName;
40
+
41
+ export interface NoRestrictedImportPatternCommonOptions {
42
+ message?: string;
43
+ caseSensitive?: boolean;
44
+ }
45
+
46
+ // Base type for group or regex constraint, ensuring mutual exclusivity
47
+ export type EitherGroupOrRegEx =
48
+ | { group: string[]; regex?: never }
49
+ | { regex: string; group?: never };
50
+
51
+ // Base type for import name specifiers, ensuring mutual exclusivity
52
+ export type EitherNameSpecifiers =
53
+ | { importNames: string[]; allowImportNames?: never; importNamePattern?: never; allowImportNamePattern?: never }
54
+ | { importNamePattern: string; allowImportNames?: never; importNames?: never; allowImportNamePattern?: never }
55
+ | { allowImportNames: string[]; importNames?: never; importNamePattern?: never; allowImportNamePattern?: never }
56
+ | { allowImportNamePattern: string; importNames?: never; allowImportNames?: never; importNamePattern?: never }
57
+
58
+ // Adds oneOf and not constraints, ensuring group or regex are present and mutually exclusive sets for importNames, allowImportNames, etc., as per the schema.
59
+ export type ValidNoRestrictedImportPatternOptions = NoRestrictedImportPatternCommonOptions & EitherGroupOrRegEx & EitherNameSpecifiers;
60
+
30
61
  export interface ECMAScript6 extends Linter.RulesRecord {
31
62
  /**
32
63
  * Rule to require braces around arrow function bodies.
@@ -291,23 +322,12 @@ export interface ECMAScript6 extends Linter.RulesRecord {
291
322
  [
292
323
  ...Array<
293
324
  | string
294
- | {
295
- name: string;
296
- importNames?: string[] | undefined;
297
- message?: string | undefined;
298
- }
325
+ | ValidNoRestrictedImportPathOptions
299
326
  | Partial<{
300
- paths: Array<
301
- | string
302
- | {
303
- name: string;
304
- importNames?: string[] | undefined;
305
- message?: string | undefined;
306
- }
307
- >;
308
- patterns: string[];
309
- }>
310
- >,
327
+ paths: Array<string | ValidNoRestrictedImportPathOptions>;
328
+ patterns: Array<string | ValidNoRestrictedImportPatternOptions>;
329
+ }>
330
+ >
311
331
  ]
312
332
  >;
313
333
 
@@ -493,6 +493,7 @@ export interface StylisticIssues extends Linter.RulesRecord {
493
493
  * Rule to enforce consistent indentation.
494
494
  *
495
495
  * @since 0.14.0
496
+ * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/indent) in `@stylistic/eslint-plugin-js`.
496
497
  * @see https://eslint.org/docs/rules/indent
497
498
  */
498
499
  indent: Linter.RuleEntry<
@@ -1746,6 +1747,7 @@ export interface StylisticIssues extends Linter.RulesRecord {
1746
1747
  * Rule to enforce the consistent use of either backticks, double, or single quotes.
1747
1748
  *
1748
1749
  * @since 0.0.7
1750
+ * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/quotes) in `@stylistic/eslint-plugin-js`.
1749
1751
  * @see https://eslint.org/docs/rules/quotes
1750
1752
  */
1751
1753
  quotes: Linter.RuleEntry<
@@ -1768,6 +1770,7 @@ export interface StylisticIssues extends Linter.RulesRecord {
1768
1770
  * Rule to require or disallow semicolons instead of ASI.
1769
1771
  *
1770
1772
  * @since 0.0.6
1773
+ * @deprecated since 8.53.0, please use the [corresponding rule](https://eslint.style/rules/js/semi) in `@stylistic/eslint-plugin-js`.
1771
1774
  * @see https://eslint.org/docs/rules/semi
1772
1775
  */
1773
1776
  semi:
@@ -1851,6 +1854,10 @@ export interface StylisticIssues extends Linter.RulesRecord {
1851
1854
  * @default false
1852
1855
  */
1853
1856
  allowLineSeparatedGroups: boolean;
1857
+ /**
1858
+ * @default false
1859
+ */
1860
+ ignoreComputedKeys: boolean;
1854
1861
  }>,
1855
1862
  ]
1856
1863
  >;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "9.14.0",
3
+ "version": "9.16.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",
@@ -99,19 +99,19 @@
99
99
  "dependencies": {
100
100
  "@eslint-community/eslint-utils": "^4.2.0",
101
101
  "@eslint-community/regexpp": "^4.12.1",
102
- "@eslint/config-array": "^0.18.0",
103
- "@eslint/core": "^0.7.0",
104
- "@eslint/eslintrc": "^3.1.0",
105
- "@eslint/js": "9.14.0",
106
- "@eslint/plugin-kit": "^0.2.0",
102
+ "@eslint/config-array": "^0.19.0",
103
+ "@eslint/core": "^0.9.0",
104
+ "@eslint/eslintrc": "^3.2.0",
105
+ "@eslint/js": "9.16.0",
106
+ "@eslint/plugin-kit": "^0.2.3",
107
107
  "@humanfs/node": "^0.16.6",
108
108
  "@humanwhocodes/module-importer": "^1.0.1",
109
- "@humanwhocodes/retry": "^0.4.0",
109
+ "@humanwhocodes/retry": "^0.4.1",
110
110
  "@types/estree": "^1.0.6",
111
111
  "@types/json-schema": "^7.0.15",
112
112
  "ajv": "^6.12.4",
113
113
  "chalk": "^4.0.0",
114
- "cross-spawn": "^7.0.2",
114
+ "cross-spawn": "^7.0.5",
115
115
  "debug": "^4.3.2",
116
116
  "escape-string-regexp": "^4.0.0",
117
117
  "eslint-scope": "^8.2.0",
@@ -130,14 +130,13 @@
130
130
  "lodash.merge": "^4.6.2",
131
131
  "minimatch": "^3.1.2",
132
132
  "natural-compare": "^1.4.0",
133
- "optionator": "^0.9.3",
134
- "text-table": "^0.2.0"
133
+ "optionator": "^0.9.3"
135
134
  },
136
135
  "devDependencies": {
137
- "@arethetypeswrong/cli": "^0.16.4",
136
+ "@arethetypeswrong/cli": "^0.17.0",
138
137
  "@babel/core": "^7.4.3",
139
138
  "@babel/preset-env": "^7.4.3",
140
- "@eslint/json": "^0.5.0",
139
+ "@eslint/json": "^0.8.0",
141
140
  "@trunkio/launcher": "^1.3.0",
142
141
  "@types/node": "^20.11.5",
143
142
  "@typescript-eslint/parser": "^8.4.0",