eslint 6.0.0-alpha.1 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +71 -0
- package/README.md +28 -21
- package/bin/eslint.js +2 -2
- package/conf/config-schema.js +38 -31
- package/conf/environments.js +1 -1
- package/conf/eslint-all.js +2 -2
- package/conf/eslint-recommended.js +1 -1
- package/lib/api.js +7 -3
- package/lib/cli-engine/cascading-config-array-factory.js +20 -8
- package/lib/{cli-engine.js → cli-engine/cli-engine.js} +44 -21
- package/lib/cli-engine/config-array/config-array.js +7 -8
- package/lib/cli-engine/config-array/config-dependency.js +2 -2
- package/lib/cli-engine/config-array/extracted-config.js +3 -3
- package/lib/cli-engine/config-array/override-tester.js +11 -1
- package/lib/cli-engine/config-array-factory.js +75 -65
- package/lib/cli-engine/file-enumerator.js +14 -6
- package/lib/{formatters → cli-engine/formatters}/checkstyle.js +1 -1
- package/lib/{formatters → cli-engine/formatters}/codeframe.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/compact.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/html-template-message.html +0 -0
- package/lib/{formatters → cli-engine/formatters}/html-template-page.html +0 -0
- package/lib/{formatters → cli-engine/formatters}/html-template-result.html +0 -0
- package/lib/{formatters → cli-engine/formatters}/html.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/jslint-xml.js +1 -1
- package/lib/{formatters → cli-engine/formatters}/json-with-metadata.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/json.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/junit.js +15 -3
- package/lib/{formatters → cli-engine/formatters}/stylish.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/table.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/tap.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/unix.js +0 -0
- package/lib/{formatters → cli-engine/formatters}/visualstudio.js +0 -0
- package/lib/{util → cli-engine}/hash.js +0 -0
- package/lib/{util → cli-engine}/ignored-paths.js +6 -1
- package/lib/cli-engine/index.js +7 -0
- package/lib/{util → cli-engine}/lint-result-cache.js +0 -0
- package/lib/{load-rules.js → cli-engine/load-rules.js} +0 -0
- package/lib/{util → cli-engine}/naming.js +0 -0
- package/lib/{util → cli-engine}/xml-escape.js +0 -0
- package/lib/cli.js +3 -3
- package/lib/{config → init}/autoconfig.js +3 -3
- package/lib/{config → init}/config-file.js +0 -0
- package/lib/{config → init}/config-initializer.js +6 -6
- package/lib/{config → init}/config-rule.js +8 -2
- package/lib/{util → init}/npm-utils.js +1 -1
- package/lib/{util → init}/source-code-utils.js +16 -1
- package/lib/{util → linter}/apply-disable-directives.js +0 -0
- package/lib/{code-path-analysis → linter/code-path-analysis}/code-path-analyzer.js +19 -6
- package/lib/{code-path-analysis → linter/code-path-analysis}/code-path-segment.js +0 -0
- package/lib/{code-path-analysis → linter/code-path-analysis}/code-path-state.js +0 -0
- package/lib/{code-path-analysis → linter/code-path-analysis}/code-path.js +0 -0
- package/lib/{code-path-analysis → linter/code-path-analysis}/debug-helpers.js +0 -0
- package/lib/{code-path-analysis → linter/code-path-analysis}/fork-context.js +0 -0
- package/lib/{code-path-analysis → linter/code-path-analysis}/id-generator.js +0 -0
- package/lib/{util → linter}/config-comment-parser.js +1 -1
- package/lib/linter/index.js +13 -0
- package/lib/{util → linter}/interpolate.js +0 -0
- package/lib/{linter.js → linter/linter.js} +298 -152
- package/lib/{util → linter}/node-event-generator.js +7 -5
- package/lib/{util → linter}/report-translator.js +0 -0
- package/lib/{util → linter}/rule-fixer.js +0 -0
- package/lib/{rules.js → linter/rules.js} +3 -29
- package/lib/{util → linter}/safe-emitter.js +0 -0
- package/lib/{util → linter}/source-code-fixer.js +0 -0
- package/lib/{util → linter}/timing.js +1 -1
- package/lib/rule-tester/index.js +5 -0
- package/lib/{testers → rule-tester}/rule-tester.js +43 -15
- package/lib/rules/array-bracket-newline.js +1 -1
- package/lib/rules/array-bracket-spacing.js +1 -1
- package/lib/rules/array-callback-return.js +1 -1
- package/lib/rules/array-element-newline.js +1 -1
- package/lib/rules/arrow-body-style.js +1 -1
- package/lib/rules/arrow-parens.js +22 -1
- package/lib/rules/arrow-spacing.js +1 -1
- package/lib/rules/block-spacing.js +1 -1
- package/lib/rules/brace-style.js +1 -1
- package/lib/rules/capitalized-comments.js +2 -2
- package/lib/rules/comma-dangle.js +1 -1
- package/lib/rules/comma-spacing.js +1 -1
- package/lib/rules/comma-style.js +1 -1
- package/lib/rules/complexity.js +3 -3
- package/lib/rules/computed-property-spacing.js +1 -1
- package/lib/rules/consistent-return.js +1 -1
- package/lib/rules/curly.js +1 -1
- package/lib/rules/dot-location.js +1 -1
- package/lib/rules/dot-notation.js +2 -2
- package/lib/rules/eqeqeq.js +1 -1
- package/lib/rules/func-call-spacing.js +1 -1
- package/lib/rules/func-name-matching.js +1 -1
- package/lib/rules/func-names.js +1 -1
- package/lib/rules/function-paren-newline.js +1 -1
- package/lib/rules/getter-return.js +1 -1
- package/lib/rules/implicit-arrow-linebreak.js +1 -1
- package/lib/rules/indent-legacy.js +1 -1
- package/lib/rules/indent.js +1 -1
- package/lib/rules/index.js +281 -0
- package/lib/rules/jsx-quotes.js +1 -1
- package/lib/rules/key-spacing.js +1 -1
- package/lib/rules/keyword-spacing.js +2 -2
- package/lib/rules/line-comment-position.js +1 -1
- package/lib/rules/linebreak-style.js +1 -1
- package/lib/rules/lines-around-comment.js +1 -1
- package/lib/rules/lines-around-directive.js +1 -1
- package/lib/rules/lines-between-class-members.js +1 -1
- package/lib/rules/max-classes-per-file.js +2 -1
- package/lib/rules/max-depth.js +2 -2
- package/lib/rules/max-len.js +11 -4
- package/lib/rules/max-lines-per-function.js +4 -2
- package/lib/rules/max-lines.js +2 -2
- package/lib/rules/max-params.js +1 -1
- package/lib/rules/max-statements-per-line.js +1 -1
- package/lib/rules/max-statements.js +1 -1
- package/lib/rules/multiline-comment-style.js +3 -2
- package/lib/rules/multiline-ternary.js +1 -1
- package/lib/rules/new-parens.js +43 -11
- package/lib/rules/newline-after-var.js +1 -1
- package/lib/rules/newline-per-chained-call.js +1 -1
- package/lib/rules/no-alert.js +1 -1
- package/lib/rules/no-catch-shadow.js +1 -1
- package/lib/rules/no-class-assign.js +1 -1
- package/lib/rules/no-cond-assign.js +1 -1
- package/lib/rules/no-confusing-arrow.js +1 -1
- package/lib/rules/no-console.js +1 -1
- package/lib/rules/no-const-assign.js +1 -1
- package/lib/rules/no-div-regex.js +9 -1
- package/lib/rules/no-dupe-keys.js +1 -1
- package/lib/rules/no-else-return.js +129 -2
- package/lib/rules/no-empty-function.js +1 -1
- package/lib/rules/no-empty.js +1 -1
- package/lib/rules/no-eval.js +1 -1
- package/lib/rules/no-ex-assign.js +1 -1
- package/lib/rules/no-extend-native.js +1 -1
- package/lib/rules/no-extra-bind.js +1 -1
- package/lib/rules/no-extra-boolean-cast.js +1 -1
- package/lib/rules/no-extra-label.js +1 -1
- package/lib/rules/no-extra-parens.js +1 -1
- package/lib/rules/no-extra-semi.js +2 -2
- package/lib/rules/no-floating-decimal.js +1 -1
- package/lib/rules/no-func-assign.js +1 -1
- package/lib/rules/no-implicit-coercion.js +1 -1
- package/lib/rules/no-inline-comments.js +1 -1
- package/lib/rules/no-invalid-this.js +1 -1
- package/lib/rules/no-irregular-whitespace.js +1 -1
- package/lib/rules/no-label-var.js +1 -1
- package/lib/rules/no-labels.js +1 -1
- package/lib/rules/no-misleading-character-class.js +1 -1
- package/lib/rules/no-mixed-operators.js +1 -1
- package/lib/rules/no-multi-spaces.js +1 -1
- package/lib/rules/no-multi-str.js +1 -1
- package/lib/rules/no-octal.js +1 -1
- package/lib/rules/no-redeclare.js +1 -1
- package/lib/rules/no-regex-spaces.js +1 -1
- package/lib/rules/no-restricted-imports.js +18 -14
- package/lib/rules/no-restricted-properties.js +1 -1
- package/lib/rules/no-return-assign.js +1 -1
- package/lib/rules/no-return-await.js +1 -1
- package/lib/rules/no-self-assign.js +1 -1
- package/lib/rules/no-sequences.js +1 -1
- package/lib/rules/no-shadow.js +1 -1
- package/lib/rules/no-this-before-super.js +1 -1
- package/lib/rules/no-throw-literal.js +1 -1
- package/lib/rules/no-trailing-spaces.js +1 -1
- package/lib/rules/no-undef-init.js +1 -1
- package/lib/rules/no-unexpected-multiline.js +1 -1
- package/lib/rules/no-unmodified-loop-condition.js +2 -2
- package/lib/rules/no-unneeded-ternary.js +1 -1
- package/lib/rules/no-unsafe-negation.js +1 -1
- package/lib/rules/no-unused-vars.js +1 -1
- package/lib/rules/no-useless-call.js +1 -1
- package/lib/rules/no-useless-computed-key.js +1 -1
- package/lib/rules/no-useless-concat.js +1 -1
- package/lib/rules/no-useless-escape.js +7 -2
- package/lib/rules/no-useless-return.js +2 -2
- package/lib/rules/no-var.js +15 -2
- package/lib/rules/no-warning-comments.js +1 -1
- package/lib/rules/no-whitespace-before-property.js +1 -1
- package/lib/rules/object-curly-newline.js +1 -1
- package/lib/rules/object-curly-spacing.js +1 -1
- package/lib/rules/object-shorthand.js +1 -1
- package/lib/rules/operator-assignment.js +1 -1
- package/lib/rules/operator-linebreak.js +1 -1
- package/lib/rules/padded-blocks.js +1 -1
- package/lib/rules/padding-line-between-statements.js +1 -1
- package/lib/rules/prefer-const.js +1 -1
- package/lib/rules/prefer-object-spread.js +1 -1
- package/lib/rules/prefer-promise-reject-errors.js +1 -1
- package/lib/rules/prefer-spread.js +1 -1
- package/lib/rules/prefer-template.js +1 -1
- package/lib/rules/quote-props.js +1 -1
- package/lib/rules/quotes.js +1 -1
- package/lib/rules/radix.js +1 -1
- package/lib/rules/require-atomic-updates.js +63 -84
- package/lib/rules/require-await.js +1 -1
- package/lib/rules/semi-spacing.js +1 -1
- package/lib/rules/semi-style.js +1 -1
- package/lib/rules/semi.js +2 -2
- package/lib/rules/sort-keys.js +12 -4
- package/lib/rules/space-before-blocks.js +1 -1
- package/lib/rules/space-before-function-paren.js +1 -1
- package/lib/rules/space-in-parens.js +1 -1
- package/lib/rules/space-unary-ops.js +1 -1
- package/lib/rules/spaced-comment.js +1 -1
- package/lib/rules/strict.js +1 -1
- package/lib/rules/switch-colon-spacing.js +1 -1
- package/lib/rules/symbol-description.js +1 -1
- package/lib/rules/template-curly-spacing.js +1 -1
- package/lib/{util → rules/utils}/ast-utils.js +8 -27
- package/lib/{util → rules/utils}/fix-tracker.js +1 -1
- package/lib/{util → rules/utils}/keywords.js +0 -0
- package/lib/{util → rules/utils}/lazy-loading-rule-map.js +0 -0
- package/lib/{util → rules/utils}/patterns/letters.js +0 -0
- package/lib/{util → rules/utils}/unicode/index.js +0 -0
- package/lib/{util → rules/utils}/unicode/is-combining-character.js +0 -0
- package/lib/{util → rules/utils}/unicode/is-emoji-modifier.js +0 -0
- package/lib/{util → rules/utils}/unicode/is-regional-indicator-symbol.js +0 -0
- package/lib/{util → rules/utils}/unicode/is-surrogate-pair.js +0 -0
- package/lib/rules/valid-typeof.js +1 -1
- package/lib/rules/wrap-iife.js +1 -1
- package/lib/rules/yoda.js +1 -1
- package/lib/{util → shared}/ajv.js +0 -0
- package/lib/shared/ast-utils.js +29 -0
- package/lib/{config → shared}/config-ops.js +0 -0
- package/lib/{config → shared}/config-validator.js +22 -7
- package/lib/{util → shared}/logging.js +0 -0
- package/lib/{util → shared}/relative-module-resolver.js +10 -3
- package/lib/{util → shared}/traverser.js +0 -0
- package/lib/{util → shared}/types.js +4 -0
- package/lib/source-code/index.js +5 -0
- package/lib/{util → source-code}/source-code.js +10 -8
- package/lib/{token-store → source-code/token-store}/backward-token-comment-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/backward-token-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/cursors.js +0 -0
- package/lib/{token-store → source-code/token-store}/decorative-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/filter-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/forward-token-comment-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/forward-token-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/index.js +3 -3
- package/lib/{token-store → source-code/token-store}/limit-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/padded-token-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/skip-cursor.js +0 -0
- package/lib/{token-store → source-code/token-store}/utils.js +0 -0
- package/messages/extend-config-missing.txt +2 -0
- package/messages/print-config-with-directory-path.txt +2 -0
- package/package.json +8 -11
- package/lib/built-in-rules-index.js +0 -281
@@ -10,11 +10,11 @@
|
|
10
10
|
//------------------------------------------------------------------------------
|
11
11
|
|
12
12
|
const assert = require("assert"),
|
13
|
+
{ breakableTypePattern } = require("../../shared/ast-utils"),
|
13
14
|
CodePath = require("./code-path"),
|
14
15
|
CodePathSegment = require("./code-path-segment"),
|
15
16
|
IdGenerator = require("./id-generator"),
|
16
|
-
debug = require("./debug-helpers")
|
17
|
-
astUtils = require("../util/ast-utils");
|
17
|
+
debug = require("./debug-helpers");
|
18
18
|
|
19
19
|
//------------------------------------------------------------------------------
|
20
20
|
// Helpers
|
@@ -41,6 +41,19 @@ function isHandledLogicalOperator(operator) {
|
|
41
41
|
return operator === "&&" || operator === "||";
|
42
42
|
}
|
43
43
|
|
44
|
+
/**
|
45
|
+
* Gets the label if the parent node of a given node is a LabeledStatement.
|
46
|
+
*
|
47
|
+
* @param {ASTNode} node - A node to get.
|
48
|
+
* @returns {string|null} The label or `null`.
|
49
|
+
*/
|
50
|
+
function getLabel(node) {
|
51
|
+
if (node.parent.type === "LabeledStatement") {
|
52
|
+
return node.parent.label.name;
|
53
|
+
}
|
54
|
+
return null;
|
55
|
+
}
|
56
|
+
|
44
57
|
/**
|
45
58
|
* Checks whether or not a given logical expression node goes different path
|
46
59
|
* between the `true` case and the `false` case.
|
@@ -391,7 +404,7 @@ function processCodePathToEnter(analyzer, node) {
|
|
391
404
|
case "SwitchStatement":
|
392
405
|
state.pushSwitchContext(
|
393
406
|
node.cases.some(isCaseNode),
|
394
|
-
|
407
|
+
getLabel(node)
|
395
408
|
);
|
396
409
|
break;
|
397
410
|
|
@@ -416,11 +429,11 @@ function processCodePathToEnter(analyzer, node) {
|
|
416
429
|
case "ForStatement":
|
417
430
|
case "ForInStatement":
|
418
431
|
case "ForOfStatement":
|
419
|
-
state.pushLoopContext(node.type,
|
432
|
+
state.pushLoopContext(node.type, getLabel(node));
|
420
433
|
break;
|
421
434
|
|
422
435
|
case "LabeledStatement":
|
423
|
-
if (!
|
436
|
+
if (!breakableTypePattern.test(node.body.type)) {
|
424
437
|
state.pushBreakContext(false, node.label.name);
|
425
438
|
}
|
426
439
|
break;
|
@@ -531,7 +544,7 @@ function processCodePathToExit(analyzer, node) {
|
|
531
544
|
break;
|
532
545
|
|
533
546
|
case "LabeledStatement":
|
534
|
-
if (!
|
547
|
+
if (!breakableTypePattern.test(node.body.type)) {
|
535
548
|
state.popBreakContext();
|
536
549
|
}
|
537
550
|
break;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -11,7 +11,7 @@
|
|
11
11
|
//------------------------------------------------------------------------------
|
12
12
|
|
13
13
|
const levn = require("levn"),
|
14
|
-
ConfigOps = require("../
|
14
|
+
ConfigOps = require("../shared/config-ops");
|
15
15
|
|
16
16
|
const debug = require("debug")("eslint:config-comment-parser");
|
17
17
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
const { Linter } = require("./linter");
|
4
|
+
const interpolate = require("./interpolate");
|
5
|
+
const SourceCodeFixer = require("./source-code-fixer");
|
6
|
+
|
7
|
+
module.exports = {
|
8
|
+
Linter,
|
9
|
+
|
10
|
+
// For testers.
|
11
|
+
SourceCodeFixer,
|
12
|
+
interpolate
|
13
|
+
};
|
File without changes
|