diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md index 0e574e5b2d2e18..0cde09fc602b17 100644 --- a/tools/node_modules/eslint/README.md +++ b/tools/node_modules/eslint/README.md @@ -1,5 +1,4 @@ [![NPM version][npm-image]][npm-url] -[![Build Status](https://dev.azure.com/eslint/eslint/_apis/build/status/eslint.eslint?branchName=master)](https://dev.azure.com/eslint/eslint/_build/latest?definitionId=1&branchName=master) [![Build Status](https://github.com/eslint/eslint/workflows/CI/badge.svg)](https://github.com/eslint/eslint/actions) [![Downloads][downloads-image]][downloads-url] [![Bountysource](https://www.bountysource.com/badge/tracker?tracker_id=282608)](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE) @@ -265,7 +264,7 @@ The following companies, organizations, and individuals support ESLint's ongoing

Gold Sponsors

Shopify Salesforce Badoo Airbnb Facebook Open Source

Silver Sponsors

AMP Project

Bronze Sponsors

-

UI UX Design Agencies EduBirdie Crosswordsolver Codacy Mixpanel VPS Server Free Icons by Icons8 Bugsnag Stability Monitoring clay Discord ThemeIsle TekHattan Marfeel Fire Stick Tricks JSHeroes

+

UI UX Design Agencies Top Web Design Agencies Bugsnag Stability Monitoring Crosswordsolver Codacy Mixpanel VPS Server Free Icons by Icons8 EduBirdie clay Discord ThemeIsle TekHattan Marfeel Fire Stick Tricks JSHeroes

## Technology Sponsors diff --git a/tools/node_modules/eslint/conf/config-schema.js b/tools/node_modules/eslint/conf/config-schema.js index 83addff8781732..712fc4235ecab2 100644 --- a/tools/node_modules/eslint/conf/config-schema.js +++ b/tools/node_modules/eslint/conf/config-schema.js @@ -6,6 +6,7 @@ "use strict"; const baseConfigProperties = { + $schema: { type: "string" }, env: { type: "object" }, extends: { $ref: "#/definitions/stringOrStrings" }, globals: { type: "object" }, diff --git a/tools/node_modules/eslint/conf/eslint-recommended.js b/tools/node_modules/eslint/conf/eslint-recommended.js index 7cc6e01652ba2a..e915ec449040e9 100644 --- a/tools/node_modules/eslint/conf/eslint-recommended.js +++ b/tools/node_modules/eslint/conf/eslint-recommended.js @@ -62,7 +62,6 @@ module.exports = { "no-useless-catch": "error", "no-useless-escape": "error", "no-with": "error", - "require-atomic-updates": "error", "require-yield": "error", "use-isnan": "error", "valid-typeof": "error" 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 0b1c76bac6864a..22336a91de2909 100644 --- a/tools/node_modules/eslint/lib/cli-engine/cli-engine.js +++ b/tools/node_modules/eslint/lib/cli-engine/cli-engine.js @@ -576,6 +576,7 @@ class CLIEngine { cwd: options.cwd, extensions: options.extensions, globInputPaths: options.globInputPaths, + errorOnUnmatchedPattern: options.errorOnUnmatchedPattern, ignore: options.ignore }); const lintResultCache = 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 c444031bcb0a57..76c4ccd70212cd 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 @@ -62,6 +62,7 @@ const eslintRecommendedPath = path.resolve(__dirname, "../../conf/eslint-recomme const eslintAllPath = path.resolve(__dirname, "../../conf/eslint-all.js"); const configFilenames = [ ".eslintrc.js", + ".eslintrc.cjs", ".eslintrc.yaml", ".eslintrc.yml", ".eslintrc.json", @@ -279,6 +280,7 @@ function configMissingError(configName, importerName) { function loadConfigFile(filePath) { switch (path.extname(filePath)) { case ".js": + case ".cjs": return loadJSConfigFile(filePath); case ".json": diff --git a/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js b/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js index b5a082b71a6bc8..c67e01aef9b1c8 100644 --- a/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js +++ b/tools/node_modules/eslint/lib/cli-engine/file-enumerator.js @@ -190,6 +190,7 @@ class FileEnumerator { configArrayFactory = new CascadingConfigArrayFactory({ cwd }), extensions = [".js"], globInputPaths = true, + errorOnUnmatchedPattern = true, ignore = true } = {}) { internalSlotsMap.set(this, { @@ -208,6 +209,7 @@ class FileEnumerator { "u" ), globInputPaths, + errorOnUnmatchedPattern, ignoreFlag: ignore }); } @@ -226,7 +228,7 @@ class FileEnumerator { * @returns {IterableIterator} The found files. */ *iterateFiles(patternOrPatterns) { - const { globInputPaths } = internalSlotsMap.get(this); + const { globInputPaths, errorOnUnmatchedPattern } = internalSlotsMap.get(this); const patterns = Array.isArray(patternOrPatterns) ? patternOrPatterns : [patternOrPatterns]; @@ -265,14 +267,16 @@ class FileEnumerator { } // Raise an error if any files were not found. - if (!foundRegardlessOfIgnored) { - throw new NoFilesFoundError( - pattern, - !globInputPaths && isGlob(pattern) - ); - } - if (!found) { - throw new AllFilesIgnoredError(pattern); + if (errorOnUnmatchedPattern) { + if (!foundRegardlessOfIgnored) { + throw new NoFilesFoundError( + pattern, + !globInputPaths && isGlob(pattern) + ); + } + if (!found) { + throw new AllFilesIgnoredError(pattern); + } } } diff --git a/tools/node_modules/eslint/lib/cli-engine/lint-result-cache.js b/tools/node_modules/eslint/lib/cli-engine/lint-result-cache.js index 14e19d9e5a1c63..23a142097bab52 100644 --- a/tools/node_modules/eslint/lib/cli-engine/lint-result-cache.js +++ b/tools/node_modules/eslint/lib/cli-engine/lint-result-cache.js @@ -20,6 +20,7 @@ const hash = require("./hash"); //----------------------------------------------------------------------------- const configHashCache = new WeakMap(); +const nodeVersion = process && process.version; /** * Calculates the hash of the config @@ -28,7 +29,7 @@ const configHashCache = new WeakMap(); */ function hashOfConfigFor(config) { if (!configHashCache.has(config)) { - configHashCache.set(config, hash(`${pkg.version}_${stringify(config)}`)); + configHashCache.set(config, hash(`${pkg.version}_${nodeVersion}_${stringify(config)}`)); } return configHashCache.get(config); diff --git a/tools/node_modules/eslint/lib/cli.js b/tools/node_modules/eslint/lib/cli.js index 18a917cf0b0a95..944b4b79353b3d 100644 --- a/tools/node_modules/eslint/lib/cli.js +++ b/tools/node_modules/eslint/lib/cli.js @@ -68,7 +68,8 @@ function translateOptions(cliOptions) { fixTypes: cliOptions.fixType, allowInlineConfig: cliOptions.inlineConfig, reportUnusedDisableDirectives: cliOptions.reportUnusedDisableDirectives, - resolvePluginsRelativeTo: cliOptions.resolvePluginsRelativeTo + resolvePluginsRelativeTo: cliOptions.resolvePluginsRelativeTo, + errorOnUnmatchedPattern: cliOptions.errorOnUnmatchedPattern }; } diff --git a/tools/node_modules/eslint/lib/linter/config-comment-parser.js b/tools/node_modules/eslint/lib/linter/config-comment-parser.js index d0e24c5940e341..35862315d515f8 100644 --- a/tools/node_modules/eslint/lib/linter/config-comment-parser.js +++ b/tools/node_modules/eslint/lib/linter/config-comment-parser.js @@ -90,7 +90,7 @@ module.exports = class ConfigCommentParser { * But we are supporting that. So this is a fallback for that. */ items = {}; - const normalizedString = string.replace(/([a-zA-Z0-9\-/]+):/gu, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/u, "$1,"); + const normalizedString = string.replace(/([-a-zA-Z0-9/]+):/gu, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/u, "$1,"); try { items = JSON.parse(`{${normalizedString}}`); diff --git a/tools/node_modules/eslint/lib/options.js b/tools/node_modules/eslint/lib/options.js index 83bf9afc22c9f1..98dc04b6eb3968 100644 --- a/tools/node_modules/eslint/lib/options.js +++ b/tools/node_modules/eslint/lib/options.js @@ -230,6 +230,12 @@ module.exports = optionator({ default: "false", description: "Output execution environment information" }, + { + option: "error-on-unmatched-pattern", + type: "Boolean", + default: "true", + description: "Prevent errors when pattern is unmatched" + }, { option: "debug", type: "Boolean", 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 b4b3b2bec86c78..44e01dadf09b5d 100644 --- a/tools/node_modules/eslint/lib/rule-tester/rule-tester.js +++ b/tools/node_modules/eslint/lib/rule-tester/rule-tester.js @@ -596,8 +596,10 @@ class RuleTester { if (hasOwnProperty(error, "suggestions")) { // Support asserting there are no suggestions - if (!error.suggestions) { - assert.strictEqual(message.suggestions, error.suggestions, `Error should have no suggestions on error with message: "${message.message}"`); + if (!error.suggestions || (Array.isArray(error.suggestions) && error.suggestions.length === 0)) { + if (Array.isArray(message.suggestions) && message.suggestions.length > 0) { + assert.fail(`Error should have no suggestions on error with message: "${message.message}"`); + } } else { assert.strictEqual(Array.isArray(message.suggestions), true, `Error should have an array of suggestions. Instead received "${message.suggestions}" on error with message: "${message.message}"`); assert.strictEqual(message.suggestions.length, error.suggestions.length, `Error should have ${error.suggestions.length} suggestions. Instead found ${message.suggestions.length} suggestions`); diff --git a/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js b/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js index 2510159ee48fa7..c2b77a641f7294 100644 --- a/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js +++ b/tools/node_modules/eslint/lib/rules/array-bracket-spacing.js @@ -84,16 +84,16 @@ module.exports = { * @returns {void} */ function reportNoBeginningSpace(node, token) { + const nextToken = sourceCode.getTokenAfter(token); + context.report({ node, - loc: token.loc.start, + loc: { start: token.loc.end, end: nextToken.loc.start }, messageId: "unexpectedSpaceAfter", data: { tokenValue: token.value }, fix(fixer) { - const nextToken = sourceCode.getTokenAfter(token); - return fixer.removeRange([token.range[1], nextToken.range[0]]); } }); @@ -106,16 +106,16 @@ module.exports = { * @returns {void} */ function reportNoEndingSpace(node, token) { + const previousToken = sourceCode.getTokenBefore(token); + context.report({ node, - loc: token.loc.start, + loc: { start: previousToken.loc.end, end: token.loc.start }, messageId: "unexpectedSpaceBefore", data: { tokenValue: token.value }, fix(fixer) { - const previousToken = sourceCode.getTokenBefore(token); - return fixer.removeRange([previousToken.range[1], token.range[0]]); } }); @@ -130,7 +130,7 @@ module.exports = { function reportRequiredBeginningSpace(node, token) { context.report({ node, - loc: token.loc.start, + loc: token.loc, messageId: "missingSpaceAfter", data: { tokenValue: token.value @@ -150,7 +150,7 @@ module.exports = { function reportRequiredEndingSpace(node, token) { context.report({ node, - loc: token.loc.start, + loc: token.loc, messageId: "missingSpaceBefore", data: { tokenValue: token.value diff --git a/tools/node_modules/eslint/lib/rules/key-spacing.js b/tools/node_modules/eslint/lib/rules/key-spacing.js index 994c35627f7522..6d1b9121c78c5f 100644 --- a/tools/node_modules/eslint/lib/rules/key-spacing.js +++ b/tools/node_modules/eslint/lib/rules/key-spacing.js @@ -42,6 +42,18 @@ function isSingleLine(node) { return (node.loc.end.line === node.loc.start.line); } +/** + * Checks whether the properties on a single line. + * @param {ASTNode[]} properties List of Property AST nodes. + * @returns {boolean} True if all properies is on a single line. + */ +function isSingleLineProperties(properties) { + const [firstProp] = properties, + lastProp = last(properties); + + return firstProp.loc.start.line === lastProp.loc.end.line; +} + /** * Initializes a single option property from the configuration with defaults for undefined values * @param {Object} toOptions Object to be initialized @@ -583,17 +595,6 @@ module.exports = { } } - /** - * Verifies vertical alignment, taking into account groups of properties. - * @param {ASTNode} node ObjectExpression node being evaluated. - * @returns {void} - */ - function verifyAlignment(node) { - createGroups(node).forEach(group => { - verifyGroupAlignment(group.filter(isKeyValueProperty)); - }); - } - /** * Verifies spacing of property conforms to specified options. * @param {ASTNode} node Property node being evaluated. @@ -611,17 +612,35 @@ module.exports = { /** * Verifies spacing of each property in a list. - * @param {ASTNode[]} properties List of Property AST nodes. + * @param {ASTNode[]} properties List of Property AST nodes. + * @param {Object} lineOptions Configured singleLine or multiLine options * @returns {void} */ - function verifyListSpacing(properties) { + function verifyListSpacing(properties, lineOptions) { const length = properties.length; for (let i = 0; i < length; i++) { - verifySpacing(properties[i], singleLineOptions); + verifySpacing(properties[i], lineOptions); } } + /** + * Verifies vertical alignment, taking into account groups of properties. + * @param {ASTNode} node ObjectExpression node being evaluated. + * @returns {void} + */ + function verifyAlignment(node) { + createGroups(node).forEach(group => { + const properties = group.filter(isKeyValueProperty); + + if (properties.length > 0 && isSingleLineProperties(properties)) { + verifyListSpacing(properties, multiLineOptions); + } else { + verifyGroupAlignment(properties); + } + }); + } + //-------------------------------------------------------------------------- // Public API //-------------------------------------------------------------------------- @@ -631,7 +650,7 @@ module.exports = { return { ObjectExpression(node) { if (isSingleLine(node)) { - verifyListSpacing(node.properties.filter(isKeyValueProperty)); + verifyListSpacing(node.properties.filter(isKeyValueProperty), singleLineOptions); } else { verifyAlignment(node); } diff --git a/tools/node_modules/eslint/lib/rules/lines-between-class-members.js b/tools/node_modules/eslint/lib/rules/lines-between-class-members.js index 60332a1b3ca366..97235303699089 100644 --- a/tools/node_modules/eslint/lib/rules/lines-between-class-members.js +++ b/tools/node_modules/eslint/lib/rules/lines-between-class-members.js @@ -54,62 +54,45 @@ module.exports = { const sourceCode = context.getSourceCode(); /** - * Checks if there is padding between two tokens - * @param {Token} first The first token - * @param {Token} second The second token - * @returns {boolean} True if there is at least a line between the tokens + * Return the last token among the consecutive tokens that have no exceed max line difference in between, before the first token in the next member. + * @param {Token} prevLastToken The last token in the previous member node. + * @param {Token} nextFirstToken The first token in the next member node. + * @param {number} maxLine The maximum number of allowed line difference between consecutive tokens. + * @returns {Token} The last token among the consecutive tokens. */ - function isPaddingBetweenTokens(first, second) { - const comments = sourceCode.getCommentsBefore(second); - const len = comments.length; + function findLastConsecutiveTokenAfter(prevLastToken, nextFirstToken, maxLine) { + const after = sourceCode.getTokenAfter(prevLastToken, { includeComments: true }); - // If there is no comments - if (len === 0) { - const linesBetweenFstAndSnd = second.loc.start.line - first.loc.end.line - 1; - - return linesBetweenFstAndSnd >= 1; - } - - - // If there are comments - let sumOfCommentLines = 0; // the numbers of lines of comments - let prevCommentLineNum = -1; // line number of the end of the previous comment - - for (let i = 0; i < len; i++) { - const commentLinesOfThisComment = comments[i].loc.end.line - comments[i].loc.start.line + 1; - - sumOfCommentLines += commentLinesOfThisComment; - - /* - * If this comment and the previous comment are in the same line, - * the count of comment lines is duplicated. So decrement sumOfCommentLines. - */ - if (prevCommentLineNum === comments[i].loc.start.line) { - sumOfCommentLines -= 1; - } - - prevCommentLineNum = comments[i].loc.end.line; + if (after !== nextFirstToken && after.loc.start.line - prevLastToken.loc.end.line <= maxLine) { + return findLastConsecutiveTokenAfter(after, nextFirstToken, maxLine); } + return prevLastToken; + } - /* - * If the first block and the first comment are in the same line, - * the count of comment lines is duplicated. So decrement sumOfCommentLines. - */ - if (first.loc.end.line === comments[0].loc.start.line) { - sumOfCommentLines -= 1; - } + /** + * Return the first token among the consecutive tokens that have no exceed max line difference in between, after the last token in the previous member. + * @param {Token} nextFirstToken The first token in the next member node. + * @param {Token} prevLastToken The last token in the previous member node. + * @param {number} maxLine The maximum number of allowed line difference between consecutive tokens. + * @returns {Token} The first token among the consecutive tokens. + */ + function findFirstConsecutiveTokenBefore(nextFirstToken, prevLastToken, maxLine) { + const before = sourceCode.getTokenBefore(nextFirstToken, { includeComments: true }); - /* - * If the last comment and the second block are in the same line, - * the count of comment lines is duplicated. So decrement sumOfCommentLines. - */ - if (comments[len - 1].loc.end.line === second.loc.start.line) { - sumOfCommentLines -= 1; + if (before !== prevLastToken && nextFirstToken.loc.start.line - before.loc.end.line <= maxLine) { + return findFirstConsecutiveTokenBefore(before, prevLastToken, maxLine); } + return nextFirstToken; + } - const linesBetweenFstAndSnd = second.loc.start.line - first.loc.end.line - 1; - - return linesBetweenFstAndSnd - sumOfCommentLines >= 1; + /** + * Checks if there is a token or comment between two tokens. + * @param {Token} before The token before. + * @param {Token} after The token after. + * @returns {boolean} True if there is a token or comment between two tokens. + */ + function hasTokenOrCommentBetween(before, after) { + return sourceCode.getTokensBetween(before, after, { includeComments: true }).length !== 0; } return { @@ -120,10 +103,13 @@ module.exports = { const curFirst = sourceCode.getFirstToken(body[i]); const curLast = sourceCode.getLastToken(body[i]); const nextFirst = sourceCode.getFirstToken(body[i + 1]); - const isPadded = isPaddingBetweenTokens(curLast, nextFirst); const isMulti = !astUtils.isTokenOnSameLine(curFirst, curLast); const skip = !isMulti && options[1].exceptAfterSingleLine; - + const beforePadding = findLastConsecutiveTokenAfter(curLast, nextFirst, 1); + const afterPadding = findFirstConsecutiveTokenBefore(nextFirst, curLast, 1); + const isPadded = afterPadding.loc.start.line - beforePadding.loc.end.line > 1; + const hasTokenInPadding = hasTokenOrCommentBetween(beforePadding, afterPadding); + const curLineLastToken = findLastConsecutiveTokenAfter(curLast, nextFirst, 0); if ((options[0] === "always" && !skip && !isPadded) || (options[0] === "never" && isPadded)) { @@ -131,9 +117,12 @@ module.exports = { node: body[i + 1], messageId: isPadded ? "never" : "always", fix(fixer) { + if (hasTokenInPadding) { + return null; + } return isPadded - ? fixer.replaceTextRange([curLast.range[1], nextFirst.range[0]], "\n") - : fixer.insertTextAfter(curLast, "\n"); + ? fixer.replaceTextRange([beforePadding.range[1], afterPadding.range[0]], "\n") + : fixer.insertTextAfter(curLineLastToken, "\n"); } }); } diff --git a/tools/node_modules/eslint/lib/rules/no-multiple-empty-lines.js b/tools/node_modules/eslint/lib/rules/no-multiple-empty-lines.js index f945cfeffe2b07..41e6be3a289584 100644 --- a/tools/node_modules/eslint/lib/rules/no-multiple-empty-lines.js +++ b/tools/node_modules/eslint/lib/rules/no-multiple-empty-lines.js @@ -110,7 +110,7 @@ module.exports = { if (lineNumber - lastLineNumber - 1 > maxAllowed) { context.report({ node, - loc: { start: { line: lastLineNumber + 1, column: 0 }, end: { line: lineNumber, column: 0 } }, + loc: { start: { line: lastLineNumber + maxAllowed + 1, column: 0 }, end: { line: lineNumber, column: 0 } }, message, data: { max: maxAllowed, pluralizedLines: maxAllowed === 1 ? "line" : "lines" }, fix(fixer) { diff --git a/tools/node_modules/eslint/lib/rules/no-restricted-imports.js b/tools/node_modules/eslint/lib/rules/no-restricted-imports.js index bed9c2432a58dd..ec0696f99a2de0 100644 --- a/tools/node_modules/eslint/lib/rules/no-restricted-imports.js +++ b/tools/node_modules/eslint/lib/rules/no-restricted-imports.js @@ -72,14 +72,14 @@ module.exports = { arrayOfStringsOrObjects, { type: "array", - items: { + items: [{ type: "object", properties: { paths: arrayOfStringsOrObjects, patterns: arrayOfStrings }, additionalProperties: false - }, + }], additionalItems: false } ] diff --git a/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js b/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js index 5c8f569d7b8a2d..a9c2ee74f2c828 100644 --- a/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js +++ b/tools/node_modules/eslint/lib/rules/no-unsafe-negation.js @@ -54,7 +54,8 @@ module.exports = { description: "disallow negating the left operand of relational operators", category: "Possible Errors", recommended: true, - url: "https://eslint.org/docs/rules/no-unsafe-negation" + url: "https://eslint.org/docs/rules/no-unsafe-negation", + suggestion: true }, schema: [ @@ -69,9 +70,13 @@ module.exports = { additionalProperties: false } ], + fixable: null, + messages: { - unexpected: "Unexpected negating the left operand of '{{operator}}' operator." + unexpected: "Unexpected negating the left operand of '{{operator}}' operator.", + suggestNegatedExpression: "Negate '{{operator}}' expression instead of its left operand. This changes the current behavior.", + suggestParenthesisedNegation: "Wrap negation in '()' to make the intention explicit. This preserves the current behavior." } }, @@ -82,10 +87,11 @@ module.exports = { return { BinaryExpression(node) { - const orderingRelationRuleApplies = enforceForOrderingRelations && isOrderingRelationalOperator(node.operator); + const operator = node.operator; + const orderingRelationRuleApplies = enforceForOrderingRelations && isOrderingRelationalOperator(operator); if ( - (isInOrInstanceOfOperator(node.operator) || orderingRelationRuleApplies) && + (isInOrInstanceOfOperator(operator) || orderingRelationRuleApplies) && isNegation(node.left) && !astUtils.isParenthesised(sourceCode, node.left) ) { @@ -93,7 +99,26 @@ module.exports = { node, loc: node.left.loc, messageId: "unexpected", - data: { operator: node.operator } + data: { operator }, + suggest: [ + { + messageId: "suggestNegatedExpression", + data: { operator }, + fix(fixer) { + const negationToken = sourceCode.getFirstToken(node.left); + const fixRange = [negationToken.range[1], node.range[1]]; + const text = sourceCode.text.slice(fixRange[0], fixRange[1]); + + return fixer.replaceTextRange(fixRange, `(${text})`); + } + }, + { + messageId: "suggestParenthesisedNegation", + fix(fixer) { + return fixer.replaceText(node.left, `(${sourceCode.getText(node.left)})`); + } + } + ] }); } } diff --git a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js index 672d9bcaa0c508..c352d88dc07ca2 100644 --- a/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js +++ b/tools/node_modules/eslint/lib/rules/prefer-numeric-literals.js @@ -15,6 +15,12 @@ const astUtils = require("./utils/ast-utils"); // Helpers //------------------------------------------------------------------------------ +const radixMap = new Map([ + [2, { system: "binary", literalPrefix: "0b" }], + [8, { system: "octal", literalPrefix: "0o" }], + [16, { system: "hexadecimal", literalPrefix: "0x" }] +]); + /** * Checks to see if a CallExpression's callee node is `parseInt` or * `Number.parseInt`. @@ -54,49 +60,44 @@ module.exports = { }, schema: [], + + messages: { + useLiteral: "Use {{system}} literals instead of {{functionName}}()." + }, + fixable: "code" }, create(context) { const sourceCode = context.getSourceCode(); - const radixMap = { - 2: "binary", - 8: "octal", - 16: "hexadecimal" - }; - - const prefixMap = { - 2: "0b", - 8: "0o", - 16: "0x" - }; - //---------------------------------------------------------------------- // Public //---------------------------------------------------------------------- return { - CallExpression(node) { - - // doesn't check parseInt() if it doesn't have a radix argument - if (node.arguments.length !== 2) { - return; - } + "CallExpression[arguments.length=2]"(node) { + const [strNode, radixNode] = node.arguments, + str = strNode.value, + radix = radixNode.value; + + if ( + strNode.type === "Literal" && + radixNode.type === "Literal" && + typeof str === "string" && + typeof radix === "number" && + radixMap.has(radix) && + isParseInt(node.callee) + ) { - // only error if the radix is 2, 8, or 16 - const radixName = radixMap[node.arguments[1].value]; + const { system, literalPrefix } = radixMap.get(radix); - if (isParseInt(node.callee) && - radixName && - node.arguments[0].type === "Literal" - ) { context.report({ node, - message: "Use {{radixName}} literals instead of {{functionName}}().", + messageId: "useLiteral", data: { - radixName, + system, functionName: sourceCode.getText(node.callee) }, fix(fixer) { @@ -104,9 +105,9 @@ module.exports = { return null; } - const replacement = `${prefixMap[node.arguments[1].value]}${node.arguments[0].value}`; + const replacement = `${literalPrefix}${str}`; - if (+replacement !== parseInt(node.arguments[0].value, node.arguments[1].value)) { + if (+replacement !== parseInt(str, radix)) { /* * If the newly-produced literal would be invalid, (e.g. 0b1234), diff --git a/tools/node_modules/eslint/lib/rules/require-atomic-updates.js b/tools/node_modules/eslint/lib/rules/require-atomic-updates.js index 3912ad86cb912f..bdd6d81ebc4758 100644 --- a/tools/node_modules/eslint/lib/rules/require-atomic-updates.js +++ b/tools/node_modules/eslint/lib/rules/require-atomic-updates.js @@ -162,7 +162,7 @@ module.exports = { docs: { description: "disallow assignments that can lead to race conditions due to usage of `await` or `yield`", category: "Possible Errors", - recommended: true, + recommended: false, url: "https://eslint.org/docs/rules/require-atomic-updates" }, diff --git a/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/LICENSE b/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/LICENSE index ee27ba4b4412b0..c932223b1e2c2f 100644 --- a/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/LICENSE +++ b/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/LICENSE @@ -1,5 +1,8 @@ This software is released under the MIT license: +Copyright (c) 2017 Evgeny Poberezkin +Copyright (c) 2013 James Halliday + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to diff --git a/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/README.md b/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/README.md index 0f43b4a7e034e4..02cf49ff385b8b 100644 --- a/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/README.md +++ b/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/README.md @@ -114,6 +114,18 @@ The fastest is fast-stable-stringify ``` +## Enterprise support + +fast-json-stable-stringify package is a part of [Tidelift enterprise subscription](https://tidelift.com/subscription/pkg/npm-fast-json-stable-stringify?utm_source=npm-fast-json-stable-stringify&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) - it provides a centralised commercial support to open-source software users, in addition to the support provided by software maintainers. + + +## Security contact + +To report a security vulnerability, please use the +[Tidelift security contact](https://tidelift.com/security). +Tidelift will coordinate the fix and disclosure. Please do NOT report security vulnerability via GitHub issues. + + # license [MIT](https://github.com/epoberezkin/fast-json-stable-stringify/blob/master/LICENSE) diff --git a/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/package.json b/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/package.json index 2d16a1ff6dcfc2..46f5c8e221cc45 100644 --- a/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/package.json +++ b/tools/node_modules/eslint/node_modules/fast-json-stable-stringify/package.json @@ -8,18 +8,19 @@ "url": "https://github.com/epoberezkin/fast-json-stable-stringify/issues" }, "bundleDependencies": false, + "dependencies": {}, "deprecated": false, "description": "deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify", "devDependencies": { "benchmark": "^2.1.4", "coveralls": "^3.0.0", - "eslint": "^4.9.0", + "eslint": "^6.7.0", "fast-stable-stringify": "latest", "faster-stable-stringify": "latest", "json-stable-stringify": "latest", - "nyc": "^11.2.1", + "nyc": "^14.1.0", "pre-commit": "^1.2.2", - "tape": "~1.0.4" + "tape": "^4.11.0" }, "homepage": "https://github.com/epoberezkin/fast-json-stable-stringify", "keywords": [ @@ -51,5 +52,6 @@ "test": "npm run eslint && nyc npm run test-spec", "test-spec": "tape test/*.js" }, - "version": "2.0.0" + "types": "index.d.ts", + "version": "2.1.0" } \ No newline at end of file diff --git a/tools/node_modules/eslint/node_modules/inquirer/README.md b/tools/node_modules/eslint/node_modules/inquirer/README.md index fe3326fd7448fb..1c711ff19865e6 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/README.md +++ b/tools/node_modules/eslint/node_modules/inquirer/README.md @@ -2,12 +2,13 @@ # Inquirer.js -[![npm](https://badge.fury.io/js/inquirer.svg)](http://badge.fury.io/js/inquirer) [![tests](https://travis-ci.org/SBoudrias/Inquirer.js.svg?branch=master)](http://travis-ci.org/SBoudrias/Inquirer.js) [![Coverage Status](https://codecov.io/gh/SBoudrias/Inquirer.js/branch/master/graph/badge.svg)](https://codecov.io/gh/SBoudrias/Inquirer.js) [![dependencies](https://david-dm.org/SBoudrias/Inquirer.js.svg?theme=shields.io)](https://david-dm.org/SBoudrias/Inquirer.js) +[![npm](https://badge.fury.io/js/inquirer.svg)](http://badge.fury.io/js/inquirer) +[![tests](https://travis-ci.org/SBoudrias/Inquirer.js.svg?branch=master)](http://travis-ci.org/SBoudrias/Inquirer.js) +[![Coverage Status](https://codecov.io/gh/SBoudrias/Inquirer.js/branch/master/graph/badge.svg)](https://codecov.io/gh/SBoudrias/Inquirer.js) +[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2FSBoudrias%2FInquirer.js.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2FSBoudrias%2FInquirer.js?ref=badge_shield) A collection of common interactive command line user interfaces. -**Version 4.x** only supports Node 6 and over. For Node 4 support please use [version 3.x](https://github.com/SBoudrias/Inquirer.js/tree/v3.3.0). - ## Table of Contents 1. [Documentation](#documentation) diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/objects/choices.js b/tools/node_modules/eslint/node_modules/inquirer/lib/objects/choices.js index 205ede2e775df9..e3c16d05e483a9 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/objects/choices.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/objects/choices.js @@ -110,7 +110,9 @@ module.exports = class Choices { push() { var objs = _.map(arguments, val => new Choice(val)); this.choices.push.apply(this.choices, objs); - this.realChoices = this.choices.filter(Separator.exclude); + this.realChoices = this.choices + .filter(Separator.exclude) + .filter(item => !item.disabled); return this.choices; } }; diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/base.js b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/base.js index 22ce6f43276087..6a7b19d3f72f4f 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/base.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/base.js @@ -95,7 +95,7 @@ class Prompt { filteredValue => validate(filteredValue, self.answers).then( isValid => ({ isValid: isValid, value: filteredValue }), - err => ({ isValid: err }) + err => ({ isValid: err, value: filteredValue }) ), err => ({ isValid: err }) ) diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/input.js b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/input.js index 2a090ad159c535..2b886efc93cd88 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/input.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/input.js @@ -90,10 +90,10 @@ class InputPrompt extends Base { this.done(state.value); } - onError(state) { - this.rl.line += state.value; - this.rl.cursor += state.value.length; - this.render(state.isValid); + onError({ value = '', isValid }) { + this.rl.line += value; + this.rl.cursor += value.length; + this.render(isValid); } /** diff --git a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/rawlist.js b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/rawlist.js index 3c800f6151bc8e..418114b52fa689 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/rawlist.js +++ b/tools/node_modules/eslint/node_modules/inquirer/lib/prompts/rawlist.js @@ -64,14 +64,13 @@ class RawListPrompt extends Base { validation.success.forEach(this.onEnd.bind(this)); validation.error.forEach(this.onError.bind(this)); - events.keypress - .pipe(takeUntil(validation.success)) - .forEach(this.onKeypress.bind(this)); events.normalizedUpKey.pipe(takeUntil(events.line)).forEach(this.onUpKey.bind(this)); events.normalizedDownKey .pipe(takeUntil(events.line)) .forEach(this.onDownKey.bind(this)); - + events.keypress + .pipe(takeUntil(validation.success)) + .forEach(this.onKeypress.bind(this)); // Init the prompt this.render(); @@ -96,7 +95,6 @@ class RawListPrompt extends Base { '\n' + this.paginator.paginate(choicesStr, this.selected, this.opt.pageSize); message += '\n Answer: '; } - message += this.rl.line; if (error) { @@ -111,8 +109,10 @@ class RawListPrompt extends Base { */ getCurrentValue(index) { - if (index == null || index === '') { + if (index == null) { index = this.rawDefault; + } else if (index === '') { + index = this.selected; } else { index -= 1; } @@ -148,7 +148,6 @@ class RawListPrompt extends Base { } else { this.selected = undefined; } - this.render(); } @@ -174,11 +173,12 @@ class RawListPrompt extends Base { */ onArrowKey(type) { - var index = this.rl.line.length ? Number(this.rl.line) - 1 : 0; - if (type === 'up') index = index === 0 ? this.opt.choices.length - 1 : index - 1; - else index = index === this.opt.choices.length - 1 ? 0 : index + 1; - this.rl.line = String(index + 1); - this.onKeypress(); + var len = this.opt.choices.realLength; + + if (type === 'up') this.selected = this.selected > 0 ? this.selected - 1 : len - 1; + else this.selected = this.selected < len - 1 ? this.selected + 1 : 0; + + this.rl.line = String(this.selected + 1); } } diff --git a/tools/node_modules/eslint/node_modules/inquirer/package.json b/tools/node_modules/eslint/node_modules/inquirer/package.json index a3efb9cb4b2d35..6f7f9e29204c91 100644 --- a/tools/node_modules/eslint/node_modules/inquirer/package.json +++ b/tools/node_modules/eslint/node_modules/inquirer/package.json @@ -17,7 +17,7 @@ "lodash": "^4.17.15", "mute-stream": "0.0.8", "run-async": "^2.2.0", - "rxjs": "^6.4.0", + "rxjs": "^6.5.3", "string-width": "^4.1.0", "strip-ansi": "^5.1.0", "through": "^2.3.6" @@ -28,10 +28,10 @@ "chai": "^4.2.0", "chalk-pipe": "^2.0.0", "cmdify": "^0.0.4", - "mocha": "^6.2.0", + "mocha": "^6.2.1", "mockery": "^2.1.0", "nyc": "^14.1.1", - "sinon": "^7.4.1" + "sinon": "^7.5.0" }, "engines": { "node": ">=6.0.0" @@ -40,7 +40,7 @@ "lib", "README.md" ], - "gitHead": "be4558e0314afcd3852361929397588744a745d8", + "gitHead": "7ec6ea0d2e55895fada6782fcc76de232c1e4c12", "homepage": "https://github.com/SBoudrias/Inquirer.js#readme", "keywords": [ "command", @@ -63,5 +63,5 @@ "prepublishOnly": "cp ../../README.md .", "test": "nyc mocha test/**/* -r ./test/before" }, - "version": "7.0.0" + "version": "7.0.1" } \ No newline at end of file diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json index 0abd303e051b44..73cf4d4ed2f26a 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": "6.7.2" + "version": "6.8.0" } \ No newline at end of file