From d1360fcf489d0f77a1af8d14b544a38b25b90868 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Sat, 31 Jul 2021 08:18:34 +0200 Subject: [PATCH] tools: update ESLint to 7.32.0 PR-URL: https://github.com/nodejs/node/pull/39602 Reviewed-By: Colin Ihrig Reviewed-By: Shingo Inoue --- tools/node_modules/eslint/README.md | 10 ++++++++++ .../eslint/lib/cli-engine/cli-engine.js | 6 ++++++ tools/node_modules/eslint/lib/cli.js | 13 +++++++++++-- tools/node_modules/eslint/lib/options.js | 6 ++++++ tools/node_modules/eslint/lib/rules/comma-style.js | 2 ++ tools/node_modules/eslint/lib/rules/curly.js | 13 ++----------- .../@babel/helper-validator-identifier/package.json | 2 +- .../eslint/node_modules/chalk/package.json | 2 +- .../eslint/node_modules/chalk/readme.md | 8 +++++++- .../eslint/node_modules/flatted/package.json | 2 +- tools/node_modules/eslint/package.json | 4 ++-- 11 files changed, 49 insertions(+), 19 deletions(-) diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 68982812e3b026..804310d8c1fb26 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -254,6 +254,16 @@ Toru Nagashima The people who review and fix bugs and help triage issues.
+ +
+Brett Zamir +
+
+ +
+Bryan Mishkin +
+

