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
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,74 @@
|
|
1
|
+
v6.0.1 - June 24, 2019
|
2
|
+
|
3
|
+
* [`b5bde06`](https://github.com/eslint/eslint/commit/b5bde0669bd6a7a6b8e38cdf204d8d4b932cea63) Fix: --rulesdir option didn't work (fixes #11888) (#11890) (Toru Nagashima)
|
4
|
+
* [`13f0418`](https://github.com/eslint/eslint/commit/13f041897ee31982808a57b4d06450b57c9b27dc) Fix: improve error message on --print-config (fixes #11874) (#11885) (Toru Nagashima)
|
5
|
+
* [`056c2aa`](https://github.com/eslint/eslint/commit/056c2aaf39a5f8d06de24f06946dda95032a0361) Fix: improve diagnostics for shareable-config-missing errors (#11880) (Teddy Katz)
|
6
|
+
* [`566b7aa`](https://github.com/eslint/eslint/commit/566b7aa5d61fb31cd47fe4da7820b07cf9bde1ec) Docs: Update no-confusing-arrow with the new default option (#11886) (Yuping Zuo)
|
7
|
+
* [`d07f3fa`](https://github.com/eslint/eslint/commit/d07f3fae19b901c30cf4998f10722cb3182bd237) Fix: CLIEngine#getRules() contains plugin rules (fixes #11871) (#11872) (Toru Nagashima)
|
8
|
+
* [`21f4a80`](https://github.com/eslint/eslint/commit/21f4a8057ccc941f72bb617ae3b5c135a774f6c0) Docs: Fix inconsistent linking in migration guide (#11881) (Teddy Katz)
|
9
|
+
* [`f3a0774`](https://github.com/eslint/eslint/commit/f3a0774a8879b08777a4aedc76677f13d5156242) Docs: Fix typo in 6.0.0 migration guide (#11870) (Kevin Partington)
|
10
|
+
|
11
|
+
v6.0.0 - June 21, 2019
|
12
|
+
|
13
|
+
* [`81aa06b`](https://github.com/eslint/eslint/commit/81aa06b4cc49e9c15234a2c4d27659a03fea53d8) Upgrade: espree@6.0.0 (#11869) (Teddy Katz)
|
14
|
+
* [`5f022bc`](https://github.com/eslint/eslint/commit/5f022bc91d0d93d140876ceb1ee4e08b1b7cfd49) Fix: no-else-return autofix produces name collisions (fixes #11069) (#11867) (Milos Djermanovic)
|
15
|
+
* [`ded9548`](https://github.com/eslint/eslint/commit/ded9548d881b15e771ca79b844e8159601f30f70) Fix: multiline-comment-style incorrect message (#11864) (golopot)
|
16
|
+
* [`cad074d`](https://github.com/eslint/eslint/commit/cad074d4ddb34a59183b5965ca50170713b5a711) Docs: Add JSHint W047 compat to no-floating-decimal (#11861) (Timo Tijhof)
|
17
|
+
* [`41f6304`](https://github.com/eslint/eslint/commit/41f6304ce641a82ee729251b448dceb9fb0d501d) Upgrade: sinon (#11855) (Toru Nagashima)
|
18
|
+
* [`167ce87`](https://github.com/eslint/eslint/commit/167ce87e908ec04b0d3d79960278d45c883c4285) Chore: remove unuseable profile command (#11854) (Toru Nagashima)
|
19
|
+
* [`c844c6f`](https://github.com/eslint/eslint/commit/c844c6f2ff314cfa8c6ca0e35a1ef58b7e297b79) Fix: max-len properly ignore trailing comments (fixes #11838) (#11841) (ZYSzys)
|
20
|
+
* [`1b5661a`](https://github.com/eslint/eslint/commit/1b5661ae467c227c0239e06cc1466480004aa799) Fix: no-var should not fix variables named 'let' (fixes #11830) (#11832) (Milos Djermanovic)
|
21
|
+
* [`4d75956`](https://github.com/eslint/eslint/commit/4d75956147b6fd662ee90eb21d3f762816463b88) Build: CI with Azure Pipelines (#11845) (Toru Nagashima)
|
22
|
+
* [`1db3462`](https://github.com/eslint/eslint/commit/1db346220889305a427b45a00afcf362b81b3767) Chore: rm superfluous argument & fix perf-multifiles-targets (#11834) (薛定谔的猫)
|
23
|
+
* [`c57a4a4`](https://github.com/eslint/eslint/commit/c57a4a4a993193c4208c6419df331a7bc644a536) Upgrade: @babel/polyfill => core-js v3 (#11833) (薛定谔的猫)
|
24
|
+
* [`65faa04`](https://github.com/eslint/eslint/commit/65faa04e8b42eecd4505111bbff296951179f033) Docs: Clarify prefer-destructuring array/object difference (fixes #9970) (#11851) (Oliver Sieweke)
|
25
|
+
* [`81c3823`](https://github.com/eslint/eslint/commit/81c382378923a45015bafe58362f6c8faa5c3d5f) Fix: require-atomic-updates reports parameters (fixes #11723) (#11774) (Toru Nagashima)
|
26
|
+
* [`aef8ea1`](https://github.com/eslint/eslint/commit/aef8ea1a44b9f13d468f48536c4c93f79f201d9b) Sponsors: Sync README with website (ESLint Jenkins)
|
27
|
+
|
28
|
+
v6.0.0-rc.0 - June 9, 2019
|
29
|
+
|
30
|
+
* [`f403b07`](https://github.com/eslint/eslint/commit/f403b07283f91f1285d8318d6acea851dd765755) Update: introduce minKeys option to sort-keys rule (fixes #11624) (#11625) (Christian)
|
31
|
+
* [`87451f4`](https://github.com/eslint/eslint/commit/87451f4779bc4c0ec874042b6854920f947ee258) Fix: no-octal should report NonOctalDecimalIntegerLiteral (fixes #11794) (#11805) (Milos Djermanovic)
|
32
|
+
* [`e4ab053`](https://github.com/eslint/eslint/commit/e4ab0531c4e44c23494c6a802aa2329d15ac90e5) Update: support "bigint" in valid-typeof rule (#11802) (Colin Ihrig)
|
33
|
+
* [`e0fafc8`](https://github.com/eslint/eslint/commit/e0fafc8ef59a80a6137f4170bbe46582d6fbcafc) Chore: removes unnecessary assignment in loop (#11780) (Dimitri Mitropoulos)
|
34
|
+
* [`20908a3`](https://github.com/eslint/eslint/commit/20908a38f489c285abf8fceef4d9d13bf8b87f22) Docs: removed '>' prefix from from docs/working-with-rules (#11818) (Alok Takshak)
|
35
|
+
* [`1c43eef`](https://github.com/eslint/eslint/commit/1c43eef605a9cf02a157881424ea62dcae747f69) Sponsors: Sync README with website (ESLint Jenkins)
|
36
|
+
* [`21f3131`](https://github.com/eslint/eslint/commit/21f3131aa1636afa8e5c01053e0e870f968425b1) Fix: `overrides` handle relative paths as expected (fixes #11577) (#11799) (Toru Nagashima)
|
37
|
+
* [`5509cdf`](https://github.com/eslint/eslint/commit/5509cdfa1b3d575248eef89a935f79c82e3f3071) Fix: fails the test case if autofix made syntax error (fixes #11615) (#11798) (Toru Nagashima)
|
38
|
+
* [`cb1922b`](https://github.com/eslint/eslint/commit/cb1922bdc07e58de0e55c13fd992dd8faf3292a4) Fix: show custom message for namespace import (fixes #11580) (#11791) (Pig Fang)
|
39
|
+
* [`37e5193`](https://github.com/eslint/eslint/commit/37e5193102d7544f155cdcb09c7c50dc602914d4) Update: add `endColumn` to no-useless-escape (fixes #11629) (#11790) (Pig Fang)
|
40
|
+
* [`ad4b048`](https://github.com/eslint/eslint/commit/ad4b048c6d034cbd7fd97deb4390d059bde8803f) Build: Fix typo in blog post template (fixes #11614) (#11782) (Kai Cataldo)
|
41
|
+
* [`9590587`](https://github.com/eslint/eslint/commit/9590587cef74c936ef9b7ce2d22a71e2fd0fbbc4) Update: improve reported location of arrow-parens (fixes #11773) (#11775) (Pig Fang)
|
42
|
+
* [`d662b17`](https://github.com/eslint/eslint/commit/d662b178c7dad193201564d16f7977af2f81ebcf) New: Add classname attribute to JUnit testcase (refs #11068) (#11683) (Fabio Pitino)
|
43
|
+
* [`8eaa9b2`](https://github.com/eslint/eslint/commit/8eaa9b259dc08dfb48269b1e4413d0d47698ed87) Chore: remove incorrect comment (#11769) (薛定谔的猫)
|
44
|
+
* [`4039a49`](https://github.com/eslint/eslint/commit/4039a49177f2fefacd747050b420c0c4560b7d4b) Chore: add .github/funding.yml (#11764) (Toru Nagashima)
|
45
|
+
|
46
|
+
v6.0.0-alpha.2 - May 25, 2019
|
47
|
+
|
48
|
+
* [`9b87fee`](https://github.com/eslint/eslint/commit/9b87fee9dc7b1d99a50b924cb6b81255ebb5c4a2) Chore: Fix formatter documentation generation (#11767) (Ilya Volodin)
|
49
|
+
* [`f116208`](https://github.com/eslint/eslint/commit/f11620848733a3a6f58811d9bb2c3e748d6135ac) Chore: Fix site generation script for releases (#11766) (Ilya Volodin)
|
50
|
+
* [`cf9cce8`](https://github.com/eslint/eslint/commit/cf9cce81aa68e9bc23840530cb33f4c3f551fb1e) Update: Add never option for new-parens (refs #10034) (#11379) (pfgithub)
|
51
|
+
* [`b5fa149`](https://github.com/eslint/eslint/commit/b5fa1491d2371a721e4b5029e797ae98fd30fed2) New: multiple processors support (fixes #11035, fixes #11725) (#11552) (Toru Nagashima)
|
52
|
+
* [`2d32a9e`](https://github.com/eslint/eslint/commit/2d32a9e8dd10a5927576bd50d184876c775da4af) Breaking: stricter rule config validating (fixes #9505) (#11742) (薛定谔的猫)
|
53
|
+
* [`71716eb`](https://github.com/eslint/eslint/commit/71716eba3155266d777b994a38af524952e97696) Update: add fixer for no-div-regex rule (fixes #11355) (#11744) (joe-re)
|
54
|
+
* [`53f7f4c`](https://github.com/eslint/eslint/commit/53f7f4cf8d8b66a1911db56e4f72764388a21cc4) Update: Uniform messages for the rules in "complexity" section (#11759) (Igor Novozhilov)
|
55
|
+
* [`0a801d7`](https://github.com/eslint/eslint/commit/0a801d702dc41dae7eac0c802b822493ddc3ac41) Chore: improve perf test (#11756) (薛定谔的猫)
|
56
|
+
* [`45bd336`](https://github.com/eslint/eslint/commit/45bd336e647a6fa8a502488e5cbd27ba02712083) Docs: add about RuleTester's parser to migration guide (fixes #11728) (#11761) (Toru Nagashima)
|
57
|
+
* [`1374be4`](https://github.com/eslint/eslint/commit/1374be44f7ec4b8c913c52cc84debc4012c4f3ea) Docs: add table of contents in readme (#11765) (薛定谔的猫)
|
58
|
+
* [`54e6eda`](https://github.com/eslint/eslint/commit/54e6edaa2f881aab530fa14e63d92e5e0e2ca55c) New: extends in glob-based config (fixes #8813) (#11554) (Toru Nagashima)
|
59
|
+
* [`ec105b2`](https://github.com/eslint/eslint/commit/ec105b24f7e036ecdc4267f018529ac3765e29d5) Chore: typo in JSDoc on timing.display's return value (#11755) (Dimitri Mitropoulos)
|
60
|
+
* [`e45cc3f`](https://github.com/eslint/eslint/commit/e45cc3f3dc44f3a5b6b713a1bf5ce6e46d87ca49) Docs: updated no-proto rule (fixes #11743) (#11746) (Francesco Trotta)
|
61
|
+
* [`15c6c63`](https://github.com/eslint/eslint/commit/15c6c6374c0425d5402142d012a541fa208bc9da) Chore: eslint-config-eslint require node >= 8 (#11718) (薛定谔的猫)
|
62
|
+
* [`f9790ca`](https://github.com/eslint/eslint/commit/f9790ca1baec1275f3c946586766a5713258ac32) Fix: typo: missing word in docs (#11750) (Dimitri Mitropoulos)
|
63
|
+
* [`219aecb`](https://github.com/eslint/eslint/commit/219aecb78bc646d44bad27dc775a9b3d3dc58232) Chore: restructure files (#11555) (Toru Nagashima)
|
64
|
+
* [`5dad0b1`](https://github.com/eslint/eslint/commit/5dad0b1d80c9cf380c49f46266c35d461d3cecad) Fix: Unignoring directories in .eslintignore (fixes #11684) (#11685) (Mykola Bilochub)
|
65
|
+
* [`4625090`](https://github.com/eslint/eslint/commit/462509058e46770cf70307cf8dba279f0e73b967) Docs: small fix about the migration guide (#11729) (Toru Nagashima)
|
66
|
+
* [`0e89c73`](https://github.com/eslint/eslint/commit/0e89c73177398eaf978a50d5b0f79ff8e43512f2) Sponsors: Sync README with website (ESLint Jenkins)
|
67
|
+
* [`5a296fa`](https://github.com/eslint/eslint/commit/5a296fa0c9345ad1a55e2b257e5f6c9f05fff362) Sponsors: Sync README with website (ESLint Jenkins)
|
68
|
+
* [`7c8e86b`](https://github.com/eslint/eslint/commit/7c8e86bf2c900cec7cd1dfd529a8c77cc81ef34c) Fix: wrong 'plugin-missing' error on Node.js 12 (fixes #11720) (#11722) (Toru Nagashima)
|
69
|
+
* [`67c671f`](https://github.com/eslint/eslint/commit/67c671fdc1c8b08cb8d263a9bb2151e3108c88b4) Chore: ignore deprecated rules in fuzz tests (#11710) (Pig Fang)
|
70
|
+
* [`af81cb3`](https://github.com/eslint/eslint/commit/af81cb3ecc5e6bf43a6a2d8f326103350513a1b8) Chore: make fuzzer produce minimal reproducible examples of bugs (#11700) (Teddy Katz)
|
71
|
+
|
1
72
|
v6.0.0-alpha.1 - May 10, 2019
|
2
73
|
|
3
74
|
* [`e84b6f8`](https://github.com/eslint/eslint/commit/e84b6f8b171ba4266164688f76d5ee45d278e5c2) Docs: fix example in object-curly-newline docs (#11633) (golopot)
|
package/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
[![NPM version][npm-image]][npm-url]
|
2
|
-
[![build
|
3
|
-
[![Build status][appveyor-image]][appveyor-url]
|
2
|
+
[](https://dev.azure.com/eslint/eslint/_build/latest?definitionId=1&branchName=master)
|
4
3
|
[![Downloads][downloads-image]][downloads-url]
|
5
4
|
[](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE)
|
6
5
|
[](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -24,7 +23,21 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J
|
|
24
23
|
* ESLint uses an AST to evaluate patterns in code.
|
25
24
|
* ESLint is completely pluggable, every single rule is a plugin and you can add more at runtime.
|
26
25
|
|
27
|
-
##
|
26
|
+
## Table of Contents
|
27
|
+
|
28
|
+
1. [Installation and Usage](#installation-and-usage)
|
29
|
+
2. [Configuration](#configuration)
|
30
|
+
3. [Code of Conduct](#code-of-conduct)
|
31
|
+
4. [Filing Issues](#filing-issues)
|
32
|
+
5. [Frequently Asked Questions](#faq)
|
33
|
+
6. [Releases](#releases)
|
34
|
+
7. [Semantic Versioning Policy](#semantic-versioning-policy)
|
35
|
+
8. [License](#license)
|
36
|
+
9. [Team](#team)
|
37
|
+
10. [Sponsors](#sponsors)
|
38
|
+
11. [Technology Sponsors](#technology-sponsors)
|
39
|
+
|
40
|
+
## <a name="installation-and-usage"></a>Installation and Usage
|
28
41
|
|
29
42
|
Prerequisites: [Node.js](https://nodejs.org/) (`^8.10.0`, `^10.13.0`, or `>=11.10.1`), npm version 3+.
|
30
43
|
|
@@ -48,7 +61,7 @@ $ ./node_modules/.bin/eslint yourfile.js
|
|
48
61
|
|
49
62
|
It is also possible to install ESLint globally rather than locally (using `npm install eslint --global`). However, any plugins or shareable configs that you use must be installed locally in either case.
|
50
63
|
|
51
|
-
## Configuration
|
64
|
+
## <a name="configuration"></a>Configuration
|
52
65
|
|
53
66
|
After running `eslint --init`, you'll have a `.eslintrc` file in your directory. In it, you'll see some rules configured like this:
|
54
67
|
|
@@ -69,11 +82,11 @@ The names `"semi"` and `"quotes"` are the names of [rules](https://eslint.org/do
|
|
69
82
|
|
70
83
|
The three error levels allow you fine-grained control over how ESLint applies rules (for more configuration options and details, see the [configuration docs](https://eslint.org/docs/user-guide/configuring)).
|
71
84
|
|
72
|
-
## Code of Conduct
|
85
|
+
## <a name="code-of-conduct"></a>Code of Conduct
|
73
86
|
|
74
87
|
ESLint adheres to the [JS Foundation Code of Conduct](https://js.foundation/community/code-of-conduct).
|
75
88
|
|
76
|
-
## Filing Issues
|
89
|
+
## <a name="filing-issues"></a>Filing Issues
|
77
90
|
|
78
91
|
Before filing an issue, please be sure to read the guidelines for what you're reporting:
|
79
92
|
|
@@ -82,7 +95,7 @@ Before filing an issue, please be sure to read the guidelines for what you're re
|
|
82
95
|
* [Proposing a Rule Change](https://eslint.org/docs/developer-guide/contributing/rule-changes)
|
83
96
|
* [Request a Change](https://eslint.org/docs/developer-guide/contributing/changes)
|
84
97
|
|
85
|
-
## Frequently Asked Questions
|
98
|
+
## <a name="faq"></a>Frequently Asked Questions
|
86
99
|
|
87
100
|
### I'm using JSCS, should I migrate to ESLint?
|
88
101
|
|
@@ -122,11 +135,11 @@ Once a language feature has been adopted into the ECMAScript standard (stage 4 a
|
|
122
135
|
|
123
136
|
Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://gitter.im/eslint/eslint).
|
124
137
|
|
125
|
-
## Releases
|
138
|
+
## <a name="releases"></a>Releases
|
126
139
|
|
127
140
|
We have scheduled releases every two weeks on Friday or Saturday. You can follow a [release issue](https://github.com/eslint/eslint/issues?q=is%3Aopen+is%3Aissue+label%3Arelease) for updates about the scheduling of any particular release.
|
128
141
|
|
129
|
-
## Semantic Versioning Policy
|
142
|
+
## <a name="semantic-versioning-policy"></a>Semantic Versioning Policy
|
130
143
|
|
131
144
|
ESLint follows [semantic versioning](https://semver.org). However, due to the nature of ESLint as a code quality tool, it's not always clear when a minor or major version bump occurs. To help clarify this for everyone, we've defined the following semantic versioning policy for ESLint:
|
132
145
|
|
@@ -152,11 +165,11 @@ ESLint follows [semantic versioning](https://semver.org). However, due to the na
|
|
152
165
|
|
153
166
|
According to our policy, any minor update may report more errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (`~`) in `package.json` e.g. `"eslint": "~3.1.0"` to guarantee the results of your builds.
|
154
167
|
|
155
|
-
## License
|
168
|
+
## <a name="license"></a>License
|
156
169
|
|
157
170
|
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_large)
|
158
171
|
|
159
|
-
## Team
|
172
|
+
## <a name="team"></a>Team
|
160
173
|
|
161
174
|
These folks keep the project moving and are resources for help.
|
162
175
|
|
@@ -238,30 +251,24 @@ Pig Fang
|
|
238
251
|
|
239
252
|
<!--teamend-->
|
240
253
|
|
241
|
-
## Sponsors
|
254
|
+
## <a name="sponsors"></a>Sponsors
|
242
255
|
|
243
256
|
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://opencollective.com/eslint) to get your logo on our README and website.
|
244
257
|
|
245
258
|
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
246
259
|
<!--sponsorsstart-->
|
247
260
|
<h3>Gold Sponsors</h3>
|
248
|
-
<p><a href="http://salesforce.com"><img src="https://images.opencollective.com/salesforce/logo.png" alt="Salesforce" height="96"></a> <a href="https://
|
261
|
+
<p><a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/logo.png" alt="Shopify" height="96"></a> <a href="http://salesforce.com"><img src="https://images.opencollective.com/salesforce/logo.png" alt="Salesforce" height="96"></a> <a href="https://badoo.com/team?utm_source=eslint"><img src="https://images.opencollective.com/badoo/logo.png" alt="Badoo" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/logo.png" alt="Airbnb" height="96"></a> <a href="https://code.facebook.com/projects/"><img src="https://images.opencollective.com/fbopensource/logo.png" alt="Facebook Open Source" height="96"></a></p><h3>Silver Sponsors</h3>
|
249
262
|
<p><a href="https://www.ampproject.org/"><img src="https://images.opencollective.com/amp/logo.png" alt="AMP Project" height="64"></a></p><h3>Bronze Sponsors</h3>
|
250
|
-
<p><a href="https://
|
263
|
+
<p><a href="https://clay.global"><img src="https://images.opencollective.com/clayglobal/logo.png" alt="clay" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/logo.png" alt="Discord" height="32"></a> <a href="https://themeisle.com"><img src="https://images.opencollective.com/themeisle/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://tekhattan.com"><img src="https://images.opencollective.com/tekhattan/logo.png" alt="TekHattan" height="32"></a> <a href="https://www.marfeel.com/"><img src="https://images.opencollective.com/marfeel/logo.png" alt="Marfeel" height="32"></a> <a href="http://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://jsheroes.io/"><img src="https://images.opencollective.com/jsheroes1/logo.png" alt="JSHeroes " height="32"></a> <a href="https://faithlife.com/ref/about"><img src="https://images.opencollective.com/faithlife/logo.png" alt="Faithlife" height="32"></a></p>
|
251
264
|
<!--sponsorsend-->
|
252
265
|
|
253
|
-
## Technology Sponsors
|
266
|
+
## <a name="technology-sponsors"></a>Technology Sponsors
|
254
267
|
|
255
268
|
* Site search ([eslint.org](https://eslint.org)) is sponsored by [Algolia](https://www.algolia.com)
|
256
269
|
|
257
270
|
|
258
271
|
[npm-image]: https://img.shields.io/npm/v/eslint.svg?style=flat-square
|
259
272
|
[npm-url]: https://www.npmjs.com/package/eslint
|
260
|
-
[travis-image]: https://img.shields.io/travis/eslint/eslint/master.svg?style=flat-square
|
261
|
-
[travis-url]: https://travis-ci.org/eslint/eslint
|
262
|
-
[appveyor-image]: https://ci.appveyor.com/api/projects/status/iwxmiobcvbw3b0av/branch/master?svg=true
|
263
|
-
[appveyor-url]: https://ci.appveyor.com/project/nzakas/eslint/branch/master
|
264
|
-
[coveralls-image]: https://img.shields.io/coveralls/eslint/eslint/master.svg?style=flat-square
|
265
|
-
[coveralls-url]: https://coveralls.io/r/eslint/eslint?branch=master
|
266
273
|
[downloads-image]: https://img.shields.io/npm/dm/eslint.svg?style=flat-square
|
267
274
|
[downloads-url]: https://www.npmjs.com/package/eslint
|
package/bin/eslint.js
CHANGED
@@ -45,7 +45,7 @@ process.once("uncaughtException", err => {
|
|
45
45
|
const pkg = require("../package.json");
|
46
46
|
|
47
47
|
console.error("\nOops! Something went wrong! :(");
|
48
|
-
console.error(`\nESLint: ${pkg.version}.\n${template(err.messageData || {})}`);
|
48
|
+
console.error(`\nESLint: ${pkg.version}.\n\n${template(err.messageData || {})}`);
|
49
49
|
} else {
|
50
50
|
|
51
51
|
console.error(err.stack);
|
@@ -65,7 +65,7 @@ if (useStdIn) {
|
|
65
65
|
|
66
66
|
process.exitCode = cli.execute(process.argv, fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8"));
|
67
67
|
} else if (init) {
|
68
|
-
const configInit = require("../lib/
|
68
|
+
const configInit = require("../lib/init/config-initializer");
|
69
69
|
|
70
70
|
configInit.initializeConfig().then(() => {
|
71
71
|
process.exitCode = 0;
|
package/conf/config-schema.js
CHANGED
@@ -7,64 +7,71 @@
|
|
7
7
|
|
8
8
|
const baseConfigProperties = {
|
9
9
|
env: { type: "object" },
|
10
|
+
extends: { $ref: "#/definitions/stringOrStrings" },
|
10
11
|
globals: { type: "object" },
|
12
|
+
overrides: {
|
13
|
+
type: "array",
|
14
|
+
items: { $ref: "#/definitions/overrideConfig" },
|
15
|
+
additionalItems: false
|
16
|
+
},
|
11
17
|
parser: { type: ["string", "null"] },
|
12
18
|
parserOptions: { type: "object" },
|
13
19
|
plugins: { type: "array" },
|
20
|
+
processor: { type: "string" },
|
14
21
|
rules: { type: "object" },
|
15
22
|
settings: { type: "object" },
|
16
23
|
|
17
24
|
ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
|
18
25
|
};
|
19
26
|
|
20
|
-
const
|
21
|
-
{
|
22
|
-
|
23
|
-
{
|
24
|
-
files: {
|
27
|
+
const configSchema = {
|
28
|
+
definitions: {
|
29
|
+
stringOrStrings: {
|
25
30
|
oneOf: [
|
26
31
|
{ type: "string" },
|
27
32
|
{
|
28
33
|
type: "array",
|
29
34
|
items: { type: "string" },
|
30
|
-
|
35
|
+
additionalItems: false
|
31
36
|
}
|
32
37
|
]
|
33
38
|
},
|
34
|
-
|
39
|
+
stringOrStringsRequired: {
|
35
40
|
oneOf: [
|
36
41
|
{ type: "string" },
|
37
42
|
{
|
38
43
|
type: "array",
|
39
|
-
items: { type: "string" }
|
44
|
+
items: { type: "string" },
|
45
|
+
additionalItems: false,
|
46
|
+
minItems: 1
|
40
47
|
}
|
41
48
|
]
|
42
|
-
}
|
43
|
-
|
44
|
-
|
49
|
+
},
|
50
|
+
|
51
|
+
// Config at top-level.
|
52
|
+
objectConfig: {
|
53
|
+
type: "object",
|
54
|
+
properties: {
|
55
|
+
root: { type: "boolean" },
|
56
|
+
...baseConfigProperties
|
57
|
+
},
|
58
|
+
additionalProperties: false
|
59
|
+
},
|
45
60
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
properties: overrideProperties,
|
57
|
-
required: ["files"],
|
58
|
-
additionalProperties: false
|
59
|
-
}
|
61
|
+
// Config in `overrides`.
|
62
|
+
overrideConfig: {
|
63
|
+
type: "object",
|
64
|
+
properties: {
|
65
|
+
excludedFiles: { $ref: "#/definitions/stringOrStrings" },
|
66
|
+
files: { $ref: "#/definitions/stringOrStringsRequired" },
|
67
|
+
...baseConfigProperties
|
68
|
+
},
|
69
|
+
required: ["files"],
|
70
|
+
additionalProperties: false
|
60
71
|
}
|
61
|
-
}
|
62
|
-
);
|
72
|
+
},
|
63
73
|
|
64
|
-
|
65
|
-
type: "object",
|
66
|
-
properties: topLevelConfigProperties,
|
67
|
-
additionalProperties: false
|
74
|
+
$ref: "#/definitions/objectConfig"
|
68
75
|
};
|
69
76
|
|
70
77
|
module.exports = configSchema;
|
package/conf/environments.js
CHANGED
@@ -14,7 +14,7 @@ const globals = require("globals");
|
|
14
14
|
// Public Interface
|
15
15
|
//------------------------------------------------------------------------------
|
16
16
|
|
17
|
-
/** @type {Map<string, import("../lib/
|
17
|
+
/** @type {Map<string, import("../lib/shared/types").Environment>} */
|
18
18
|
module.exports = new Map(Object.entries({
|
19
19
|
builtin: {
|
20
20
|
globals: globals.es5
|
package/conf/eslint-all.js
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
// Requirements
|
10
10
|
//------------------------------------------------------------------------------
|
11
11
|
|
12
|
-
const builtInRules = require("../lib/
|
12
|
+
const builtInRules = require("../lib/rules");
|
13
13
|
|
14
14
|
//------------------------------------------------------------------------------
|
15
15
|
// Helpers
|
@@ -27,5 +27,5 @@ for (const [ruleId, rule] of builtInRules) {
|
|
27
27
|
// Public Interface
|
28
28
|
//------------------------------------------------------------------------------
|
29
29
|
|
30
|
-
/** @type {import("../lib/
|
30
|
+
/** @type {import("../lib/shared/types").ConfigData} */
|
31
31
|
module.exports = { rules: allRules };
|
package/lib/api.js
CHANGED
@@ -5,15 +5,19 @@
|
|
5
5
|
|
6
6
|
"use strict";
|
7
7
|
|
8
|
+
const { CLIEngine } = require("./cli-engine");
|
8
9
|
const { Linter } = require("./linter");
|
10
|
+
const { RuleTester } = require("./rule-tester");
|
11
|
+
const { SourceCode } = require("./source-code");
|
9
12
|
|
10
13
|
module.exports = {
|
11
14
|
Linter,
|
12
|
-
CLIEngine
|
13
|
-
RuleTester
|
14
|
-
SourceCode
|
15
|
+
CLIEngine,
|
16
|
+
RuleTester,
|
17
|
+
SourceCode
|
15
18
|
};
|
16
19
|
|
20
|
+
// DOTO: remove deprecated API.
|
17
21
|
let deprecatedLinterInstance = null;
|
18
22
|
|
19
23
|
Object.defineProperty(module.exports, "linter", {
|
@@ -25,10 +25,10 @@
|
|
25
25
|
|
26
26
|
const os = require("os");
|
27
27
|
const path = require("path");
|
28
|
-
const { validateConfigArray } = require("../
|
28
|
+
const { validateConfigArray } = require("../shared/config-validator");
|
29
29
|
const { ConfigArrayFactory } = require("./config-array-factory");
|
30
|
-
const { ConfigDependency } = require("./config-array");
|
31
|
-
const loadRules = require("
|
30
|
+
const { ConfigArray, ConfigDependency } = require("./config-array");
|
31
|
+
const loadRules = require("./load-rules");
|
32
32
|
const debug = require("debug")("eslint:cascading-config-array-factory");
|
33
33
|
|
34
34
|
//------------------------------------------------------------------------------
|
@@ -36,9 +36,9 @@ const debug = require("debug")("eslint:cascading-config-array-factory");
|
|
36
36
|
//------------------------------------------------------------------------------
|
37
37
|
|
38
38
|
// Define types for VSCode IntelliSense.
|
39
|
-
/** @typedef {import("../
|
40
|
-
/** @typedef {import("../
|
41
|
-
/** @typedef {import("../
|
39
|
+
/** @typedef {import("../shared/types").ConfigData} ConfigData */
|
40
|
+
/** @typedef {import("../shared/types").Parser} Parser */
|
41
|
+
/** @typedef {import("../shared/types").Plugin} Plugin */
|
42
42
|
/** @typedef {ReturnType<ConfigArrayFactory["create"]>} ConfigArray */
|
43
43
|
|
44
44
|
/**
|
@@ -225,11 +225,22 @@ class CascadingConfigArrayFactory {
|
|
225
225
|
|
226
226
|
/**
|
227
227
|
* Get the config array of a given file.
|
228
|
-
*
|
228
|
+
* If `filePath` was not given, it returns the config which contains only
|
229
|
+
* `baseConfigData` and `cliConfigData`.
|
230
|
+
* @param {string} [filePath] The file path to a file.
|
229
231
|
* @returns {ConfigArray} The config array of the file.
|
230
232
|
*/
|
231
233
|
getConfigArrayForFile(filePath) {
|
232
|
-
const {
|
234
|
+
const {
|
235
|
+
baseConfigArray,
|
236
|
+
cliConfigArray,
|
237
|
+
cwd
|
238
|
+
} = internalSlotsMap.get(this);
|
239
|
+
|
240
|
+
if (!filePath) {
|
241
|
+
return new ConfigArray(...baseConfigArray, ...cliConfigArray);
|
242
|
+
}
|
243
|
+
|
233
244
|
const directoryPath = path.dirname(path.resolve(cwd, filePath));
|
234
245
|
|
235
246
|
debug(`Load config files for ${directoryPath}.`);
|
@@ -302,6 +313,7 @@ class CascadingConfigArrayFactory {
|
|
302
313
|
|
303
314
|
if (configArray.length > 0 && configArray.isRoot()) {
|
304
315
|
debug("Stop traversing because of 'root:true'.");
|
316
|
+
configArray.unshift(...baseConfigArray);
|
305
317
|
return this._cacheConfig(directoryPath, configArray);
|
306
318
|
}
|
307
319
|
|
@@ -17,19 +17,19 @@
|
|
17
17
|
|
18
18
|
const fs = require("fs");
|
19
19
|
const path = require("path");
|
20
|
-
const defaultOptions = require("
|
21
|
-
const pkg = require("
|
22
|
-
const
|
23
|
-
const
|
24
|
-
const {
|
25
|
-
const
|
26
|
-
const
|
27
|
-
const {
|
28
|
-
const
|
29
|
-
const
|
30
|
-
const
|
31
|
-
const
|
32
|
-
const
|
20
|
+
const defaultOptions = require("../../conf/default-cli-options");
|
21
|
+
const pkg = require("../../package.json");
|
22
|
+
const ConfigOps = require("../shared/config-ops");
|
23
|
+
const ModuleResolver = require("../shared/relative-module-resolver");
|
24
|
+
const { Linter } = require("../linter");
|
25
|
+
const builtInRules = require("../rules");
|
26
|
+
const { CascadingConfigArrayFactory } = require("./cascading-config-array-factory");
|
27
|
+
const { getUsedExtractedConfigs } = require("./config-array");
|
28
|
+
const { FileEnumerator } = require("./file-enumerator");
|
29
|
+
const hash = require("./hash");
|
30
|
+
const { IgnoredPaths } = require("./ignored-paths");
|
31
|
+
const LintResultCache = require("./lint-result-cache");
|
32
|
+
const naming = require("./naming");
|
33
33
|
|
34
34
|
const debug = require("debug")("eslint:cli-engine");
|
35
35
|
const validFixTypes = new Set(["problem", "suggestion", "layout"]);
|
@@ -39,12 +39,12 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]);
|
|
39
39
|
//------------------------------------------------------------------------------
|
40
40
|
|
41
41
|
// For VSCode IntelliSense
|
42
|
-
/** @typedef {import("
|
43
|
-
/** @typedef {import("
|
44
|
-
/** @typedef {import("
|
45
|
-
/** @typedef {import("
|
46
|
-
/** @typedef {import("
|
47
|
-
/** @typedef {import("
|
42
|
+
/** @typedef {import("../shared/types").ConfigData} ConfigData */
|
43
|
+
/** @typedef {import("../shared/types").LintMessage} LintMessage */
|
44
|
+
/** @typedef {import("../shared/types").ParserOptions} ParserOptions */
|
45
|
+
/** @typedef {import("../shared/types").Plugin} Plugin */
|
46
|
+
/** @typedef {import("../shared/types").RuleConf} RuleConf */
|
47
|
+
/** @typedef {import("../shared/types").Rule} Rule */
|
48
48
|
/** @typedef {ReturnType<CascadingConfigArrayFactory["getConfigArrayForFile"]>} ConfigArray */
|
49
49
|
/** @typedef {ReturnType<ConfigArray["extractConfig"]>} ExtractedConfig */
|
50
50
|
|
@@ -202,6 +202,7 @@ function calculateStatsPerRun(results) {
|
|
202
202
|
* @param {boolean} config.fix If `true` then it does fix.
|
203
203
|
* @param {boolean} config.allowInlineConfig If `true` then it uses directive comments.
|
204
204
|
* @param {boolean} config.reportUnusedDisableDirectives If `true` then it reports unused `eslint-disable` comments.
|
205
|
+
* @param {RegExp} config.extensionRegExp The `RegExp` object that tests if a file path has the allowed file extensions.
|
205
206
|
* @param {Linter} config.linter The linter instance to verify.
|
206
207
|
* @returns {LintResult} The result of linting.
|
207
208
|
* @private
|
@@ -214,6 +215,7 @@ function verifyText({
|
|
214
215
|
fix,
|
215
216
|
allowInlineConfig,
|
216
217
|
reportUnusedDisableDirectives,
|
218
|
+
extensionRegExp,
|
217
219
|
linter
|
218
220
|
}) {
|
219
221
|
const filePath = providedFilePath || "<text>";
|
@@ -233,7 +235,18 @@ function verifyText({
|
|
233
235
|
allowInlineConfig,
|
234
236
|
filename: filePathToVerify,
|
235
237
|
fix,
|
236
|
-
reportUnusedDisableDirectives
|
238
|
+
reportUnusedDisableDirectives,
|
239
|
+
|
240
|
+
/**
|
241
|
+
* Check if the linter should adopt a given code block or not.
|
242
|
+
* Currently, the linter adopts code blocks if the name matches `--ext` option.
|
243
|
+
* In the future, `overrides` in the configuration would affect the adoption (https://github.com/eslint/rfcs/pull/20).
|
244
|
+
* @param {string} blockFilename The virtual filename of a code block.
|
245
|
+
* @returns {boolean} `true` if the linter should adopt the code block.
|
246
|
+
*/
|
247
|
+
filterCodeBlock(blockFilename) {
|
248
|
+
return extensionRegExp.test(blockFilename);
|
249
|
+
}
|
237
250
|
}
|
238
251
|
);
|
239
252
|
|
@@ -560,7 +573,7 @@ class CLIEngine {
|
|
560
573
|
const linter = new Linter();
|
561
574
|
|
562
575
|
/** @type {ConfigArray[]} */
|
563
|
-
const lastConfigArrays = [];
|
576
|
+
const lastConfigArrays = [configArrayFactory.getConfigArrayForFile()];
|
564
577
|
|
565
578
|
// Store private data.
|
566
579
|
internalSlotsMap.set(this, {
|
@@ -773,6 +786,7 @@ class CLIEngine {
|
|
773
786
|
fix,
|
774
787
|
allowInlineConfig,
|
775
788
|
reportUnusedDisableDirectives,
|
789
|
+
extensionRegExp: fileEnumerator.extensionRegExp,
|
776
790
|
linter
|
777
791
|
});
|
778
792
|
|
@@ -817,6 +831,7 @@ class CLIEngine {
|
|
817
831
|
executeOnText(text, filename, warnIgnored) {
|
818
832
|
const {
|
819
833
|
configArrayFactory,
|
834
|
+
fileEnumerator,
|
820
835
|
ignoredPaths,
|
821
836
|
lastConfigArrays,
|
822
837
|
linter,
|
@@ -860,6 +875,7 @@ class CLIEngine {
|
|
860
875
|
fix,
|
861
876
|
allowInlineConfig,
|
862
877
|
reportUnusedDisableDirectives,
|
878
|
+
extensionRegExp: fileEnumerator.extensionRegExp,
|
863
879
|
linter
|
864
880
|
}));
|
865
881
|
}
|
@@ -888,6 +904,13 @@ class CLIEngine {
|
|
888
904
|
const { configArrayFactory, options } = internalSlotsMap.get(this);
|
889
905
|
const absolutePath = path.resolve(options.cwd, filePath);
|
890
906
|
|
907
|
+
if (directoryExists(absolutePath)) {
|
908
|
+
throw Object.assign(
|
909
|
+
new Error("'filePath' should not be a directory path."),
|
910
|
+
{ messageTemplate: "print-config-with-directory-path" }
|
911
|
+
);
|
912
|
+
}
|
913
|
+
|
891
914
|
return configArrayFactory
|
892
915
|
.getConfigArrayForFile(absolutePath)
|
893
916
|
.extractConfig(absolutePath)
|
@@ -37,12 +37,12 @@ const { ExtractedConfig } = require("./extracted-config");
|
|
37
37
|
//------------------------------------------------------------------------------
|
38
38
|
|
39
39
|
// Define types for VSCode IntelliSense.
|
40
|
-
/** @typedef {import("../../
|
41
|
-
/** @typedef {import("../../
|
42
|
-
/** @typedef {import("../../
|
43
|
-
/** @typedef {import("../../
|
44
|
-
/** @typedef {import("../../
|
45
|
-
/** @typedef {import("../../
|
40
|
+
/** @typedef {import("../../shared/types").Environment} Environment */
|
41
|
+
/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */
|
42
|
+
/** @typedef {import("../../shared/types").RuleConf} RuleConf */
|
43
|
+
/** @typedef {import("../../shared/types").Rule} Rule */
|
44
|
+
/** @typedef {import("../../shared/types").Plugin} Plugin */
|
45
|
+
/** @typedef {import("../../shared/types").Processor} Processor */
|
46
46
|
/** @typedef {import("./config-dependency").DependentParser} DependentParser */
|
47
47
|
/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */
|
48
48
|
/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */
|
@@ -231,7 +231,6 @@ function mergeRuleConfigs(target, source) {
|
|
231
231
|
* @returns {ExtractedConfig} The extracted config.
|
232
232
|
*/
|
233
233
|
function createConfig(instance, indices) {
|
234
|
-
const slots = internalSlotsMap.get(instance);
|
235
234
|
const config = new ExtractedConfig();
|
236
235
|
|
237
236
|
// Merge elements.
|
@@ -256,7 +255,7 @@ function createConfig(instance, indices) {
|
|
256
255
|
mergeWithoutOverwrite(config.globals, element.globals);
|
257
256
|
mergeWithoutOverwrite(config.parserOptions, element.parserOptions);
|
258
257
|
mergeWithoutOverwrite(config.settings, element.settings);
|
259
|
-
mergePlugins(config.plugins, element.plugins
|
258
|
+
mergePlugins(config.plugins, element.plugins);
|
260
259
|
mergeRuleConfigs(config.rules, element.rules);
|
261
260
|
}
|
262
261
|
|