From 72f357a670110e6d531ed7fec30d23e62d71bdbf Mon Sep 17 00:00:00 2001 From: cjihrig Date: Fri, 31 Jul 2020 20:05:21 -0400 Subject: [PATCH] tools: update ESLint to 7.6.0 Update ESLint to 7.6.0 PR-URL: https://github.com/nodejs/node/pull/34589 Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat Reviewed-By: Luigi Pinca --- tools/node_modules/eslint/README.md | 4 +-- .../lib/cli-engine/formatters/checkstyle.js | 4 +-- .../eslint/lib/rule-tester/rule-tester.js | 10 +++++++ .../eslint/lib/rules/no-duplicate-case.js | 27 ++++++++++++++++--- .../eslint/messages/extend-config-missing.txt | 2 +- .../eslint/messages/no-config-found.txt | 2 +- .../eslint/messages/plugin-conflict.txt | 2 +- .../eslint/messages/plugin-missing.txt | 2 +- .../eslint/messages/whitespace-found.txt | 2 +- tools/node_modules/eslint/package.json | 2 +- 10 files changed, 43 insertions(+), 14 deletions(-) diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index c8d72542687..998a961bbb1 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -121,7 +121,7 @@ Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [confi ### What ECMAScript versions does ESLint support? -ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, and 2019. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring). +ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, and 2020. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring). ### What about experimental features? @@ -251,7 +251,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Gold Sponsors

Shopify Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

Bruce EduBirdie CasinoTop.com Casino Topp Writers Per Hour Anagram Solver vpn netflix Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Bugsnag Stability Monitoring Mixpanel VPS Server Free Icons by Icons8 Discord ThemeIsle TekHattan Marfeel Fire Stick Tricks

+

Veikkaajat.com Nettikasinot.media My True Media Norgekasino Japanesecasino Bruce EduBirdie CasinoTop.com Casino Topp Writers Per Hour Anagram Solver Kasinot.fi Pelisivut Nettikasinot.org BonusFinder Deutschland Bugsnag Stability Monitoring Mixpanel VPS Server Icons8: free icons, photos, illustrations, and music Discord ThemeIsle Marfeel Fire Stick Tricks

