summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-03-15 13:40:34 -0400
committerDaniel Bevenius <daniel.bevenius@gmail.com>2019-03-18 07:25:31 +0100
commit1ceb6d8e9b516052e21b1dabd1ab19e3c3488e1e (patch)
treec15d034c56d46ebe3e82690f82a8a6661ddfbde8
parentbab55444764c72c208d6f2dd426a0208e4edaf2f (diff)
downloadandroid-node-v8-1ceb6d8e9b516052e21b1dabd1ab19e3c3488e1e.tar.gz
android-node-v8-1ceb6d8e9b516052e21b1dabd1ab19e3c3488e1e.tar.bz2
android-node-v8-1ceb6d8e9b516052e21b1dabd1ab19e3c3488e1e.zip
tools: update ESLint to 5.15.2
Update ESLint to 5.15.2 PR-URL: https://github.com/nodejs/node/pull/26687 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com>
-rw-r--r--tools/node_modules/eslint/README.md2
-rw-r--r--tools/node_modules/eslint/lib/config/config-file.js2
-rw-r--r--tools/node_modules/eslint/lib/config/config-validator.js24
-rw-r--r--tools/node_modules/eslint/lib/linter.js20
-rw-r--r--tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js40
-rw-r--r--tools/node_modules/eslint/lib/testers/rule-tester.js2
-rw-r--r--tools/node_modules/eslint/lib/util/glob-utils.js13
-rw-r--r--tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js9
-rw-r--r--tools/node_modules/eslint/node_modules/eslint-scope/package.json2
-rw-r--r--tools/node_modules/eslint/package.json8
10 files changed, 66 insertions, 56 deletions
diff --git a/tools/node_modules/eslint/README.md b/tools/node_modules/eslint/README.md
index 8ac9fbe4d5..437794dc65 100644
--- a/tools/node_modules/eslint/README.md
+++ b/tools/node_modules/eslint/README.md
@@ -268,7 +268,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
<h3>Gold Sponsors</h3>
<p><a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/proxy/images/?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2F098e3bd0-4d57-11e8-9324-0f6cc1f92bf1.png&height=96" alt="Airbnb" height="96"></a> <a href="https://code.facebook.com/projects/"><img src="https://images.opencollective.com/proxy/images/?src=https%3A%2F%2Fres.cloudinary.com%2Fopencollective%2Fimage%2Fupload%2Fv1508519428%2FS9gk78AS_400x400_fulq2l.jpg&height=96" alt="Facebook Open Source" height="96"></a> <a href="https://badoo.com/team?utm_source=eslint"><img src="https://images.opencollective.com/proxy/images/?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2Fbbdb9cc0-3b5d-11e9-9537-ad85092287b8.png&height=96" alt="Badoo" height="96"></a></p><h3>Silver Sponsors</h3>
<p><a href="https://www.ampproject.org/"><img src="https://images.opencollective.com/proxy/images/?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2F68ed8b70-ebf2-11e6-9958-cb7e79408c56.png&height=96" alt="AMP Project" height="64"></a></p><h3>Bronze Sponsors</h3>
-<p><a href="http://faithlife.com/ref/about"><img src="https://images.opencollective.com/proxy/images/?src=https%3A%2F%2Flogo.clearbit.com%2Ffaithlife.com&height=96" alt="Faithlife" height="32"></a></p>
+<p><a href="http://faithlife.com/ref/about"><img src="https://images.opencollective.com/proxy/images/?src=https%3A%2F%2Flogo.clearbit.com%2Ffaithlife.com&height=96" alt="Faithlife" height="32"></a> <a href="https://jsheroes.io/"><img src="https://images.opencollective.com/proxy/images/?src=https%3A%2F%2Flogo.clearbit.com%2Fjsheroes.io&height=96" alt="JSHeroes " height="32"></a></p>
<!--sponsorsend-->
## Technology Sponsors
diff --git a/tools/node_modules/eslint/lib/config/config-file.js b/tools/node_modules/eslint/lib/config/config-file.js
index 492800b7a3..80344f5097 100644
--- a/tools/node_modules/eslint/lib/config/config-file.js
+++ b/tools/node_modules/eslint/lib/config/config-file.js
@@ -541,7 +541,7 @@ function loadFromDisk(resolvedPath, configContext) {
const ruleMap = configContext.linterContext.getRules();
// validate the configuration before continuing
- validator.validate(config, resolvedPath.configFullName, ruleMap.get.bind(ruleMap), configContext.linterContext.environments);
+ validator.validate(config, ruleMap.get.bind(ruleMap), configContext.linterContext.environments, resolvedPath.configFullName);
/*
* If an `extends` property is defined, it represents a configuration file to use as
diff --git a/tools/node_modules/eslint/lib/config/config-validator.js b/tools/node_modules/eslint/lib/config/config-validator.js
index 2345b28893..386db77750 100644
--- a/tools/node_modules/eslint/lib/config/config-validator.js
+++ b/tools/node_modules/eslint/lib/config/config-validator.js
@@ -116,7 +116,7 @@ function validateRuleSchema(rule, localOptions) {
* no source is prepended to the message.
* @returns {void}
*/
-function validateRuleOptions(rule, ruleId, options, source) {
+function validateRuleOptions(rule, ruleId, options, source = null) {
if (!rule) {
return;
}
@@ -140,11 +140,11 @@ function validateRuleOptions(rule, ruleId, options, source) {
/**
* Validates an environment object
* @param {Object} environment The environment config object to validate.
- * @param {string} source The name of the configuration source to report in any errors.
* @param {Environments} envContext Env context
+ * @param {string} source The name of the configuration source to report in any errors.
* @returns {void}
*/
-function validateEnvironment(environment, source, envContext) {
+function validateEnvironment(environment, envContext, source = null) {
// not having an environment is ok
if (!environment) {
@@ -163,11 +163,11 @@ function validateEnvironment(environment, source, envContext) {
/**
* Validates a rules config object
* @param {Object} rulesConfig The rules config object to validate.
- * @param {string} source The name of the configuration source to report in any errors.
* @param {function(string): {create: Function}} ruleMapper A mapper function from strings to loaded rules
+ * @param {string} source The name of the configuration source to report in any errors.
* @returns {void}
*/
-function validateRules(rulesConfig, source, ruleMapper) {
+function validateRules(rulesConfig, ruleMapper, source = null) {
if (!rulesConfig) {
return;
}
@@ -228,7 +228,7 @@ const emitDeprecationWarning = lodash.memoize((source, errorCode) => {
* @param {string} source The name of the configuration source to report in any errors.
* @returns {void}
*/
-function validateConfigSchema(config, source) {
+function validateConfigSchema(config, source = null) {
validateSchema = validateSchema || ajv.compile(configSchema);
if (!validateSchema(config)) {
@@ -252,19 +252,19 @@ function validateConfigSchema(config, source) {
/**
* Validates an entire config object.
* @param {Object} config The config object to validate.
- * @param {string} source The name of the configuration source to report in any errors.
* @param {function(string): {create: Function}} ruleMapper A mapper function from rule IDs to defined rules
* @param {Environments} envContext The env context
+ * @param {string} source The name of the configuration source to report in any errors.
* @returns {void}
*/
-function validate(config, source, ruleMapper, envContext) {
+function validate(config, ruleMapper, envContext, source = null) {
validateConfigSchema(config, source);
- validateRules(config.rules, source, ruleMapper);
- validateEnvironment(config.env, source, envContext);
+ validateRules(config.rules, ruleMapper, source);
+ validateEnvironment(config.env, envContext, source);
for (const override of config.overrides || []) {
- validateRules(override.rules, source, ruleMapper);
- validateEnvironment(override.env, source, envContext);
+ validateRules(override.rules, ruleMapper, source);
+ validateEnvironment(override.env, envContext, source);
}
}
diff --git a/tools/node_modules/eslint/lib/linter.js b/tools/node_modules/eslint/lib/linter.js
index 88448d90f8..be38b99087 100644
--- a/tools/node_modules/eslint/lib/linter.js
+++ b/tools/node_modules/eslint/lib/linter.js
@@ -747,10 +747,15 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser
nodeQueue.forEach(traversalInfo => {
currentNode = traversalInfo.node;
- if (traversalInfo.isEntering) {
- eventGenerator.enterNode(currentNode);
- } else {
- eventGenerator.leaveNode(currentNode);
+ try {
+ if (traversalInfo.isEntering) {
+ eventGenerator.enterNode(currentNode);
+ } else {
+ eventGenerator.leaveNode(currentNode);
+ }
+ } catch (err) {
+ err.currentNode = currentNode;
+ throw err;
}
});
@@ -901,8 +906,15 @@ module.exports = class Linter {
options.filename
);
} catch (err) {
+ err.message += `\nOccurred while linting ${options.filename}`;
debug("An error occurred while traversing");
debug("Filename:", options.filename);
+ if (err.currentNode) {
+ const { line } = err.currentNode.loc.start;
+
+ debug("Line:", line);
+ err.message += `:${line}`;
+ }
debug("Parser Options:", parserOptions);
debug("Parser Path:", parserName);
debug("Settings:", settings);
diff --git a/tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js b/tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js
index ad0d70da66..50f6456184 100644
--- a/tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js
+++ b/tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js
@@ -6,8 +6,7 @@
const {
isArrowToken,
- isParenthesised,
- isOpeningParenToken
+ isParenthesised
} = require("../util/ast-utils");
//------------------------------------------------------------------------------
@@ -57,8 +56,7 @@ module.exports = {
* @param {Integer} column The column number of the first token
* @returns {string} A string of comment text joined by line breaks
*/
- function formatComments(comments, column) {
- const whiteSpaces = " ".repeat(column);
+ function formatComments(comments) {
return `${comments.map(comment => {
@@ -67,12 +65,12 @@ module.exports = {
}
return `/*${comment.value}*/`;
- }).join(`\n${whiteSpaces}`)}\n${whiteSpaces}`;
+ }).join("\n")}\n`;
}
/**
* Finds the first token to prepend comments to depending on the parent type
- * @param {Node} node The validated node
+ * @param {ASTNode} node The validated node
* @returns {Token|Node} The node to prepend comments to
*/
function findFirstToken(node) {
@@ -109,24 +107,19 @@ module.exports = {
let followingBody = arrowBody;
let currentArrow = arrow;
- while (currentArrow) {
+ while (currentArrow && followingBody.type !== "BlockStatement") {
if (!isParenthesised(sourceCode, followingBody)) {
parenthesesFixes.push(
fixer.insertTextAfter(currentArrow, " (")
);
- const paramsToken = sourceCode.getTokenBefore(currentArrow, token =>
- isOpeningParenToken(token) || token.type === "Identifier");
-
- const whiteSpaces = " ".repeat(paramsToken.loc.start.column);
-
- closingParentheses = `\n${whiteSpaces})${closingParentheses}`;
+ closingParentheses = `\n)${closingParentheses}`;
}
currentArrow = sourceCode.getTokenAfter(currentArrow, isArrowToken);
if (currentArrow) {
- followingBody = sourceCode.getTokenAfter(currentArrow, token => !isOpeningParenToken(token));
+ followingBody = followingBody.body;
}
}
@@ -137,10 +130,10 @@ module.exports = {
/**
* Autofixes the function body to collapse onto the same line as the arrow.
- * If comments exist, prepends the comments before the arrow function.
- * If the function body contains arrow functions, appends the function bodies with parentheses.
+ * If comments exist, checks if the function body contains arrow functions, and appends the body with parentheses.
+ * Otherwise, prepends the comments before the arrow function.
* @param {Token} arrowToken The arrow token.
- * @param {ASTNode} arrowBody the function body
+ * @param {ASTNode|Token} arrowBody the function body
* @param {ASTNode} node The evaluated node
* @returns {Function} autofixer -- validates the node to adhere to besides
*/
@@ -161,23 +154,18 @@ module.exports = {
) {
// If any arrow functions follow, return the necessary parens fixes.
- if (sourceCode.getTokenAfter(arrowToken, isArrowToken) && arrowBody.parent.parent.type !== "VariableDeclarator") {
+ if (node.body.type === "ArrowFunctionExpression" &&
+ arrowBody.parent.parent.type !== "VariableDeclarator"
+ ) {
return addParentheses(fixer, arrowToken, arrowBody);
}
-
- // If any arrow functions precede, the necessary fixes have already been returned, so return null.
- if (sourceCode.getTokenBefore(arrowToken, isArrowToken) && arrowBody.parent.parent.type !== "VariableDeclarator") {
- return null;
- }
}
const firstToken = findFirstToken(node);
- const commentText = formatComments(comments, firstToken.loc.start.column);
-
const commentBeforeExpression = fixer.insertTextBeforeRange(
firstToken.range,
- commentText
+ formatComments(comments)
);
return [placeBesides, commentBeforeExpression];
diff --git a/tools/node_modules/eslint/lib/testers/rule-tester.js b/tools/node_modules/eslint/lib/testers/rule-tester.js
index 6d1bba989f..f1d9155313 100644
--- a/tools/node_modules/eslint/lib/testers/rule-tester.js
+++ b/tools/node_modules/eslint/lib/testers/rule-tester.js
@@ -379,7 +379,7 @@ class RuleTester {
}
}
- validator.validate(config, "rule-tester", ruleMap.get.bind(ruleMap), new Environments());
+ validator.validate(config, ruleMap.get.bind(ruleMap), new Environments(), "rule-tester");
return {
messages: linter.verify(code, config, filename, true),
diff --git a/tools/node_modules/eslint/lib/util/glob-utils.js b/tools/node_modules/eslint/lib/util/glob-utils.js
index b05c354439..33cb8e7c88 100644
--- a/tools/node_modules/eslint/lib/util/glob-utils.js
+++ b/tools/node_modules/eslint/lib/util/glob-utils.js
@@ -70,6 +70,10 @@ function processPath(options) {
* @private
*/
return function(pathname) {
+ if (pathname === "") {
+ return "";
+ }
+
let newPath = pathname;
const resolvedPath = path.resolve(cwd, pathname);
@@ -201,6 +205,13 @@ function listFilesToProcess(globPatterns, providedOptions) {
debug("Creating list of files to process.");
const resolvedPathsByGlobPattern = resolvedGlobPatterns.map(pattern => {
+ if (pattern === "") {
+ return [{
+ filename: "",
+ behavior: SILENTLY_IGNORE
+ }];
+ }
+
const file = path.resolve(cwd, pattern);
if (options.globInputPaths === false || (fs.existsSync(file) && fs.statSync(file).isFile())) {
@@ -240,7 +251,7 @@ function listFilesToProcess(globPatterns, providedOptions) {
});
const allPathDescriptors = resolvedPathsByGlobPattern.reduce((pathsForAllGlobs, pathsForCurrentGlob, index) => {
- if (pathsForCurrentGlob.every(pathDescriptor => pathDescriptor.behavior === SILENTLY_IGNORE)) {
+ if (pathsForCurrentGlob.every(pathDescriptor => pathDescriptor.behavior === SILENTLY_IGNORE && pathDescriptor.filename !== "")) {
throw new (pathsForCurrentGlob.length ? AllFilesIgnoredError : NoFilesFoundError)(globPatterns[index]);
}
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 b3c5040bb1..f0c3006c60 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
@@ -49,11 +49,6 @@ function isStrictScope(scope, block, isMethodDefinition, useDirective) {
return true;
}
- // ArrowFunctionExpression's scope is always strict scope.
- if (block.type === Syntax.ArrowFunctionExpression) {
- return true;
- }
-
if (isMethodDefinition) {
return true;
}
@@ -67,6 +62,10 @@ function isStrictScope(scope, block, isMethodDefinition, useDirective) {
}
if (scope.type === "function") {
+ if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) {
+ return false;
+ }
+
if (block.type === Syntax.Program) {
body = block;
} else {
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 1d38e54977..f3239af383 100644
--- a/tools/node_modules/eslint/node_modules/eslint-scope/package.json
+++ b/tools/node_modules/eslint/node_modules/eslint-scope/package.json
@@ -47,5 +47,5 @@
"publish-release": "eslint-publish-release",
"test": "node Makefile.js test"
},
- "version": "4.0.2"
+ "version": "4.0.3"
} \ No newline at end of file
diff --git a/tools/node_modules/eslint/package.json b/tools/node_modules/eslint/package.json
index c07c99868f..885af12a72 100644
--- a/tools/node_modules/eslint/package.json
+++ b/tools/node_modules/eslint/package.json
@@ -18,7 +18,7 @@
"debug": "^4.0.1",
"doctrine": "^3.0.0",
"eslint-plugin-markdown": "^1.0.0",
- "eslint-scope": "^4.0.2",
+ "eslint-scope": "^4.0.3",
"eslint-utils": "^1.3.1",
"eslint-visitor-keys": "^1.0.0",
"espree": "^5.0.1",
@@ -64,11 +64,11 @@
"coveralls": "^3.0.1",
"dateformat": "^3.0.3",
"ejs": "^2.6.1",
+ "eslint-config-eslint": "file:packages/eslint-config-eslint",
"eslint-plugin-eslint-plugin": "^2.0.1",
+ "eslint-plugin-internal-rules": "file:tools/internal-rules",
"eslint-plugin-node": "^8.0.0",
- "eslint-plugin-rulesdir": "^0.1.0",
"eslint-release": "^1.2.0",
- "eslint-rule-composer": "^0.3.0",
"eslump": "^2.0.0",
"esprima": "^4.0.1",
"istanbul": "^0.4.5",
@@ -135,5 +135,5 @@
"test": "node Makefile.js test",
"webpack": "node Makefile.js webpack"
},
- "version": "5.15.1"
+ "version": "5.15.2"
} \ No newline at end of file