aboutsummaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/lib
diff options
context:
space:
mode:
authorcjihrig <cjihrig@gmail.com>2019-01-04 16:11:19 -0500
committercjihrig <cjihrig@gmail.com>2019-01-07 08:49:17 -0500
commitec5884a94f24351b2920ac3e54960999fdc05054 (patch)
tree2318bee2fd4943d26b37859aa4d484cd38e2ea0a /tools/node_modules/eslint/lib
parent076d8b9f9da195fd3ff1d8cadeac0605cbd91d7b (diff)
downloadandroid-node-v8-ec5884a94f24351b2920ac3e54960999fdc05054.tar.gz
android-node-v8-ec5884a94f24351b2920ac3e54960999fdc05054.tar.bz2
android-node-v8-ec5884a94f24351b2920ac3e54960999fdc05054.zip
tools: update ESLint to 5.12.0
Update ESLint to 5.12.0. PR-URL: https://github.com/nodejs/node/pull/25347 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yuta Hiroto <hello@hiroppy.me> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'tools/node_modules/eslint/lib')
-rw-r--r--tools/node_modules/eslint/lib/config/config-file.js4
-rw-r--r--tools/node_modules/eslint/lib/rules/block-spacing.js4
-rw-r--r--tools/node_modules/eslint/lib/rules/capitalized-comments.js4
-rw-r--r--tools/node_modules/eslint/lib/rules/func-name-matching.js8
-rw-r--r--tools/node_modules/eslint/lib/rules/max-classes-per-file.js2
-rw-r--r--tools/node_modules/eslint/lib/rules/no-param-reassign.js8
-rw-r--r--tools/node_modules/eslint/lib/rules/prefer-object-spread.js4
-rw-r--r--tools/node_modules/eslint/lib/rules/sort-imports.js80
8 files changed, 64 insertions, 50 deletions
diff --git a/tools/node_modules/eslint/lib/config/config-file.js b/tools/node_modules/eslint/lib/config/config-file.js
index d09b366884..dde79cb40c 100644
--- a/tools/node_modules/eslint/lib/config/config-file.js
+++ b/tools/node_modules/eslint/lib/config/config-file.js
@@ -18,7 +18,7 @@ const fs = require("fs"),
pathIsInside = require("path-is-inside"),
stripComments = require("strip-json-comments"),
stringify = require("json-stable-stringify-without-jsonify"),
- requireUncached = require("require-uncached");
+ importFresh = require("import-fresh");
const debug = require("debug")("eslint:config-file");
@@ -156,7 +156,7 @@ function loadLegacyConfigFile(filePath) {
function loadJSConfigFile(filePath) {
debug(`Loading JS config file: ${filePath}`);
try {
- return requireUncached(filePath);
+ return importFresh(filePath);
} catch (e) {
debug(`Error reading JavaScript file: ${filePath}`);
e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`;
diff --git a/tools/node_modules/eslint/lib/rules/block-spacing.js b/tools/node_modules/eslint/lib/rules/block-spacing.js
index 6496f8596d..864bfc0c5c 100644
--- a/tools/node_modules/eslint/lib/rules/block-spacing.js
+++ b/tools/node_modules/eslint/lib/rules/block-spacing.js
@@ -29,8 +29,8 @@ module.exports = {
],
messages: {
- missing: "Requires a space {{location}} '{{token}}'",
- extra: "Unexpected space(s) {{location}} '{{token}}'"
+ missing: "Requires a space {{location}} '{{token}}'.",
+ extra: "Unexpected space(s) {{location}} '{{token}}'."
}
},
diff --git a/tools/node_modules/eslint/lib/rules/capitalized-comments.js b/tools/node_modules/eslint/lib/rules/capitalized-comments.js
index 86427ba7ac..7947833b27 100644
--- a/tools/node_modules/eslint/lib/rules/capitalized-comments.js
+++ b/tools/node_modules/eslint/lib/rules/capitalized-comments.js
@@ -137,8 +137,8 @@ module.exports = {
],
messages: {
- unexpectedLowercaseComment: "Comments should not begin with a lowercase character",
- unexpectedUppercaseComment: "Comments should not begin with an uppercase character"
+ unexpectedLowercaseComment: "Comments should not begin with a lowercase character.",
+ unexpectedUppercaseComment: "Comments should not begin with an uppercase character."
}
},
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 f14c998dc7..5560c69208 100644
--- a/tools/node_modules/eslint/lib/rules/func-name-matching.js
+++ b/tools/node_modules/eslint/lib/rules/func-name-matching.js
@@ -92,10 +92,10 @@ module.exports = {
},
messages: {
- matchProperty: "Function name `{{funcName}}` should match property name `{{name}}`",
- matchVariable: "Function name `{{funcName}}` should match variable name `{{name}}`",
- notMatchProperty: "Function name `{{funcName}}` should not match property name `{{name}}`",
- notMatchVariable: "Function name `{{funcName}}` should not match variable name `{{name}}`"
+ matchProperty: "Function name `{{funcName}}` should match property name `{{name}}`.",
+ matchVariable: "Function name `{{funcName}}` should match variable name `{{name}}`.",
+ notMatchProperty: "Function name `{{funcName}}` should not match property name `{{name}}`.",
+ notMatchVariable: "Function name `{{funcName}}` should not match variable name `{{name}}`."
}
},
diff --git a/tools/node_modules/eslint/lib/rules/max-classes-per-file.js b/tools/node_modules/eslint/lib/rules/max-classes-per-file.js
index 3193a731c9..ae7be904f9 100644
--- a/tools/node_modules/eslint/lib/rules/max-classes-per-file.js
+++ b/tools/node_modules/eslint/lib/rules/max-classes-per-file.js
@@ -32,7 +32,7 @@ module.exports = {
],
messages: {
- maximumExceeded: "Number of classes per file must not exceed {{ max }}"
+ maximumExceeded: "Number of classes per file must not exceed {{ max }}."
}
},
create(context) {
diff --git a/tools/node_modules/eslint/lib/rules/no-param-reassign.js b/tools/node_modules/eslint/lib/rules/no-param-reassign.js
index 243bb6412c..349345c148 100644
--- a/tools/node_modules/eslint/lib/rules/no-param-reassign.js
+++ b/tools/node_modules/eslint/lib/rules/no-param-reassign.js
@@ -107,6 +107,14 @@ module.exports = {
break;
+ // EXCLUDES: e.g. (foo ? a : b).c = bar;
+ case "ConditionalExpression":
+ if (parent.test === node) {
+ return false;
+ }
+
+ break;
+
// no default
}
diff --git a/tools/node_modules/eslint/lib/rules/prefer-object-spread.js b/tools/node_modules/eslint/lib/rules/prefer-object-spread.js
index a8dac696be..4d724339db 100644
--- a/tools/node_modules/eslint/lib/rules/prefer-object-spread.js
+++ b/tools/node_modules/eslint/lib/rules/prefer-object-spread.js
@@ -226,8 +226,8 @@ module.exports = {
fixable: "code",
messages: {
- useSpreadMessage: "Use an object spread instead of `Object.assign` eg: `{ ...foo }`",
- useLiteralMessage: "Use an object literal instead of `Object.assign`. eg: `{ foo: bar }`"
+ useSpreadMessage: "Use an object spread instead of `Object.assign` eg: `{ ...foo }`.",
+ useLiteralMessage: "Use an object literal instead of `Object.assign`. eg: `{ foo: bar }`."
}
},
diff --git a/tools/node_modules/eslint/lib/rules/sort-imports.js b/tools/node_modules/eslint/lib/rules/sort-imports.js
index 76997cc73d..1c0d134046 100644
--- a/tools/node_modules/eslint/lib/rules/sort-imports.js
+++ b/tools/node_modules/eslint/lib/rules/sort-imports.js
@@ -36,6 +36,9 @@ module.exports = {
minItems: 4,
maxItems: 4
},
+ ignoreDeclarationSort: {
+ type: "boolean"
+ },
ignoreMemberSort: {
type: "boolean"
}
@@ -51,6 +54,7 @@ module.exports = {
const configuration = context.options[0] || {},
ignoreCase = configuration.ignoreCase || false,
+ ignoreDeclarationSort = configuration.ignoreDeclarationSort || false,
ignoreMemberSort = configuration.ignoreMemberSort || false,
memberSyntaxSortOrder = configuration.memberSyntaxSortOrder || ["none", "all", "multiple", "single"],
sourceCode = context.getSourceCode();
@@ -105,44 +109,48 @@ module.exports = {
return {
ImportDeclaration(node) {
- if (previousDeclaration) {
- const currentMemberSyntaxGroupIndex = getMemberParameterGroupIndex(node),
- previousMemberSyntaxGroupIndex = getMemberParameterGroupIndex(previousDeclaration);
- let currentLocalMemberName = getFirstLocalMemberName(node),
- previousLocalMemberName = getFirstLocalMemberName(previousDeclaration);
-
- if (ignoreCase) {
- previousLocalMemberName = previousLocalMemberName && previousLocalMemberName.toLowerCase();
- currentLocalMemberName = currentLocalMemberName && currentLocalMemberName.toLowerCase();
- }
-
- /*
- * When the current declaration uses a different member syntax,
- * then check if the ordering is correct.
- * Otherwise, make a default string compare (like rule sort-vars to be consistent) of the first used local member name.
- */
- if (currentMemberSyntaxGroupIndex !== previousMemberSyntaxGroupIndex) {
- if (currentMemberSyntaxGroupIndex < previousMemberSyntaxGroupIndex) {
- context.report({
- node,
- message: "Expected '{{syntaxA}}' syntax before '{{syntaxB}}' syntax.",
- data: {
- syntaxA: memberSyntaxSortOrder[currentMemberSyntaxGroupIndex],
- syntaxB: memberSyntaxSortOrder[previousMemberSyntaxGroupIndex]
- }
- });
+ if (!ignoreDeclarationSort) {
+ if (previousDeclaration) {
+ const currentMemberSyntaxGroupIndex = getMemberParameterGroupIndex(node),
+ previousMemberSyntaxGroupIndex = getMemberParameterGroupIndex(previousDeclaration);
+ let currentLocalMemberName = getFirstLocalMemberName(node),
+ previousLocalMemberName = getFirstLocalMemberName(previousDeclaration);
+
+ if (ignoreCase) {
+ previousLocalMemberName = previousLocalMemberName && previousLocalMemberName.toLowerCase();
+ currentLocalMemberName = currentLocalMemberName && currentLocalMemberName.toLowerCase();
}
- } else {
- if (previousLocalMemberName &&
- currentLocalMemberName &&
- currentLocalMemberName < previousLocalMemberName
- ) {
- context.report({
- node,
- message: "Imports should be sorted alphabetically."
- });
+
+ /*
+ * When the current declaration uses a different member syntax,
+ * then check if the ordering is correct.
+ * Otherwise, make a default string compare (like rule sort-vars to be consistent) of the first used local member name.
+ */
+ if (currentMemberSyntaxGroupIndex !== previousMemberSyntaxGroupIndex) {
+ if (currentMemberSyntaxGroupIndex < previousMemberSyntaxGroupIndex) {
+ context.report({
+ node,
+ message: "Expected '{{syntaxA}}' syntax before '{{syntaxB}}' syntax.",
+ data: {
+ syntaxA: memberSyntaxSortOrder[currentMemberSyntaxGroupIndex],
+ syntaxB: memberSyntaxSortOrder[previousMemberSyntaxGroupIndex]
+ }
+ });
+ }
+ } else {
+ if (previousLocalMemberName &&
+ currentLocalMemberName &&
+ currentLocalMemberName < previousLocalMemberName
+ ) {
+ context.report({
+ node,
+ message: "Imports should be sorted alphabetically."
+ });
+ }
}
}
+
+ previousDeclaration = node;
}
if (!ignoreMemberSort) {
@@ -191,8 +199,6 @@ module.exports = {
});
}
}
-
- previousDeclaration = node;
}
};
}