Pig Fang diff --git a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js index ca298f9c356c3c..24f6a10d14b609 100644 --- a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js +++ b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js @@ -156,6 +156,9 @@ function calculateStatsPerFile(messages) { return messages.reduce((stat, message) => { if (message.fatal || message.severity === 2) { stat.errorCount++; + if (message.fatal) { + stat.fatalErrorCount++; + } if (message.fix) { stat.fixableErrorCount++; } @@ -168,6 +171,7 @@ function calculateStatsPerFile(messages) { return stat; }, { errorCount: 0, + fatalErrorCount: 0, warningCount: 0, fixableErrorCount: 0, fixableWarningCount: 0 @@ -183,12 +187,14 @@ function calculateStatsPerFile(messages) { function calculateStatsPerRun(results) { return results.reduce((stat, result) => { stat.errorCount += result.errorCount; + stat.fatalErrorCount += result.fatalErrorCount; stat.warningCount += result.warningCount; stat.fixableErrorCount += result.fixableErrorCount; stat.fixableWarningCount += result.fixableWarningCount; return stat; }, { errorCount: 0, + fatalErrorCount: 0, warningCount: 0, fixableErrorCount: 0, fixableWarningCount: 0 diff --git a/tools/node_modules/eslint/lib/cli.js b/tools/node_modules/eslint/lib/cli.js index f766764546cc5a..477310da5850e7 100644 --- a/tools/node_modules/eslint/lib/cli.js +++ b/tools/node_modules/eslint/lib/cli.js @@ -131,14 +131,16 @@ function translateOptions({ */ function countErrors(results) { let errorCount = 0; + let fatalErrorCount = 0; let warningCount = 0; for (const result of results) { errorCount += result.errorCount; + fatalErrorCount += result.fatalErrorCount; warningCount += result.warningCount; } - return { errorCount, warningCount }; + return { errorCount, fatalErrorCount, warningCount }; } /** @@ -314,9 +316,12 @@ const cli = { if (await printResults(engine, resultsToPrint, options.format, options.outputFile)) { // Errors and warnings from the original unfiltered results should determine the exit code - const { errorCount, warningCount } = countErrors(results); + const { errorCount, fatalErrorCount, warningCount } = countErrors(results); + const tooManyWarnings = options.maxWarnings >= 0 && warningCount > options.maxWarnings; + const shouldExitForFatalErrors = + options.exitOnFatalError && fatalErrorCount > 0; if (!errorCount && tooManyWarnings) { log.error( @@ -325,6 +330,10 @@ const cli = { ); } + if (shouldExitForFatalErrors) { + return 2; + } + return (errorCount || tooManyWarnings) ? 1 : 0; } diff --git a/tools/node_modules/eslint/lib/options.js b/tools/node_modules/eslint/lib/options.js index 92c140bd3c8b2e..e3661ec81d528f 100644 --- a/tools/node_modules/eslint/lib/options.js +++ b/tools/node_modules/eslint/lib/options.js @@ -290,6 +290,12 @@ module.exports = optionator({ default: "true", description: "Prevent errors when pattern is unmatched" }, + { + option: "exit-on-fatal-error", + type: "Boolean", + default: "false", + description: "Exit with exit code 2 in case of fatal error" + }, { option: "debug", type: "Boolean", diff --git a/tools/node_modules/eslint/lib/rules/comma-style.js b/tools/node_modules/eslint/lib/rules/comma-style.js index fbdecccaac2589..824ad89b2f9964 100644 --- a/tools/node_modules/eslint/lib/rules/comma-style.js +++ b/tools/node_modules/eslint/lib/rules/comma-style.js @@ -216,6 +216,8 @@ module.exports = { previousItemToken = tokenAfterItem ? sourceCode.getTokenBefore(tokenAfterItem) : sourceCode.ast.tokens[sourceCode.ast.tokens.length - 1]; + } else { + previousItemToken = currentItemToken; } }); diff --git a/tools/node_modules/eslint/lib/rules/curly.js b/tools/node_modules/eslint/lib/rules/curly.js index 92d31a6476e435..61dcd8024bbd2c 100644 --- a/tools/node_modules/eslint/lib/rules/curly.js +++ b/tools/node_modules/eslint/lib/rules/curly.js @@ -131,15 +131,6 @@ module.exports = { return token.value === "else" && token.type === "Keyword"; } - /** - * Gets the `else` keyword token of a given `IfStatement` node. - * @param {ASTNode} node A `IfStatement` node to get. - * @returns {Token} The `else` keyword token. - */ - function getElseKeyword(node) { - return node.alternate && sourceCode.getFirstTokenBetween(node.consequent, node.alternate, isElseKeywordToken); - } - /** * Determines whether the given node has an `else` keyword token as the first token after. * @param {ASTNode} node The node to check. @@ -361,7 +352,7 @@ module.exports = { if (this.expected) { context.report({ node, - loc: (name !== "else" ? node : getElseKeyword(node)).loc.start, + loc: body.loc, messageId: opts && opts.condition ? "missingCurlyAfterCondition" : "missingCurlyAfter", data: { name @@ -371,7 +362,7 @@ module.exports = { } else { context.report({ node, - loc: (name !== "else" ? node : getElseKeyword(node)).loc.start, + loc: body.loc, messageId: opts && opts.condition ? "unexpectedCurlyAfterCondition" : "unexpectedCurlyAfter", data: { name diff --git a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json index 80b8c9aeafd6a9..cf138d6f2c3b7c 100644 --- a/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json +++ b/tools/node_modules/eslint/node_modules/@babel/helper-validator-identifier/package.json @@ -1,6 +1,6 @@ { "name": "@babel/helper-validator-identifier", - "version": "7.14.5", + "version": "7.14.8", "description": "Validate identifier/keywords name", "repository": { "type": "git", diff --git a/tools/node_modules/eslint/node_modules/chalk/package.json b/tools/node_modules/eslint/node_modules/chalk/package.json index c2d63f67e5e955..47c23f29068caa 100644 --- a/tools/node_modules/eslint/node_modules/chalk/package.json +++ b/tools/node_modules/eslint/node_modules/chalk/package.json @@ -1,6 +1,6 @@ { "name": "chalk", - "version": "4.1.1", + "version": "4.1.2", "description": "Terminal string styling done right", "license": "MIT", "repository": "chalk/chalk", diff --git a/tools/node_modules/eslint/node_modules/chalk/readme.md b/tools/node_modules/eslint/node_modules/chalk/readme.md index 851259216bc193..a055d21c97ed76 100644 --- a/tools/node_modules/eslint/node_modules/chalk/readme.md +++ b/tools/node_modules/eslint/node_modules/chalk/readme.md @@ -33,7 +33,7 @@

- +

@@ -48,6 +48,12 @@ and avoiding access controls. Keep your team and servers in sync with Doppler. +
+ +
+ UI Bakery +
+

diff --git a/tools/node_modules/eslint/node_modules/flatted/package.json b/tools/node_modules/eslint/node_modules/flatted/package.json index 405ccfd799b098..60f79eb7304267 100644 --- a/tools/node_modules/eslint/node_modules/flatted/package.json +++ b/tools/node_modules/eslint/node_modules/flatted/package.json @@ -1,6 +1,6 @@ { "name": "flatted", - "version": "3.2.1", + "version": "3.2.2", "description": "A super light and fast circular JSON parser.", "unpkg": "min.js", "types": "types.d.ts", diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 0e64b624b966e6..1845500824c9e5 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -1,6 +1,6 @@ { "name": "eslint", - "version": "7.31.0", + "version": "7.32.0", "author": "Nicholas C. Zakas ", "description": "An AST-based pattern checker for JavaScript.", "bin": { @@ -96,7 +96,7 @@ "ejs": "^3.0.2", "eslint": "file:.", "eslint-config-eslint": "file:packages/eslint-config-eslint", - "eslint-plugin-eslint-plugin": "^3.2.0", + "eslint-plugin-eslint-plugin": "^3.5.3", "eslint-plugin-internal-rules": "file:tools/internal-rules", "eslint-plugin-jsdoc": "^25.4.3", "eslint-plugin-node": "^11.1.0",