From 2b3eb101b57ff99cb1e3917dfe6f3064a37ea220 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Sat, 12 Sep 2020 18:54:43 -0400 Subject: [PATCH] tools: update ESLint to 7.9.0 Update ESLint to 7.9.0 PR-URL: https://github.com/nodejs/node/pull/35170 Reviewed-By: Rich Trott Reviewed-By: Trivikram Kamat --- tools/node_modules/eslint/README.md | 2 +- .../lib/cli-engine/config-array-factory.js | 16 +++++++++++----- tools/node_modules/eslint/lib/rules/id-length.js | 9 ++------- .../eslint/lib/rules/prefer-destructuring.js | 5 +++++ .../eslint/lib/rules/utils/ast-utils.js | 4 +++- .../eslint/messages/plugin-invalid.txt | 8 ++++++++ .../eslint/node_modules/acorn-jsx/index.js | 2 +- .../eslint/node_modules/acorn-jsx/package.json | 6 +++--- .../node_modules/eslint-scope/lib/scope.js | 2 +- .../node_modules/eslint-scope/package.json | 4 ++-- tools/node_modules/eslint/package.json | 2 +- 11 files changed, 38 insertions(+), 22 deletions(-) create mode 100644 tools/node_modules/eslint/messages/plugin-invalid.txt diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 73abcfe0d172b4..f5081d2f791c6a 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -266,7 +266,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Gold Sponsors

Salesforce Airbnb Microsoft FOSS Fund Sponsorships

Silver Sponsors

Liftoff AMP Project

Bronze Sponsors

-

Veikkaajat.com Nettikasinot.media My True Media Norgekasino Japanesecasino 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

+

