summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-08-30 16:56:49 -0400
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-09-03 06:51:40 +0200
commitd62d2b456031539617a9e615c3e62c199a7e7dfe (patch)
tree4e1a3a6a3fb02bab7824772d51ea6ac7d023b929
parentd18b6a7e40460efe652ffd1bd072947d635ae890 (diff)
downloadandroid-node-v8-d62d2b456031539617a9e615c3e62c199a7e7dfe.tar.gz
android-node-v8-d62d2b456031539617a9e615c3e62c199a7e7dfe.tar.bz2
android-node-v8-d62d2b456031539617a9e615c3e62c199a7e7dfe.zip
tools: update ESLint to 6.3.0
Update ESLint to 6.3.0 PR-URL: https://github.com/nodejs/node/pull/29382 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
-rw-r--r--tools/node_modules/eslint/README.md1
-rw-r--r--tools/node_modules/eslint/conf/config-schema.js1
-rw-r--r--tools/node_modules/eslint/conf/default-cli-options.js2
-rw-r--r--tools/node_modules/eslint/lib/cli-engine/config-array-factory.js2
-rw-r--r--tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js6
-rw-r--r--tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js6
-rw-r--r--tools/node_modules/eslint/lib/cli-engine/formatters/stylish.js3
-rw-r--r--tools/node_modules/eslint/lib/init/config-initializer.js29
-rw-r--r--tools/node_modules/eslint/lib/init/npm-utils.js16
-rw-r--r--tools/node_modules/eslint/lib/linter/apply-disable-directives.js26
-rw-r--r--tools/node_modules/eslint/lib/linter/linter.js26
-rw-r--r--tools/node_modules/eslint/lib/options.js2
-rw-r--r--tools/node_modules/eslint/lib/rules/func-name-matching.js1
-rw-r--r--tools/node_modules/eslint/lib/rules/function-paren-newline.js4
-rw-r--r--tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js12
-rw-r--r--tools/node_modules/eslint/lib/rules/no-extra-parens.js9
-rw-r--r--tools/node_modules/eslint/lib/rules/no-self-assign.js12
-rw-r--r--tools/node_modules/eslint/lib/rules/yoda.js13
-rw-r--r--tools/node_modules/eslint/lib/shared/types.js2
-rw-r--r--tools/node_modules/eslint/package.json2
20 files changed, 144 insertions, 31 deletions
diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md
index 7ed0416c33..134c991d81 100644
--- a/tools/node_modules/eslint/README.md
+++ b/tools/node_modules/eslint/README.md
@@ -1,5 +1,6 @@
[![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)
[![Join the chat at https://gitter.im/eslint/eslint](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
diff --git a/tools/node_modules/eslint/conf/config-schema.js b/tools/node_modules/eslint/conf/config-schema.js
index d89bf0f58c..164f0b4219 100644
--- a/tools/node_modules/eslint/conf/config-schema.js
+++ b/tools/node_modules/eslint/conf/config-schema.js
@@ -21,6 +21,7 @@ const baseConfigProperties = {
rules: { type: "object" },
settings: { type: "object" },
noInlineConfig: { type: "boolean" },
+ reportUnusedDisableDirectives: { type: "boolean" },
ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
};
diff --git a/tools/node_modules/eslint/conf/default-cli-options.js b/tools/node_modules/eslint/conf/default-cli-options.js
index 9670a14b00..abbd9184e2 100644
--- a/tools/node_modules/eslint/conf/default-cli-options.js
+++ b/tools/node_modules/eslint/conf/default-cli-options.js
@@ -26,6 +26,6 @@ module.exports = {
cacheFile: ".eslintcache",
fix: false,
allowInlineConfig: true,
- reportUnusedDisableDirectives: false,
+ reportUnusedDisableDirectives: void 0,
globInputPaths: true
};
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 0b2ed07b6a..6e1ba1e02b 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
@@ -531,6 +531,7 @@ class ConfigArrayFactory {
parserOptions,
plugins: pluginList,
processor,
+ reportUnusedDisableDirectives,
root,
rules,
settings,
@@ -573,6 +574,7 @@ class ConfigArrayFactory {
parserOptions,
plugins,
processor,
+ reportUnusedDisableDirectives,
root,
rules,
settings
diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js b/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js
index 0859868d82..6383c02115 100644
--- a/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js
+++ b/tools/node_modules/eslint/lib/cli-engine/config-array/config-array.js
@@ -59,6 +59,7 @@ const { ExtractedConfig } = require("./extracted-config");
* @property {Object|undefined} parserOptions The parser options.
* @property {Record<string, DependentPlugin>|undefined} plugins The plugin loaders.
* @property {string|undefined} processor The processor name to refer plugin's processor.
+ * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.
* @property {boolean|undefined} root The flag to express root.
* @property {Record<string, RuleConf>|undefined} rules The rule settings
* @property {Object|undefined} settings The shared settings.
@@ -257,6 +258,11 @@ function createConfig(instance, indices) {
config.configNameOfNoInlineConfig = element.name;
}
+ // Adopt the reportUnusedDisableDirectives which was found at first.
+ if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) {
+ config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;
+ }
+
// Merge others.
mergeWithoutOverwrite(config.env, element.env);
mergeWithoutOverwrite(config.globals, element.globals);
diff --git a/tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js b/tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js
index 53208c16e4..66858313ba 100644
--- a/tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js
+++ b/tools/node_modules/eslint/lib/cli-engine/config-array/extracted-config.js
@@ -78,6 +78,12 @@ class ExtractedConfig {
this.processor = null;
/**
+ * The flag that reports unused `eslint-disable` directive comments.
+ * @type {boolean|undefined}
+ */
+ this.reportUnusedDisableDirectives = void 0;
+
+ /**
* Rule settings.
* @type {Record<string, [SeverityConf, ...any[]]>}
*/
diff --git a/tools/node_modules/eslint/lib/cli-engine/formatters/stylish.js b/tools/node_modules/eslint/lib/cli-engine/formatters/stylish.js
index ca132ffa8a..a808448b65 100644
--- a/tools/node_modules/eslint/lib/cli-engine/formatters/stylish.js
+++ b/tools/node_modules/eslint/lib/cli-engine/formatters/stylish.js
@@ -96,5 +96,6 @@ module.exports = function(results) {
}
}
- return total > 0 ? output : "";
+ // Resets output color, for prevent change on top level
+ return total > 0 ? chalk.reset(output) : "";
};
diff --git a/tools/node_modules/eslint/lib/init/config-initializer.js b/tools/node_modules/eslint/lib/init/config-initializer.js
index 17aa96505a..2e47e902c7 100644
--- a/tools/node_modules/eslint/lib/init/config-initializer.js
+++ b/tools/node_modules/eslint/lib/init/config-initializer.js
@@ -120,6 +120,12 @@ function getModulesList(config, installESLint) {
}
}
+ const parser = config.parser || (config.parserOptions && config.parserOptions.parser);
+
+ if (parser) {
+ modules[parser] = "latest";
+ }
+
if (installESLint === false) {
delete modules.eslint;
} else {
@@ -291,6 +297,20 @@ function processAnswers(answers) {
config.extends.push("plugin:vue/essential");
}
+ if (answers.typescript) {
+ if (answers.framework === "vue") {
+ config.parserOptions.parser = "@typescript-eslint/parser";
+ } else {
+ config.parser = "@typescript-eslint/parser";
+ }
+
+ if (Array.isArray(config.plugins)) {
+ config.plugins.push("@typescript-eslint");
+ } else {
+ config.plugins = ["@typescript-eslint"];
+ }
+ }
+
// setup rules based on problems/style enforcement preferences
if (answers.purpose === "problems") {
config.extends.unshift("eslint:recommended");
@@ -306,6 +326,9 @@ function processAnswers(answers) {
config = autoconfig.extendFromRecommended(config);
}
}
+ if (answers.typescript && config.extends.includes("eslint:recommended")) {
+ config.extends.push("plugin:@typescript-eslint/eslint-recommended");
+ }
// normalize extends
if (config.extends.length === 0) {
@@ -466,6 +489,12 @@ function promptUser() {
]
},
{
+ type: "confirm",
+ name: "typescript",
+ message: "Does your project use TypeScript?",
+ default: false
+ },
+ {
type: "checkbox",
name: "env",
message: "Where does your code run?",
diff --git a/tools/node_modules/eslint/lib/init/npm-utils.js b/tools/node_modules/eslint/lib/init/npm-utils.js
index 3a680aae92..7fe7c6e7d5 100644
--- a/tools/node_modules/eslint/lib/init/npm-utils.js
+++ b/tools/node_modules/eslint/lib/init/npm-utils.js
@@ -98,7 +98,7 @@ function fetchPeerDependencies(packageName) {
* and values are booleans indicating installation.
*/
function check(packages, opt) {
- let deps = [];
+ const deps = new Set();
const pkgJson = (opt) ? findPackageJson(opt.startDir) : findPackageJson();
let fileJson;
@@ -119,14 +119,14 @@ function check(packages, opt) {
throw error;
}
- if (opt.devDependencies && typeof fileJson.devDependencies === "object") {
- deps = deps.concat(Object.keys(fileJson.devDependencies));
- }
- if (opt.dependencies && typeof fileJson.dependencies === "object") {
- deps = deps.concat(Object.keys(fileJson.dependencies));
- }
+ ["dependencies", "devDependencies"].forEach(key => {
+ if (opt[key] && typeof fileJson[key] === "object") {
+ Object.keys(fileJson[key]).forEach(dep => deps.add(dep));
+ }
+ });
+
return packages.reduce((status, pkg) => {
- status[pkg] = deps.indexOf(pkg) !== -1;
+ status[pkg] = deps.has(pkg);
return status;
}, {});
}
diff --git a/tools/node_modules/eslint/lib/linter/apply-disable-directives.js b/tools/node_modules/eslint/lib/linter/apply-disable-directives.js
index c764a9b702..41d6934abb 100644
--- a/tools/node_modules/eslint/lib/linter/apply-disable-directives.js
+++ b/tools/node_modules/eslint/lib/linter/apply-disable-directives.js
@@ -93,7 +93,7 @@ function applyDirectives(options) {
: "Unused eslint-disable directive (no problems were reported).",
line: directive.unprocessedDirective.line,
column: directive.unprocessedDirective.column,
- severity: 2,
+ severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2,
nodeType: null
}));
@@ -114,17 +114,17 @@ function applyDirectives(options) {
* comment for two different rules is represented as two directives).
* @param {{ruleId: (string|null), line: number, column: number}[]} options.problems
* A list of problems reported by rules, sorted by increasing location in the file, with one-based columns.
- * @param {boolean} options.reportUnusedDisableDirectives If `true`, adds additional problems for unused directives
+ * @param {"off" | "warn" | "error"} options.reportUnusedDisableDirectives If `"warn"` or `"error"`, adds additional problems for unused directives
* @returns {{ruleId: (string|null), line: number, column: number}[]}
* A list of reported problems that were not disabled by the directive comments.
*/
-module.exports = options => {
- const blockDirectives = options.directives
+module.exports = ({ directives, problems, reportUnusedDisableDirectives = "off" }) => {
+ const blockDirectives = directives
.filter(directive => directive.type === "disable" || directive.type === "enable")
.map(directive => Object.assign({}, directive, { unprocessedDirective: directive }))
.sort(compareLocations);
- const lineDirectives = lodash.flatMap(options.directives, directive => {
+ const lineDirectives = lodash.flatMap(directives, directive => {
switch (directive.type) {
case "disable":
case "enable":
@@ -147,10 +147,18 @@ module.exports = options => {
}
}).sort(compareLocations);
- const blockDirectivesResult = applyDirectives({ problems: options.problems, directives: blockDirectives });
- const lineDirectivesResult = applyDirectives({ problems: blockDirectivesResult.problems, directives: lineDirectives });
-
- return options.reportUnusedDisableDirectives
+ const blockDirectivesResult = applyDirectives({
+ problems,
+ directives: blockDirectives,
+ reportUnusedDisableDirectives
+ });
+ const lineDirectivesResult = applyDirectives({
+ problems: blockDirectivesResult.problems,
+ directives: lineDirectives,
+ reportUnusedDisableDirectives
+ });
+
+ return reportUnusedDisableDirectives !== "off"
? lineDirectivesResult.problems
.concat(blockDirectivesResult.unusedDisableDirectives)
.concat(lineDirectivesResult.unusedDisableDirectives)
diff --git a/tools/node_modules/eslint/lib/linter/linter.js b/tools/node_modules/eslint/lib/linter/linter.js
index d367cef6cb..7d1dc8c8c1 100644
--- a/tools/node_modules/eslint/lib/linter/linter.js
+++ b/tools/node_modules/eslint/lib/linter/linter.js
@@ -55,6 +55,11 @@ const DEFAULT_ERROR_LOC = { start: { line: 1, column: 0 }, end: { line: 1, colum
/** @typedef {import("../shared/types").Rule} Rule */
/**
+ * @template T
+ * @typedef {{ [P in keyof T]-?: T[P] }} Required
+ */
+
+/**
* @typedef {Object} DisableDirective
* @property {("disable"|"enable"|"disable-line"|"disable-next-line")} type
* @property {number} line
@@ -79,7 +84,7 @@ const DEFAULT_ERROR_LOC = { start: { line: 1, column: 0 }, end: { line: 1, colum
* @property {boolean} [disableFixes] if `true` then the linter doesn't make `fix`
* properties into the lint result.
* @property {string} [filename] the filename of the source code.
- * @property {boolean} [reportUnusedDisableDirectives] Adds reported errors for
+ * @property {boolean | "off" | "warn" | "error"} [reportUnusedDisableDirectives] Adds reported errors for
* unused `eslint-disable` directives.
*/
@@ -103,6 +108,12 @@ const DEFAULT_ERROR_LOC = { start: { line: 1, column: 0 }, end: { line: 1, colum
* whether fixes should be applied.
*/
+/**
+ * @typedef {Object} InternalOptions
+ * @property {string | null} warnInlineConfig The config name what `noInlineConfig` setting came from. If `noInlineConfig` setting didn't exist, this is null. If this is a config name, then the linter warns directive comments.
+ * @property {"off" | "warn" | "error"} reportUnusedDisableDirectives (boolean values were normalized)
+ */
+
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
@@ -467,7 +478,7 @@ function normalizeFilename(filename) {
* consistent shape.
* @param {VerifyOptions} providedOptions Options
* @param {ConfigData} config Config.
- * @returns {Required<VerifyOptions> & { warnInlineConfig: string|null }} Normalized options
+ * @returns {Required<VerifyOptions> & InternalOptions} Normalized options
*/
function normalizeVerifyOptions(providedOptions, config) {
const disableInlineConfig = config.noInlineConfig === true;
@@ -476,13 +487,22 @@ function normalizeVerifyOptions(providedOptions, config) {
? ` (${config.configNameOfNoInlineConfig})`
: "";
+ let reportUnusedDisableDirectives = providedOptions.reportUnusedDisableDirectives;
+
+ if (typeof reportUnusedDisableDirectives === "boolean") {
+ reportUnusedDisableDirectives = reportUnusedDisableDirectives ? "error" : "off";
+ }
+ if (typeof reportUnusedDisableDirectives !== "string") {
+ reportUnusedDisableDirectives = config.reportUnusedDisableDirectives ? "warn" : "off";
+ }
+
return {
filename: normalizeFilename(providedOptions.filename || "<input>"),
allowInlineConfig: !ignoreInlineConfig,
warnInlineConfig: disableInlineConfig && !ignoreInlineConfig
? `your config${configNameOfNoInlineConfig}`
: null,
- reportUnusedDisableDirectives: Boolean(providedOptions.reportUnusedDisableDirectives),
+ reportUnusedDisableDirectives,
disableFixes: Boolean(providedOptions.disableFixes)
};
}
diff --git a/tools/node_modules/eslint/lib/options.js b/tools/node_modules/eslint/lib/options.js
index be4c09b8ea..440773a844 100644
--- a/tools/node_modules/eslint/lib/options.js
+++ b/tools/node_modules/eslint/lib/options.js
@@ -192,7 +192,7 @@ module.exports = optionator({
{
option: "report-unused-disable-directives",
type: "Boolean",
- default: false,
+ default: void 0,
description: "Adds reported errors for unused eslint-disable directives"
},
{
diff --git a/tools/node_modules/eslint/lib/rules/func-name-matching.js b/tools/node_modules/eslint/lib/rules/func-name-matching.js
index 3c4ee510db..83430ffadf 100644
--- a/tools/node_modules/eslint/lib/rules/func-name-matching.js
+++ b/tools/node_modules/eslint/lib/rules/func-name-matching.js
@@ -118,6 +118,7 @@ module.exports = {
return false;
}
return node.type === "CallExpression" &&
+ node.callee.type === "MemberExpression" &&
node.callee.object.name === objName &&
node.callee.property.name === funcName;
}
diff --git a/tools/node_modules/eslint/lib/rules/function-paren-newline.js b/tools/node_modules/eslint/lib/rules/function-paren-newline.js
index c9f09fdefa..894c8e331a 100644
--- a/tools/node_modules/eslint/lib/rules/function-paren-newline.js
+++ b/tools/node_modules/eslint/lib/rules/function-paren-newline.js
@@ -51,8 +51,8 @@ module.exports = {
expectedBefore: "Expected newline before ')'.",
expectedAfter: "Expected newline after '('.",
expectedBetween: "Expected newline between arguments/params.",
- unexpectedBefore: "Unexpected newline before '('.",
- unexpectedAfter: "Unexpected newline after ')'."
+ unexpectedBefore: "Unexpected newline before ')'.",
+ unexpectedAfter: "Unexpected newline after '('."
}
},
diff --git a/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js b/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js
index 9ae9b5be61..9bbd5546ed 100644
--- a/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js
+++ b/tools/node_modules/eslint/lib/rules/no-extra-boolean-cast.js
@@ -102,7 +102,17 @@ module.exports = {
if (hasCommentsInside(parent)) {
return null;
}
- return fixer.replaceText(parent, sourceCode.getText(node.argument));
+
+ let prefix = "";
+ const tokenBefore = sourceCode.getTokenBefore(parent);
+ const firstReplacementToken = sourceCode.getFirstToken(node.argument);
+
+ if (tokenBefore && tokenBefore.range[1] === parent.range[0] &&
+ !astUtils.canTokensBeAdjacent(tokenBefore, firstReplacementToken)) {
+ prefix = " ";
+ }
+
+ return fixer.replaceText(parent, prefix + sourceCode.getText(node.argument));
}
});
}
diff --git a/tools/node_modules/eslint/lib/rules/no-extra-parens.js b/tools/node_modules/eslint/lib/rules/no-extra-parens.js
index aa455c6a25..c5cf790477 100644
--- a/tools/node_modules/eslint/lib/rules/no-extra-parens.js
+++ b/tools/node_modules/eslint/lib/rules/no-extra-parens.js
@@ -49,7 +49,8 @@ module.exports = {
nestedBinaryExpressions: { type: "boolean" },
returnAssign: { type: "boolean" },
ignoreJSX: { enum: ["none", "all", "single-line", "multi-line"] },
- enforceForArrowConditionals: { type: "boolean" }
+ enforceForArrowConditionals: { type: "boolean" },
+ enforceForSequenceExpressions: { type: "boolean" }
},
additionalProperties: false
}
@@ -77,6 +78,8 @@ module.exports = {
const IGNORE_JSX = ALL_NODES && context.options[1] && context.options[1].ignoreJSX;
const IGNORE_ARROW_CONDITIONALS = ALL_NODES && context.options[1] &&
context.options[1].enforceForArrowConditionals === false;
+ const IGNORE_SEQUENCE_EXPRESSIONS = ALL_NODES && context.options[1] &&
+ context.options[1].enforceForSequenceExpressions === false;
const PRECEDENCE_OF_ASSIGNMENT_EXPR = precedence({ type: "AssignmentExpression" });
const PRECEDENCE_OF_UPDATE_EXPR = precedence({ type: "UpdateExpression" });
@@ -115,6 +118,10 @@ module.exports = {
}
}
+ if (node.type === "SequenceExpression" && IGNORE_SEQUENCE_EXPRESSIONS) {
+ return false;
+ }
+
return ALL_NODES || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression";
}
diff --git a/tools/node_modules/eslint/lib/rules/no-self-assign.js b/tools/node_modules/eslint/lib/rules/no-self-assign.js
index 79fb50770e..dc8bf90147 100644
--- a/tools/node_modules/eslint/lib/rules/no-self-assign.js
+++ b/tools/node_modules/eslint/lib/rules/no-self-assign.js
@@ -94,9 +94,19 @@ function eachSelfAssignment(left, right, props, report) {
const end = Math.min(left.elements.length, right.elements.length);
for (let i = 0; i < end; ++i) {
+ const leftElement = left.elements[i];
const rightElement = right.elements[i];
- eachSelfAssignment(left.elements[i], rightElement, props, report);
+ // Avoid cases such as [...a] = [...a, 1]
+ if (
+ leftElement &&
+ leftElement.type === "RestElement" &&
+ i < right.elements.length - 1
+ ) {
+ break;
+ }
+
+ eachSelfAssignment(leftElement, rightElement, props, report);
// After a spread element, those indices are unknown.
if (rightElement && rightElement.type === "SpreadElement") {
diff --git a/tools/node_modules/eslint/lib/rules/yoda.js b/tools/node_modules/eslint/lib/rules/yoda.js
index 89c4a8afd1..b00acf82c7 100644
--- a/tools/node_modules/eslint/lib/rules/yoda.js
+++ b/tools/node_modules/eslint/lib/rules/yoda.js
@@ -274,13 +274,22 @@ module.exports = {
* @returns {string} A string representation of the node with the sides and operator flipped
*/
function getFlippedString(node) {
+ const tokenBefore = sourceCode.getTokenBefore(node);
const operatorToken = sourceCode.getFirstTokenBetween(node.left, node.right, token => token.value === node.operator);
const textBeforeOperator = sourceCode.getText().slice(sourceCode.getTokenBefore(operatorToken).range[1], operatorToken.range[0]);
const textAfterOperator = sourceCode.getText().slice(operatorToken.range[1], sourceCode.getTokenAfter(operatorToken).range[0]);
const leftText = sourceCode.getText().slice(node.range[0], sourceCode.getTokenBefore(operatorToken).range[1]);
- const rightText = sourceCode.getText().slice(sourceCode.getTokenAfter(operatorToken).range[0], node.range[1]);
+ const firstRightToken = sourceCode.getTokenAfter(operatorToken);
+ const rightText = sourceCode.getText().slice(firstRightToken.range[0], node.range[1]);
- return rightText + textBeforeOperator + OPERATOR_FLIP_MAP[operatorToken.value] + textAfterOperator + leftText;
+ let prefix = "";
+
+ if (tokenBefore && tokenBefore.range[1] === node.range[0] &&
+ !astUtils.canTokensBeAdjacent(tokenBefore, firstRightToken)) {
+ prefix = " ";
+ }
+
+ return prefix + rightText + textBeforeOperator + OPERATOR_FLIP_MAP[operatorToken.value] + textAfterOperator + leftText;
}
//--------------------------------------------------------------------------
diff --git a/tools/node_modules/eslint/lib/shared/types.js b/tools/node_modules/eslint/lib/shared/types.js
index 8a889d21db..12bd0aed8c 100644
--- a/tools/node_modules/eslint/lib/shared/types.js
+++ b/tools/node_modules/eslint/lib/shared/types.js
@@ -36,6 +36,7 @@ module.exports = {};
* @property {ParserOptions} [parserOptions] The parser options.
* @property {string[]} [plugins] The plugin specifiers.
* @property {string} [processor] The processor specifier.
+ * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.
* @property {boolean} [root] The root flag.
* @property {Record<string, RuleConf>} [rules] The rule settings.
* @property {Object} [settings] The shared settings.
@@ -54,6 +55,7 @@ module.exports = {};
* @property {ParserOptions} [parserOptions] The parser options.
* @property {string[]} [plugins] The plugin specifiers.
* @property {string} [processor] The processor specifier.
+ * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.
* @property {Record<string, RuleConf>} [rules] The rule settings.
* @property {Object} [settings] The shared settings.
*/
diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json
index 60fd9b41e6..3d4c2de7f7 100644
--- a/tools/node_modules/eslint/package.json
+++ b/tools/node_modules/eslint/package.json
@@ -149,5 +149,5 @@
"test": "node Makefile.js test",
"webpack": "node Makefile.js webpack"
},
- "version": "6.2.2"
+ "version": "6.3.0"
} \ No newline at end of file