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>
This commit is contained in:
parent
bab5544476
commit
1ceb6d8e9b
2
tools/node_modules/eslint/README.md
generated
vendored
2
tools/node_modules/eslint/README.md
generated
vendored
@ -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
|
||||
|
2
tools/node_modules/eslint/lib/config/config-file.js
generated
vendored
2
tools/node_modules/eslint/lib/config/config-file.js
generated
vendored
@ -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
|
||||
|
24
tools/node_modules/eslint/lib/config/config-validator.js
generated
vendored
24
tools/node_modules/eslint/lib/config/config-validator.js
generated
vendored
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
12
tools/node_modules/eslint/lib/linter.js
generated
vendored
12
tools/node_modules/eslint/lib/linter.js
generated
vendored
@ -747,11 +747,16 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser
|
||||
nodeQueue.forEach(traversalInfo => {
|
||||
currentNode = traversalInfo.node;
|
||||
|
||||
try {
|
||||
if (traversalInfo.isEntering) {
|
||||
eventGenerator.enterNode(currentNode);
|
||||
} else {
|
||||
eventGenerator.leaveNode(currentNode);
|
||||
}
|
||||
} catch (err) {
|
||||
err.currentNode = currentNode;
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
return lintingProblems;
|
||||
@ -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);
|
||||
|
40
tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js
generated
vendored
40
tools/node_modules/eslint/lib/rules/implicit-arrow-linebreak.js
generated
vendored
@ -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];
|
||||
|
2
tools/node_modules/eslint/lib/testers/rule-tester.js
generated
vendored
2
tools/node_modules/eslint/lib/testers/rule-tester.js
generated
vendored
@ -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),
|
||||
|
13
tools/node_modules/eslint/lib/util/glob-utils.js
generated
vendored
13
tools/node_modules/eslint/lib/util/glob-utils.js
generated
vendored
@ -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]);
|
||||
}
|
||||
|
||||
|
9
tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js
generated
vendored
9
tools/node_modules/eslint/node_modules/eslint-scope/lib/scope.js
generated
vendored
@ -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 {
|
||||
|
2
tools/node_modules/eslint/node_modules/eslint-scope/package.json
generated
vendored
2
tools/node_modules/eslint/node_modules/eslint-scope/package.json
generated
vendored
@ -47,5 +47,5 @@
|
||||
"publish-release": "eslint-publish-release",
|
||||
"test": "node Makefile.js test"
|
||||
},
|
||||
"version": "4.0.2"
|
||||
"version": "4.0.3"
|
||||
}
|
8
tools/node_modules/eslint/package.json
generated
vendored
8
tools/node_modules/eslint/package.json
generated
vendored
@ -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"
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user