Buy.Fineproxy.Org Veikkaajat.com Nettikasinot.media My True Media Norgekasino Japanesecasino CasinoTop.com Casino Topp 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/config-array-factory.js b/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js index e81494ed86ab5c..2c7a79b491ecb3 100644 --- a/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js +++ b/tools/node_modules/eslint/lib/cli-engine/config-array-factory.js @@ -286,14 +286,15 @@ function loadESLintIgnoreFile(filePath) { * Creates an error to notify about a missing config to extend from. * @param {string} configName The name of the missing config. * @param {string} importerName The name of the config that imported the missing config + * @param {string} messageTemplate The text template to source error strings from. * @returns {Error} The error object to throw * @private */ -function configMissingError(configName, importerName) { +function configInvalidError(configName, importerName, messageTemplate) { return Object.assign( new Error(`Failed to load config "${configName}" to extend from.`), { - messageTemplate: "extend-config-missing", + messageTemplate, messageData: { configName, importerName } } ); @@ -802,7 +803,7 @@ class ConfigArrayFactory { }); } - throw configMissingError(extendName, ctx.name); + throw configInvalidError(extendName, ctx.name, "extend-config-missing"); } /** @@ -814,6 +815,11 @@ class ConfigArrayFactory { */ _loadExtendedPluginConfig(extendName, ctx) { const slashIndex = extendName.lastIndexOf("/"); + + if (slashIndex === -1) { + throw configInvalidError(extendName, ctx.filePath, "plugin-invalid"); + } + const pluginName = extendName.slice("plugin:".length, slashIndex); const configName = extendName.slice(slashIndex + 1); @@ -834,7 +840,7 @@ class ConfigArrayFactory { }); } - throw plugin.error || configMissingError(extendName, ctx.filePath); + throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing"); } /** @@ -867,7 +873,7 @@ class ConfigArrayFactory { } catch (error) { /* istanbul ignore else */ if (error && error.code === "MODULE_NOT_FOUND") { - throw configMissingError(extendName, ctx.filePath); + throw configInvalidError(extendName, ctx.filePath, "extend-config-missing"); } throw error; } diff --git a/tools/node_modules/eslint/lib/rules/id-length.js b/tools/node_modules/eslint/lib/rules/id-length.js index b97f32b97876cd..4df081ff9fe4f8 100644 --- a/tools/node_modules/eslint/lib/rules/id-length.js +++ b/tools/node_modules/eslint/lib/rules/id-length.js @@ -64,12 +64,7 @@ module.exports = { const minLength = typeof options.min !== "undefined" ? options.min : 2; const maxLength = typeof options.max !== "undefined" ? options.max : Infinity; const properties = options.properties !== "never"; - const exceptions = (options.exceptions ? options.exceptions : []) - .reduce((obj, item) => { - obj[item] = true; - - return obj; - }, {}); + const exceptions = new Set(options.exceptions); const exceptionPatterns = (options.exceptionPatterns || []).map(pattern => new RegExp(pattern, "u")); const reportedNode = new Set(); @@ -130,7 +125,7 @@ module.exports = { const isShort = name.length < minLength; const isLong = name.length > maxLength; - if (!(isShort || isLong) || exceptions[name] || matchesExceptionPattern(name)) { + if (!(isShort || isLong) || exceptions.has(name) || matchesExceptionPattern(name)) { return; // Nothing to report } diff --git a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js index 1a51956dde53ff..d3314dc7e0de77 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-destructuring.js +++ b/tools/node_modules/eslint/lib/rules/prefer-destructuring.js @@ -178,6 +178,11 @@ module.exports = { const rightNode = node.init; const sourceCode = context.getSourceCode(); + // Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved. + if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(rightNode.object).length) { + return null; + } + return fixer.replaceText( node, `{${rightNode.property.name}} = ${sourceCode.getText(rightNode.object)}` diff --git a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js index 6a42ce3686f597..fb8beb25211ee7 100644 --- a/tools/node_modules/eslint/lib/rules/utils/ast-utils.js +++ b/tools/node_modules/eslint/lib/rules/utils/ast-utils.js @@ -37,7 +37,7 @@ const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]); // A set of node types that can contain a list of statements const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]); -const DECIMAL_INTEGER_PATTERN = /^(0|[1-9](?:_?\d)*)$/u; +const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u; const OCTAL_ESCAPE_PATTERN = /^(?:[^\\]|\\[^0-7]|\\0(?![0-9]))*\\(?:[1-7]|0[0-9])/u; const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]); @@ -1244,6 +1244,8 @@ module.exports = { * 50 // true * 5_000 // true * 1_234_56 // true + * 08 // true + * 0192 // true * 5. // false * .5 // false * 5.0 // false diff --git a/tools/node_modules/eslint/messages/plugin-invalid.txt b/tools/node_modules/eslint/messages/plugin-invalid.txt new file mode 100644 index 00000000000000..3ee251821bef27 --- /dev/null +++ b/tools/node_modules/eslint/messages/plugin-invalid.txt @@ -0,0 +1,8 @@ +"<%- configName %>" is invalid syntax for a config specifier. + +* If your intention is to extend from a configuration exported from the plugin, add the configuration name after a slash: e.g. "<%- configName %>/myConfig". +* If this is the name of a shareable config instead of a plugin, remove the "plugin:" prefix: i.e. "<%- configName.slice("plugin:".length) %>". + +"<%- configName %>" was referenced from the config file in "<%- importerName %>". + +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/node_modules/acorn-jsx/index.js b/tools/node_modules/eslint/node_modules/acorn-jsx/index.js index 0ff263c5adae03..004e0809024006 100644 --- a/tools/node_modules/eslint/node_modules/acorn-jsx/index.js +++ b/tools/node_modules/eslint/node_modules/acorn-jsx/index.js @@ -27,7 +27,7 @@ function getJsxTokens(acorn) { const tokTypes = { jsxName: new TokenType('jsxName'), jsxText: new TokenType('jsxText', {beforeExpr: true}), - jsxTagStart: new TokenType('jsxTagStart'), + jsxTagStart: new TokenType('jsxTagStart', {startsExpr: true}), jsxTagEnd: new TokenType('jsxTagEnd') }; diff --git a/tools/node_modules/eslint/node_modules/acorn-jsx/package.json b/tools/node_modules/eslint/node_modules/acorn-jsx/package.json index df867c6ae5c0a3..e26bc863624eb8 100644 --- a/tools/node_modules/eslint/node_modules/acorn-jsx/package.json +++ b/tools/node_modules/eslint/node_modules/acorn-jsx/package.json @@ -6,7 +6,7 @@ "deprecated": false, "description": "Modern, fast React.js JSX parser", "devDependencies": { - "acorn": "^7.0.0" + "acorn": "^8.0.1" }, "homepage": "https://github.com/acornjs/acorn-jsx", "license": "MIT", @@ -19,7 +19,7 @@ ], "name": "acorn-jsx", "peerDependencies": { - "acorn": "^6.0.0 || ^7.0.0" + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "repository": { "type": "git", @@ -28,5 +28,5 @@ "scripts": { "test": "node test/run.js" }, - "version": "5.2.0" + "version": "5.3.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js b/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js index 5c4c967780a3e5..bdb5f637f684e5 100644 --- a/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js +++ b/tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js @@ -37,7 +37,7 @@ const assert = require("assert"); * Test if scope is struct * @param {Scope} scope - scope * @param {Block} block - block - * @param {boolean} isMethodDefinition - is method definiton + * @param {boolean} isMethodDefinition - is method definition * @param {boolean} useDirective - use directive * @returns {boolean} is strict scope */ diff --git a/tools/node_modules/eslint/node_modules/eslint-scope/package.json b/tools/node_modules/eslint/node_modules/eslint-scope/package.json index b39dbae1cc391c..bc425ebbd0bea4 100644 --- a/tools/node_modules/eslint/node_modules/eslint-scope/package.json +++ b/tools/node_modules/eslint/node_modules/eslint-scope/package.json @@ -4,7 +4,7 @@ }, "bundleDependencies": false, "dependencies": { - "esrecurse": "^4.1.0", + "esrecurse": "^4.3.0", "estraverse": "^4.1.1" }, "deprecated": false, @@ -49,5 +49,5 @@ "publish-release": "eslint-publish-release", "test": "node Makefile.js test" }, - "version": "5.1.0" + "version": "5.1.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index c38c46e66ab04e..f95bb32e007a9d 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.8.1" + "version": "7.9.0" } \ No newline at end of file