eslint 9.15.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.
@@ -177,10 +177,11 @@ module.exports = {
177
177
  }
178
178
  },
179
179
  create(context) {
180
- const [config] = context.options;
181
- const checkGetWithoutSet = config.getWithoutSet === true;
182
- const checkSetWithoutGet = config.setWithoutGet !== false;
183
- const enforceForClassMembers = config.enforceForClassMembers !== false;
180
+ const [{
181
+ getWithoutSet: checkGetWithoutSet,
182
+ setWithoutGet: checkSetWithoutGet,
183
+ enforceForClassMembers
184
+ }] = context.options;
184
185
  const sourceCode = context.sourceCode;
185
186
 
186
187
  /**
@@ -42,7 +42,9 @@ module.exports = {
42
42
  meta: {
43
43
  type: "problem",
44
44
 
45
- defaultOptions: [{}],
45
+ defaultOptions: [{
46
+ allowImplicit: false
47
+ }],
46
48
 
47
49
  docs: {
48
50
  description: "Enforce `return` statements in getters",
@@ -25,7 +25,8 @@ module.exports = {
25
25
  defaultOptions: [{
26
26
  exceptionPatterns: [],
27
27
  exceptions: [],
28
- min: 2
28
+ min: 2,
29
+ properties: "always"
29
30
  }],
30
31
 
31
32
  docs: {
@@ -20,7 +20,12 @@ module.exports = {
20
20
  meta: {
21
21
  type: "suggestion",
22
22
 
23
- defaultOptions: ["^.+$", {}],
23
+ defaultOptions: ["^.+$", {
24
+ classFields: false,
25
+ ignoreDestructuring: false,
26
+ onlyDeclarations: false,
27
+ properties: false
28
+ }],
24
29
 
25
30
  docs: {
26
31
  description: "Require identifiers to match a specified regular expression",
@@ -118,7 +118,7 @@ module.exports = {
118
118
 
119
119
  create(context) {
120
120
  const [config] = context.options;
121
- const skipProperties = config.properties === false;
121
+ const skipProperties = !config.properties;
122
122
 
123
123
  const newIsCapExceptions = config.newIsCapExceptions.reduce(invert, {});
124
124
  const newIsCapExceptionPattern = config.newIsCapExceptionPattern ? new RegExp(config.newIsCapExceptionPattern, "u") : null;
@@ -25,7 +25,10 @@ module.exports = {
25
25
  meta: {
26
26
  type: "suggestion",
27
27
 
28
- defaultOptions: [{ allow: [] }],
28
+ defaultOptions: [{
29
+ allow: [],
30
+ int32Hint: false
31
+ }],
29
32
 
30
33
  docs: {
31
34
  description: "Disallow bitwise operators",
@@ -14,7 +14,7 @@ module.exports = {
14
14
  type: "problem",
15
15
 
16
16
  docs: {
17
- description: "Disallow comparing against -0",
17
+ description: "Disallow comparing against `-0`",
18
18
  recommended: true,
19
19
  url: "https://eslint.org/docs/latest/rules/no-compare-neg-zero"
20
20
  },
@@ -232,7 +232,9 @@ module.exports = {
232
232
  meta: {
233
233
  type: "problem",
234
234
 
235
- defaultOptions: [{}],
235
+ defaultOptions: [{
236
+ includeExports: false
237
+ }],
236
238
 
237
239
  docs: {
238
240
  description: "Disallow duplicate module imports",
@@ -15,7 +15,9 @@ module.exports = {
15
15
  meta: {
16
16
  type: "problem",
17
17
 
18
- defaultOptions: [{}],
18
+ defaultOptions: [{
19
+ allowObjectPatternsAsParameters: false
20
+ }],
19
21
 
20
22
  docs: {
21
23
  description: "Disallow empty destructuring patterns",
@@ -42,7 +42,9 @@ module.exports = {
42
42
  meta: {
43
43
  type: "suggestion",
44
44
 
45
- defaultOptions: [{}],
45
+ defaultOptions: [{
46
+ allowIndirect: false
47
+ }],
46
48
 
47
49
  docs: {
48
50
  description: "Disallow the use of `eval()`",
@@ -14,7 +14,9 @@ module.exports = {
14
14
  meta: {
15
15
  type: "suggestion",
16
16
 
17
- defaultOptions: [{}],
17
+ defaultOptions: [{
18
+ lexicalBindings: false
19
+ }],
18
20
 
19
21
  docs: {
20
22
  description: "Disallow declarations in the global scope",
@@ -47,7 +47,7 @@ module.exports = {
47
47
  meta: {
48
48
  type: "problem",
49
49
 
50
- defaultOptions: ["functions"],
50
+ defaultOptions: ["functions", { blockScopedFunctions: "allow" }],
51
51
 
52
52
  docs: {
53
53
  description: "Disallow variable or `function` declarations in nested blocks",
@@ -77,10 +77,10 @@ module.exports = {
77
77
 
78
78
  create(context) {
79
79
  const both = context.options[0] === "both";
80
+ const { blockScopedFunctions } = context.options[1];
80
81
 
81
82
  const sourceCode = context.sourceCode;
82
83
  const ecmaVersion = context.languageOptions.ecmaVersion;
83
- const blockScopedFunctions = context.options[1]?.blockScopedFunctions ?? "allow";
84
84
 
85
85
  /**
86
86
  * Ensure that a given node is at a program or function body's root.
@@ -15,7 +15,9 @@ module.exports = {
15
15
  meta: {
16
16
  type: "suggestion",
17
17
 
18
- defaultOptions: [{}],
18
+ defaultOptions: [{
19
+ ignoreNonDeclaration: false
20
+ }],
19
21
 
20
22
  docs: {
21
23
  description: "Disallow use of chained assignment expressions",
@@ -50,7 +50,9 @@ module.exports = {
50
50
  meta: {
51
51
  type: "suggestion",
52
52
 
53
- defaultOptions: [{}],
53
+ defaultOptions: [{
54
+ allowForLoopAfterthoughts: false
55
+ }],
54
56
 
55
57
  docs: {
56
58
  description: "Disallow the unary operators `++` and `--`",
@@ -141,7 +141,9 @@ module.exports = {
141
141
  meta: {
142
142
  type: "problem",
143
143
 
144
- defaultOptions: [{}],
144
+ defaultOptions: [{
145
+ allowVoid: false
146
+ }],
145
147
 
146
148
  docs: {
147
149
  description: "Disallow returning values from Promise executor functions",
@@ -31,7 +31,9 @@ module.exports = {
31
31
 
32
32
  defaultOptions: [{
33
33
  allow: [],
34
- hoist: "functions"
34
+ builtinGlobals: false,
35
+ hoist: "functions",
36
+ ignoreOnInitialization: false
35
37
  }],
36
38
 
37
39
  docs: {
@@ -45,7 +47,7 @@ module.exports = {
45
47
  type: "object",
46
48
  properties: {
47
49
  builtinGlobals: { type: "boolean" },
48
- hoist: { enum: ["all", "functions", "never"], default: "functions" },
50
+ hoist: { enum: ["all", "functions", "never"] },
49
51
  allow: {
50
52
  type: "array",
51
53
  items: {
@@ -28,7 +28,9 @@ module.exports = {
28
28
  meta: {
29
29
  type: "problem",
30
30
 
31
- defaultOptions: [{}],
31
+ defaultOptions: [{
32
+ typeof: false
33
+ }],
32
34
 
33
35
  docs: {
34
36
  description: "Disallow the use of undeclared variables unless mentioned in `/*global */` comments",
@@ -22,6 +22,7 @@ module.exports = {
22
22
  allowFunctionParams: true,
23
23
  allowInArrayDestructuring: true,
24
24
  allowInObjectDestructuring: true,
25
+ enforceInClassFields: false,
25
26
  enforceInMethodNames: false
26
27
  }],
27
28
 
@@ -51,7 +51,9 @@ module.exports = {
51
51
  meta: {
52
52
  type: "problem",
53
53
 
54
- defaultOptions: [{}],
54
+ defaultOptions: [{
55
+ enforceForOrderingRelations: false
56
+ }],
55
57
 
56
58
  docs: {
57
59
  description: "Disallow negating the left operand of relational operators",
@@ -23,7 +23,9 @@ module.exports = {
23
23
  meta: {
24
24
  type: "problem",
25
25
 
26
- defaultOptions: [{}],
26
+ defaultOptions: [{
27
+ disallowArithmeticOperators: false
28
+ }],
27
29
 
28
30
  docs: {
29
31
  description: "Disallow use of optional chaining in contexts where the `undefined` value is not allowed",
@@ -249,7 +249,8 @@ module.exports = {
249
249
  defaultOptions: [{
250
250
  classes: true,
251
251
  functions: true,
252
- variables: true
252
+ variables: true,
253
+ allowNamedExports: false
253
254
  }],
254
255
 
255
256
  messages: {
@@ -120,7 +120,7 @@ module.exports = {
120
120
  },
121
121
  create(context) {
122
122
  const sourceCode = context.sourceCode;
123
- const enforceForClassMembers = context.options[0]?.enforceForClassMembers ?? true;
123
+ const [{ enforceForClassMembers }] = context.options;
124
124
 
125
125
  /**
126
126
  * Reports a given node if it violated this rule.
@@ -20,7 +20,11 @@ module.exports = {
20
20
  meta: {
21
21
  type: "suggestion",
22
22
 
23
- defaultOptions: [{}],
23
+ defaultOptions: [{
24
+ ignoreDestructuring: false,
25
+ ignoreImport: false,
26
+ ignoreExport: false
27
+ }],
24
28
 
25
29
  docs: {
26
30
  description: "Disallow renaming import, export, and destructured assignments to the same name",
@@ -13,7 +13,9 @@ module.exports = {
13
13
  meta: {
14
14
  type: "suggestion",
15
15
 
16
- defaultOptions: [{}],
16
+ defaultOptions: [{
17
+ allowAsStatement: false
18
+ }],
17
19
 
18
20
  docs: {
19
21
  description: "Disallow `void` operators",
@@ -331,7 +331,10 @@ module.exports = {
331
331
  meta: {
332
332
  type: "suggestion",
333
333
 
334
- defaultOptions: [{ destructuring: "any" }],
334
+ defaultOptions: [{
335
+ destructuring: "any",
336
+ ignoreReadBeforeAssign: false
337
+ }],
335
338
 
336
339
  docs: {
337
340
  description: "Require `const` declarations for variables that are never reassigned after declared",
@@ -357,10 +360,9 @@ module.exports = {
357
360
  },
358
361
 
359
362
  create(context) {
360
- const [options] = context.options;
363
+ const [{ destructuring, ignoreReadBeforeAssign }] = context.options;
364
+ const shouldMatchAnyDestructuredVariable = destructuring !== "all";
361
365
  const sourceCode = context.sourceCode;
362
- const shouldMatchAnyDestructuredVariable = options.destructuring !== "all";
363
- const ignoreReadBeforeAssign = options.ignoreReadBeforeAssign === true;
364
366
  const variables = [];
365
367
  let reportCount = 0;
366
368
  let checkedId = null;
@@ -15,7 +15,9 @@ module.exports = {
15
15
  meta: {
16
16
  type: "suggestion",
17
17
 
18
- defaultOptions: [{}],
18
+ defaultOptions: [{
19
+ allowEmptyReject: false
20
+ }],
19
21
 
20
22
  docs: {
21
23
  description: "Require using Error objects as Promise rejection reasons",
@@ -112,7 +112,9 @@ module.exports = {
112
112
  meta: {
113
113
  type: "suggestion",
114
114
 
115
- defaultOptions: [{}],
115
+ defaultOptions: [{
116
+ disallowRedundantWrapping: false
117
+ }],
116
118
 
117
119
  docs: {
118
120
  description: "Disallow use of the `RegExp` constructor in favor of regular expression literals",
@@ -170,7 +170,9 @@ module.exports = {
170
170
  meta: {
171
171
  type: "problem",
172
172
 
173
- defaultOptions: [{}],
173
+ defaultOptions: [{
174
+ allowProperties: false
175
+ }],
174
176
 
175
177
  docs: {
176
178
  description: "Disallow assignments that can lead to race conditions due to usage of `await` or `yield`",
@@ -83,6 +83,7 @@ module.exports = {
83
83
  defaultOptions: ["asc", {
84
84
  allowLineSeparatedGroups: false,
85
85
  caseSensitive: true,
86
+ ignoreComputedKeys: false,
86
87
  minKeys: 2,
87
88
  natural: false
88
89
  }],
@@ -112,6 +113,9 @@ module.exports = {
112
113
  },
113
114
  allowLineSeparatedGroups: {
114
115
  type: "boolean"
116
+ },
117
+ ignoreComputedKeys: {
118
+ type: "boolean"
115
119
  }
116
120
  },
117
121
  additionalProperties: false
@@ -124,7 +128,7 @@ module.exports = {
124
128
  },
125
129
 
126
130
  create(context) {
127
- const [order, { caseSensitive, natural, minKeys, allowLineSeparatedGroups }] = context.options;
131
+ const [order, { caseSensitive, natural, minKeys, allowLineSeparatedGroups, ignoreComputedKeys }] = context.options;
128
132
  const insensitive = !caseSensitive;
129
133
  const isValidOrder = isValidOrders[
130
134
  order + (insensitive ? "I" : "") + (natural ? "N" : "")
@@ -160,6 +164,11 @@ module.exports = {
160
164
  return;
161
165
  }
162
166
 
167
+ if (ignoreComputedKeys && node.computed) {
168
+ stack.prevName = null; // reset sort
169
+ return;
170
+ }
171
+
163
172
  const prevName = stack.prevName;
164
173
  const numKeys = stack.numKeys;
165
174
  const thisName = getPropertyName(node);
@@ -14,7 +14,9 @@ module.exports = {
14
14
  meta: {
15
15
  type: "suggestion",
16
16
 
17
- defaultOptions: [{}],
17
+ defaultOptions: [{
18
+ ignoreCase: false
19
+ }],
18
20
 
19
21
  docs: {
20
22
  description: "Require variables within the same declaration block to be sorted",
@@ -27,8 +29,7 @@ module.exports = {
27
29
  type: "object",
28
30
  properties: {
29
31
  ignoreCase: {
30
- type: "boolean",
31
- default: false
32
+ type: "boolean"
32
33
  }
33
34
  },
34
35
  additionalProperties: false
@@ -84,8 +84,7 @@ module.exports = {
84
84
 
85
85
  create(context) {
86
86
 
87
- const enforceForSwitchCase = !context.options[0] || context.options[0].enforceForSwitchCase;
88
- const enforceForIndexOf = context.options[0] && context.options[0].enforceForIndexOf;
87
+ const [{ enforceForIndexOf, enforceForSwitchCase }] = context.options;
89
88
  const sourceCode = context.sourceCode;
90
89
 
91
90
  const fixableOperators = new Set(["==", "===", "!=", "!=="]);
@@ -19,7 +19,9 @@ module.exports = {
19
19
  meta: {
20
20
  type: "problem",
21
21
 
22
- defaultOptions: [{}],
22
+ defaultOptions: [{
23
+ requireStringLiterals: false
24
+ }],
23
25
 
24
26
  docs: {
25
27
  description: "Enforce comparing `typeof` expressions against valid strings",
@@ -34,8 +36,7 @@ module.exports = {
34
36
  type: "object",
35
37
  properties: {
36
38
  requireStringLiterals: {
37
- type: "boolean",
38
- default: false
39
+ type: "boolean"
39
40
  }
40
41
  },
41
42
  additionalProperties: false
@@ -1854,6 +1854,10 @@ export interface StylisticIssues extends Linter.RulesRecord {
1854
1854
  * @default false
1855
1855
  */
1856
1856
  allowLineSeparatedGroups: boolean;
1857
+ /**
1858
+ * @default false
1859
+ */
1860
+ ignoreComputedKeys: boolean;
1857
1861
  }>,
1858
1862
  ]
1859
1863
  >;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint",
3
- "version": "9.15.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",
@@ -102,7 +102,7 @@
102
102
  "@eslint/config-array": "^0.19.0",
103
103
  "@eslint/core": "^0.9.0",
104
104
  "@eslint/eslintrc": "^3.2.0",
105
- "@eslint/js": "9.15.0",
105
+ "@eslint/js": "9.16.0",
106
106
  "@eslint/plugin-kit": "^0.2.3",
107
107
  "@humanfs/node": "^0.16.6",
108
108
  "@humanwhocodes/module-importer": "^1.0.1",
@@ -133,10 +133,10 @@
133
133
  "optionator": "^0.9.3"
134
134
  },
135
135
  "devDependencies": {
136
- "@arethetypeswrong/cli": "^0.16.4",
136
+ "@arethetypeswrong/cli": "^0.17.0",
137
137
  "@babel/core": "^7.4.3",
138
138
  "@babel/preset-env": "^7.4.3",
139
- "@eslint/json": "^0.6.0",
139
+ "@eslint/json": "^0.8.0",
140
140
  "@trunkio/launcher": "^1.3.0",
141
141
  "@types/node": "^20.11.5",
142
142
  "@typescript-eslint/parser": "^8.4.0",