## Technology Sponsors diff --git a/tools/node_modules/eslint/lib/cli-engine/formatters/checkstyle.js b/tools/node_modules/eslint/lib/cli-engine/formatters/checkstyle.js index ba4d1b5b3ec..f19b6fc0957 100644 --- a/tools/node_modules/eslint/lib/cli-engine/formatters/checkstyle.js +++ b/tools/node_modules/eslint/lib/cli-engine/formatters/checkstyle.js @@ -42,8 +42,8 @@ module.exports = function(results) { messages.forEach(message => { output += [ - `` diff --git a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js index 77df1def893..d1fcbca5ba0 100644 --- a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js +++ b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js @@ -852,6 +852,16 @@ class RuleTester { ); } + // Rules that produce fixes must have `meta.fixable` property. + if (result.output !== item.code) { + assert.ok( + hasOwnProperty(rule, "meta"), + "Fixable rules should export a `meta.fixable` property." + ); + + // Linter throws if a rule that produced a fix has `meta` but doesn't have `meta.fixable`. + } + assertASTDidntChange(result.beforeAST, result.afterAST); } diff --git a/tools/node_modules/eslint/lib/rules/no-duplicate-case.js b/tools/node_modules/eslint/lib/rules/no-duplicate-case.js index c8a0fa9da3c..e2d9665e7f5 100644 --- a/tools/node_modules/eslint/lib/rules/no-duplicate-case.js +++ b/tools/node_modules/eslint/lib/rules/no-duplicate-case.js @@ -6,6 +6,12 @@ "use strict"; +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = require("./utils/ast-utils"); + //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -31,18 +37,31 @@ module.exports = { create(context) { const sourceCode = context.getSourceCode(); + /** + * Determines whether the two given nodes are considered to be equal. + * @param {ASTNode} a First node. + * @param {ASTNode} b Second node. + * @returns {boolean} `true` if the nodes are considered to be equal. + */ + function equal(a, b) { + if (a.type !== b.type) { + return false; + } + + return astUtils.equalTokens(a, b, sourceCode); + } return { SwitchStatement(node) { - const previousKeys = new Set(); + const previousTests = []; for (const switchCase of node.cases) { if (switchCase.test) { - const key = sourceCode.getText(switchCase.test); + const test = switchCase.test; - if (previousKeys.has(key)) { + if (previousTests.some(previousTest => equal(previousTest, test))) { context.report({ node: switchCase, messageId: "unexpected" }); } else { - previousKeys.add(key); + previousTests.push(test); } } } diff --git a/tools/node_modules/eslint/messages/extend-config-missing.txt b/tools/node_modules/eslint/messages/extend-config-missing.txt index f7c5f71ebe3..4defd7ac4d1 100644 --- a/tools/node_modules/eslint/messages/extend-config-missing.txt +++ b/tools/node_modules/eslint/messages/extend-config-missing.txt @@ -2,4 +2,4 @@ ESLint couldn't find the config "<%- configName %>" to extend from. Please check The config "<%- configName %>" was referenced from the config file in "<%- importerName %>". -If you still have problems, please stop by https://eslint.org/chat to chat with the team. +If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. diff --git a/tools/node_modules/eslint/messages/no-config-found.txt b/tools/node_modules/eslint/messages/no-config-found.txt index f1f7beb63b1..b46a7e5a7a6 100644 --- a/tools/node_modules/eslint/messages/no-config-found.txt +++ b/tools/node_modules/eslint/messages/no-config-found.txt @@ -4,4 +4,4 @@ ESLint couldn't find a configuration file. To set up a configuration file for th ESLint looked for configuration files in <%= directoryPath %> and its ancestors. If it found none, it then looked in your home directory. -If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://eslint.org/chat +If you think you already have a configuration file or if you need more help, please stop by the ESLint chat room: https://eslint.org/chat/help diff --git a/tools/node_modules/eslint/messages/plugin-conflict.txt b/tools/node_modules/eslint/messages/plugin-conflict.txt index f8b60631c58..3ab4b340ef2 100644 --- a/tools/node_modules/eslint/messages/plugin-conflict.txt +++ b/tools/node_modules/eslint/messages/plugin-conflict.txt @@ -4,4 +4,4 @@ ESLint couldn't determine the plugin "<%- pluginId %>" uniquely. Please remove the "plugins" setting from either config or remove either plugin installation. -If you still can't figure out the problem, please stop by https://eslint.org/chat to chat with the team. +If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. diff --git a/tools/node_modules/eslint/messages/plugin-missing.txt b/tools/node_modules/eslint/messages/plugin-missing.txt index 3d376733085..aa25f59ac44 100644 --- a/tools/node_modules/eslint/messages/plugin-missing.txt +++ b/tools/node_modules/eslint/messages/plugin-missing.txt @@ -8,4 +8,4 @@ It's likely that the plugin isn't installed correctly. Try reinstalling by runni The plugin "<%- pluginName %>" was referenced from the config file in "<%- importerName %>". -If you still can't figure out the problem, please stop by https://eslint.org/chat to chat with the team. +If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. diff --git a/tools/node_modules/eslint/messages/whitespace-found.txt b/tools/node_modules/eslint/messages/whitespace-found.txt index 7d72149a8fd..3eed1af5866 100644 --- a/tools/node_modules/eslint/messages/whitespace-found.txt +++ b/tools/node_modules/eslint/messages/whitespace-found.txt @@ -1,3 +1,3 @@ ESLint couldn't find the plugin "<%- pluginName %>". because there is whitespace in the name. Please check your configuration and remove all whitespace from the plugin name. -If you still can't figure out the problem, please stop by https://eslint.org/chat to chat with the team. +If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team. diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 193a95c950b..a0b031f6e9b 100644 --- a/tools/node_modules/eslint/package.json +++ b/tools/node_modules/eslint/package.json @@ -153,5 +153,5 @@ "test:cli": "mocha", "webpack": "node Makefile.js webpack" }, - "version": "7.5.0" + "version": "7.6.0" } \ No newline at end of file