eslint 7.31.0 → 7.32.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.
- package/CHANGELOG.md +16 -0
- package/README.md +10 -0
- package/lib/cli-engine/cli-engine.js +6 -0
- package/lib/cli.js +11 -2
- package/lib/options.js +6 -0
- package/lib/rules/comma-style.js +2 -0
- package/lib/rules/curly.js +2 -11
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
v7.32.0 - July 30, 2021
|
2
|
+
|
3
|
+
* [`3c78a7b`](https://github.com/eslint/eslint/commit/3c78a7bff6044fd196ae3b737983e6744c6eb7c8) Chore: Adopt `eslint-plugin/prefer-message-ids` rule internally (#14841) (Bryan Mishkin)
|
4
|
+
* [`faecf56`](https://github.com/eslint/eslint/commit/faecf56cdb4146b28bfa4f1980adb41b4d3614b1) Update: change reporting location for `curly` rule (refs #12334) (#14766) (Nitin Kumar)
|
5
|
+
* [`d7dc07a`](https://github.com/eslint/eslint/commit/d7dc07a15e256cee9232183165e2f6102f2c0873) Fix: ignore lines with empty elements (fixes #12756) (#14837) (Soufiane Boutahlil)
|
6
|
+
* [`1bfbefd`](https://github.com/eslint/eslint/commit/1bfbefdaaf19ef32df42b89a3f5d32cff1e5b831) New: Exit on fatal error (fixes #13711) (#14730) (Antonios Katopodis)
|
7
|
+
* [`ed007c8`](https://github.com/eslint/eslint/commit/ed007c82ee9d2170c87500d98303554b5f90b915) Chore: Simplify internal `no-invalid-meta` rule (#14842) (Bryan Mishkin)
|
8
|
+
* [`d53d906`](https://github.com/eslint/eslint/commit/d53d9064b9dd0dd6a8ea39e07b16310c8364db69) Docs: Prepare data for website to indicate rules with suggestions (#14830) (Bryan Mishkin)
|
9
|
+
* [`d28f2ff`](https://github.com/eslint/eslint/commit/d28f2ffb986e49d6da5c1d91215580591f4cfd35) Docs: Reference eslint-config-eslint to avoid potential for staleness (#14805) (Brett Zamir)
|
10
|
+
* [`8be8a36`](https://github.com/eslint/eslint/commit/8be8a36010145dfcd31cbdd4f781a91989e3b1bd) Chore: Adopt `eslint-plugin/require-meta-docs-url` rule internally (#14823) (Bryan Mishkin)
|
11
|
+
* [`f9c164f`](https://github.com/eslint/eslint/commit/f9c164f7b74ca73384c8c80eed5bdbe359b44f6c) Docs: New syntax issue template (#14826) (Nicholas C. Zakas)
|
12
|
+
* [`eba0c45`](https://github.com/eslint/eslint/commit/eba0c4595c126a91f700d5f2e8723ec3f820a830) Chore: assertions on reporting loc in `unicode-bom` (refs #12334) (#14809) (Nitin Kumar)
|
13
|
+
* [`ed945bd`](https://github.com/eslint/eslint/commit/ed945bd662714b1917e9de71d5b322a28be9161b) Docs: fix multiple broken links (#14833) (Sam Chen)
|
14
|
+
* [`60df44c`](https://github.com/eslint/eslint/commit/60df44c79b0f74406119c0c040a360ca84e721fc) Chore: use `actions/setup-node@v2` (#14816) (Nitin Kumar)
|
15
|
+
* [`6641d88`](https://github.com/eslint/eslint/commit/6641d88e17d952a8e51df5e0d3882a842d4c3f35) Docs: Update README team and sponsors (ESLint Jenkins)
|
16
|
+
|
1
17
|
v7.31.0 - July 17, 2021
|
2
18
|
|
3
19
|
* [`efdbb12`](https://github.com/eslint/eslint/commit/efdbb1227019427ec2d968a8d6e9151dd8a77c35) Upgrade: @eslint/eslintrc to v0.4.3 (#14808) (Brandon Mills)
|
package/README.md
CHANGED
@@ -254,6 +254,16 @@ Toru Nagashima
|
|
254
254
|
The people who review and fix bugs and help triage issues.
|
255
255
|
|
256
256
|
<table><tbody><tr><td align="center" valign="top" width="11%">
|
257
|
+
<a href="https://github.com/brettz9">
|
258
|
+
<img src="https://github.com/brettz9.png?s=75" width="75" height="75"><br />
|
259
|
+
Brett Zamir
|
260
|
+
</a>
|
261
|
+
</td><td align="center" valign="top" width="11%">
|
262
|
+
<a href="https://github.com/bmish">
|
263
|
+
<img src="https://github.com/bmish.png?s=75" width="75" height="75"><br />
|
264
|
+
Bryan Mishkin
|
265
|
+
</a>
|
266
|
+
</td><td align="center" valign="top" width="11%">
|
257
267
|
<a href="https://github.com/g-plane">
|
258
268
|
<img src="https://github.com/g-plane.png?s=75" width="75" height="75"><br />
|
259
269
|
Pig Fang
|
@@ -156,6 +156,9 @@ function calculateStatsPerFile(messages) {
|
|
156
156
|
return messages.reduce((stat, message) => {
|
157
157
|
if (message.fatal || message.severity === 2) {
|
158
158
|
stat.errorCount++;
|
159
|
+
if (message.fatal) {
|
160
|
+
stat.fatalErrorCount++;
|
161
|
+
}
|
159
162
|
if (message.fix) {
|
160
163
|
stat.fixableErrorCount++;
|
161
164
|
}
|
@@ -168,6 +171,7 @@ function calculateStatsPerFile(messages) {
|
|
168
171
|
return stat;
|
169
172
|
}, {
|
170
173
|
errorCount: 0,
|
174
|
+
fatalErrorCount: 0,
|
171
175
|
warningCount: 0,
|
172
176
|
fixableErrorCount: 0,
|
173
177
|
fixableWarningCount: 0
|
@@ -183,12 +187,14 @@ function calculateStatsPerFile(messages) {
|
|
183
187
|
function calculateStatsPerRun(results) {
|
184
188
|
return results.reduce((stat, result) => {
|
185
189
|
stat.errorCount += result.errorCount;
|
190
|
+
stat.fatalErrorCount += result.fatalErrorCount;
|
186
191
|
stat.warningCount += result.warningCount;
|
187
192
|
stat.fixableErrorCount += result.fixableErrorCount;
|
188
193
|
stat.fixableWarningCount += result.fixableWarningCount;
|
189
194
|
return stat;
|
190
195
|
}, {
|
191
196
|
errorCount: 0,
|
197
|
+
fatalErrorCount: 0,
|
192
198
|
warningCount: 0,
|
193
199
|
fixableErrorCount: 0,
|
194
200
|
fixableWarningCount: 0
|
package/lib/cli.js
CHANGED
@@ -131,14 +131,16 @@ function translateOptions({
|
|
131
131
|
*/
|
132
132
|
function countErrors(results) {
|
133
133
|
let errorCount = 0;
|
134
|
+
let fatalErrorCount = 0;
|
134
135
|
let warningCount = 0;
|
135
136
|
|
136
137
|
for (const result of results) {
|
137
138
|
errorCount += result.errorCount;
|
139
|
+
fatalErrorCount += result.fatalErrorCount;
|
138
140
|
warningCount += result.warningCount;
|
139
141
|
}
|
140
142
|
|
141
|
-
return { errorCount, warningCount };
|
143
|
+
return { errorCount, fatalErrorCount, warningCount };
|
142
144
|
}
|
143
145
|
|
144
146
|
/**
|
@@ -314,9 +316,12 @@ const cli = {
|
|
314
316
|
if (await printResults(engine, resultsToPrint, options.format, options.outputFile)) {
|
315
317
|
|
316
318
|
// Errors and warnings from the original unfiltered results should determine the exit code
|
317
|
-
const { errorCount, warningCount } = countErrors(results);
|
319
|
+
const { errorCount, fatalErrorCount, warningCount } = countErrors(results);
|
320
|
+
|
318
321
|
const tooManyWarnings =
|
319
322
|
options.maxWarnings >= 0 && warningCount > options.maxWarnings;
|
323
|
+
const shouldExitForFatalErrors =
|
324
|
+
options.exitOnFatalError && fatalErrorCount > 0;
|
320
325
|
|
321
326
|
if (!errorCount && tooManyWarnings) {
|
322
327
|
log.error(
|
@@ -325,6 +330,10 @@ const cli = {
|
|
325
330
|
);
|
326
331
|
}
|
327
332
|
|
333
|
+
if (shouldExitForFatalErrors) {
|
334
|
+
return 2;
|
335
|
+
}
|
336
|
+
|
328
337
|
return (errorCount || tooManyWarnings) ? 1 : 0;
|
329
338
|
}
|
330
339
|
|
package/lib/options.js
CHANGED
@@ -290,6 +290,12 @@ module.exports = optionator({
|
|
290
290
|
default: "true",
|
291
291
|
description: "Prevent errors when pattern is unmatched"
|
292
292
|
},
|
293
|
+
{
|
294
|
+
option: "exit-on-fatal-error",
|
295
|
+
type: "Boolean",
|
296
|
+
default: "false",
|
297
|
+
description: "Exit with exit code 2 in case of fatal error"
|
298
|
+
},
|
293
299
|
{
|
294
300
|
option: "debug",
|
295
301
|
type: "Boolean",
|
package/lib/rules/comma-style.js
CHANGED
package/lib/rules/curly.js
CHANGED
@@ -131,15 +131,6 @@ module.exports = {
|
|
131
131
|
return token.value === "else" && token.type === "Keyword";
|
132
132
|
}
|
133
133
|
|
134
|
-
/**
|
135
|
-
* Gets the `else` keyword token of a given `IfStatement` node.
|
136
|
-
* @param {ASTNode} node A `IfStatement` node to get.
|
137
|
-
* @returns {Token} The `else` keyword token.
|
138
|
-
*/
|
139
|
-
function getElseKeyword(node) {
|
140
|
-
return node.alternate && sourceCode.getFirstTokenBetween(node.consequent, node.alternate, isElseKeywordToken);
|
141
|
-
}
|
142
|
-
|
143
134
|
/**
|
144
135
|
* Determines whether the given node has an `else` keyword token as the first token after.
|
145
136
|
* @param {ASTNode} node The node to check.
|
@@ -361,7 +352,7 @@ module.exports = {
|
|
361
352
|
if (this.expected) {
|
362
353
|
context.report({
|
363
354
|
node,
|
364
|
-
loc:
|
355
|
+
loc: body.loc,
|
365
356
|
messageId: opts && opts.condition ? "missingCurlyAfterCondition" : "missingCurlyAfter",
|
366
357
|
data: {
|
367
358
|
name
|
@@ -371,7 +362,7 @@ module.exports = {
|
|
371
362
|
} else {
|
372
363
|
context.report({
|
373
364
|
node,
|
374
|
-
loc:
|
365
|
+
loc: body.loc,
|
375
366
|
messageId: opts && opts.condition ? "unexpectedCurlyAfterCondition" : "unexpectedCurlyAfter",
|
376
367
|
data: {
|
377
368
|
name
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.32.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"bin": {
|
@@ -96,7 +96,7 @@
|
|
96
96
|
"ejs": "^3.0.2",
|
97
97
|
"eslint": "file:.",
|
98
98
|
"eslint-config-eslint": "file:packages/eslint-config-eslint",
|
99
|
-
"eslint-plugin-eslint-plugin": "^3.
|
99
|
+
"eslint-plugin-eslint-plugin": "^3.5.3",
|
100
100
|
"eslint-plugin-internal-rules": "file:tools/internal-rules",
|
101
101
|
"eslint-plugin-jsdoc": "^25.4.3",
|
102
102
|
"eslint-plugin-node": "^11.1.0",
|