Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: eslint @ 5.15.1 .. 5.15.2

CHANGELOG.md

@@ -1,3 +1,23 @@
+v5.15.2 - March 15, 2019
+
+* [`29dbca7`](https://github.com/eslint/eslint/commit/29dbca73d762a809adb2f457b527e144426d54a7) Fix: implicit-arrow-linebreak adds extra characters (fixes #11268) (#11407) (Mark de Dios)
+* [`5d2083f`](https://github.com/eslint/eslint/commit/5d2083fa3e14c024197f6c386ff72237a145e258) Upgrade: eslint-scope@4.0.3 (#11513) (Teddy Katz)
+* [`a5dae7c`](https://github.com/eslint/eslint/commit/a5dae7c3d30231c2f5f075d98c2c8825899bab16) Fix: Empty glob pattern incorrectly expands to "/**" (#11476) (Ben Chauvette)
+* [`448e8da`](https://github.com/eslint/eslint/commit/448e8da94d09b397e98ffcb6f22b55a578ef79c1) Chore: improve crash reporting (fixes #11304) (#11463) (Alex Zherdev)
+* [`0f56dc6`](https://github.com/eslint/eslint/commit/0f56dc6d9eadad05dc3d5c9d1d9ddef94e10c5d3) Chore: make config validator params more consistent (#11435) (薛定谔的猫)
+* [`d6c1122`](https://github.com/eslint/eslint/commit/d6c112289f0f16ade070865c8786831b7940ca79) Docs: Add working groups to maintainer guide (#11400) (Nicholas C. Zakas)
+* [`5fdb4d3`](https://github.com/eslint/eslint/commit/5fdb4d3fb01b9d8a4c2dff71ed9cddb2f8feefb0) Build: compile deps to ES5 when generating browser file (fixes #11504) (#11505) (Teddy Katz)
+* [`06fa165`](https://github.com/eslint/eslint/commit/06fa1655c3da8394ed9144d727115fc434b0416f) Build: update CI testing configuration (#11500) (Reece Dunham)
+* [`956e883`](https://github.com/eslint/eslint/commit/956e883c21fd9f393bf6718d032a4e2e53b33f22) Docs: Fix example in no-restricted-modules docs (#11454) (Paul O’Shannessy)
+* [`2c7431d`](https://github.com/eslint/eslint/commit/2c7431d6b32063f74e3837ee727f26af215eada7) Docs: fix json schema example dead link (#11498) (kazuya kawaguchi)
+* [`e7266c2`](https://github.com/eslint/eslint/commit/e7266c2478aff5d66e7859313feb49e3a129f85e) Docs: Fix invalid JSON in "Specifying Parser Options" (#11492) (Mihira Jayasekera)
+* [`6693161`](https://github.com/eslint/eslint/commit/6693161978a83e0730d5ea0fecdb627c5a2acdfd) Sponsors: Sync README with website (ESLint Jenkins)
+* [`62fee4a`](https://github.com/eslint/eslint/commit/62fee4a976897d158c8c137339728cd280333286) Chore: eslint-config-eslint enable comma-dangle functions: "never" (#11434) (薛定谔的猫)
+* [`34a5382`](https://github.com/eslint/eslint/commit/34a53829e7a63ff2f6b371d77ce283bbdd373b91) Build: copy bundled espree to website directory (#11478) (Pig Fang)
+* [`f078f9a`](https://github.com/eslint/eslint/commit/f078f9a9e094ec00c61a6ef1c9550d017631e69a) Chore: use "file:" dependencies for internal rules/config (#11465) (Teddy Katz)
+* [`0756128`](https://github.com/eslint/eslint/commit/075612871f85aa04cef8137bd32247e128ad600b) Docs: Add `visualstudio` to formatter list (#11480) (Patrick Eriksson)
+* [`44de9d7`](https://github.com/eslint/eslint/commit/44de9d7e1aa2fcae475a97b8f597b7d8094566b2) Docs: Fix typo in func-name-matching rule docs (#11484) (Iulian Onofrei)
+
v5.15.1 - March 4, 2019
* [`fe1a892`](https://github.com/eslint/eslint/commit/fe1a892f85b09c3d2fea05bef011530a678a6af5) Build: bundle espree (fixes eslint/eslint.github.io#546) (#11467) (薛定谔的猫)

lib/config/config-file.js

@@ -541,7 +541,7 @@
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

lib/config/config-validator.js

@@ -116,7 +116,7 @@
* 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 @@
/**
* 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 @@
/**
* 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 @@
* @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 @@
/**
* 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);
}
}

lib/linter.js

@@ -747,11 +747,16 @@
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 @@
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);

lib/rules/implicit-arrow-linebreak.js

@@ -6,8 +6,7 @@
const {
isArrowToken,
- isParenthesised,
- isOpeningParenToken
+ isParenthesised
} = require("../util/ast-utils");
//------------------------------------------------------------------------------
@@ -57,8 +56,7 @@
* @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 @@
}
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 @@
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 @@
/**
* 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 @@
) {
// 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];

lib/testers/rule-tester.js

@@ -379,7 +379,7 @@
}
}
- 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),

lib/util/glob-utils.js

@@ -70,6 +70,10 @@
* @private
*/
return function(pathname) {
+ if (pathname === "") {
+ return "";
+ }
+
let newPath = pathname;
const resolvedPath = path.resolve(cwd, pathname);
@@ -201,6 +205,13 @@
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 @@
});
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]);
}

package.json

@@ -1,6 +1,6 @@
{
"name": "eslint",
- "version": "5.15.1",
+ "version": "5.15.2",
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
"description": "An AST-based pattern checker for JavaScript.",
"bin": {
@@ -41,7 +41,7 @@
"cross-spawn": "^6.0.5",
"debug": "^4.0.1",
"doctrine": "^3.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",
@@ -85,11 +85,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",

README.md

@@ -268,7 +268,7 @@
<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