eslint 6.5.1 → 6.6.0
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 +54 -0
- package/README.md +4 -3
- package/lib/cli-engine/cascading-config-array-factory.js +2 -1
- package/lib/cli-engine/cli-engine.js +9 -7
- package/lib/cli-engine/config-array/config-array.js +0 -4
- package/lib/cli-engine/config-array/config-dependency.js +2 -0
- package/lib/cli-engine/config-array/override-tester.js +2 -0
- package/lib/cli-engine/config-array-factory.js +7 -1
- package/lib/cli-engine/file-enumerator.js +5 -3
- package/lib/cli-engine/formatters/html.js +1 -0
- package/lib/cli-engine/ignored-paths.js +1 -0
- package/lib/init/autoconfig.js +1 -11
- package/lib/init/config-file.js +0 -1
- package/lib/init/config-initializer.js +0 -1
- package/lib/init/config-rule.js +1 -5
- package/lib/init/npm-utils.js +0 -5
- package/lib/linter/code-path-analysis/code-path-analyzer.js +24 -38
- package/lib/linter/code-path-analysis/code-path-segment.js +17 -25
- package/lib/linter/code-path-analysis/code-path-state.js +40 -81
- package/lib/linter/code-path-analysis/code-path.js +10 -11
- package/lib/linter/code-path-analysis/debug-helpers.js +8 -12
- package/lib/linter/code-path-analysis/fork-context.js +23 -34
- package/lib/linter/code-path-analysis/id-generator.js +2 -2
- package/lib/linter/linter.js +121 -95
- package/lib/linter/node-event-generator.js +3 -2
- package/lib/rule-tester/rule-tester.js +6 -8
- package/lib/rules/accessor-pairs.js +8 -8
- package/lib/rules/array-bracket-newline.js +12 -15
- package/lib/rules/array-bracket-spacing.js +12 -12
- package/lib/rules/array-callback-return.js +6 -11
- package/lib/rules/array-element-newline.js +5 -8
- package/lib/rules/arrow-parens.js +0 -1
- package/lib/rules/block-scoped-var.js +3 -3
- package/lib/rules/block-spacing.js +4 -4
- package/lib/rules/capitalized-comments.js +0 -7
- package/lib/rules/class-methods-use-this.js +3 -3
- package/lib/rules/comma-dangle.js +15 -23
- package/lib/rules/comma-spacing.js +1 -1
- package/lib/rules/computed-property-spacing.js +10 -10
- package/lib/rules/consistent-return.js +4 -5
- package/lib/rules/consistent-this.js +5 -5
- package/lib/rules/constructor-super.js +14 -16
- package/lib/rules/curly.js +3 -5
- package/lib/rules/default-param-last.js +1 -0
- package/lib/rules/dot-location.js +11 -12
- package/lib/rules/func-names.js +6 -6
- package/lib/rules/function-call-argument-newline.js +5 -5
- package/lib/rules/generator-star-spacing.js +4 -9
- package/lib/rules/getter-return.js +4 -7
- package/lib/rules/indent.js +2 -2
- package/lib/rules/init-declarations.js +2 -2
- package/lib/rules/jsx-quotes.js +1 -1
- package/lib/rules/keyword-spacing.js +32 -56
- package/lib/rules/lines-around-directive.js +1 -1
- package/lib/rules/max-len.js +0 -5
- package/lib/rules/max-statements-per-line.js +3 -7
- package/lib/rules/multiline-ternary.js +3 -3
- package/lib/rules/newline-after-var.js +6 -7
- package/lib/rules/newline-before-return.js +8 -9
- package/lib/rules/newline-per-chained-call.js +2 -4
- package/lib/rules/no-class-assign.js +2 -2
- package/lib/rules/no-compare-neg-zero.js +1 -2
- package/lib/rules/no-confusing-arrow.js +2 -2
- package/lib/rules/no-console.js +4 -8
- package/lib/rules/no-const-assign.js +1 -1
- package/lib/rules/no-dupe-args.js +1 -1
- package/lib/rules/no-dupe-class-members.js +3 -4
- package/lib/rules/no-dupe-keys.js +6 -5
- package/lib/rules/no-duplicate-imports.js +14 -18
- package/lib/rules/no-else-return.js +0 -8
- package/lib/rules/no-empty-function.js +2 -4
- package/lib/rules/no-eval.js +10 -18
- package/lib/rules/no-ex-assign.js +1 -1
- package/lib/rules/no-extra-bind.js +5 -12
- package/lib/rules/no-extra-boolean-cast.js +0 -2
- package/lib/rules/no-extra-label.js +4 -9
- package/lib/rules/no-extra-parens.js +17 -15
- package/lib/rules/no-extra-semi.js +5 -6
- package/lib/rules/no-fallthrough.js +6 -6
- package/lib/rules/no-func-assign.js +3 -3
- package/lib/rules/no-global-assign.js +4 -4
- package/lib/rules/no-implicit-coercion.js +10 -10
- package/lib/rules/no-implied-eval.js +0 -1
- package/lib/rules/no-invalid-this.js +1 -3
- package/lib/rules/no-labels.js +3 -6
- package/lib/rules/no-lone-blocks.js +1 -1
- package/lib/rules/no-loop-func.js +6 -11
- package/lib/rules/no-magic-numbers.js +6 -6
- package/lib/rules/no-misleading-character-class.js +14 -7
- package/lib/rules/no-mixed-operators.js +13 -22
- package/lib/rules/no-mixed-requires.js +0 -1
- package/lib/rules/no-multi-spaces.js +1 -1
- package/lib/rules/no-native-reassign.js +4 -4
- package/lib/rules/no-param-reassign.js +28 -7
- package/lib/rules/no-redeclare.js +1 -1
- package/lib/rules/no-regex-spaces.js +0 -1
- package/lib/rules/no-restricted-imports.js +11 -11
- package/lib/rules/no-self-assign.js +12 -13
- package/lib/rules/no-sequences.js +3 -3
- package/lib/rules/no-shadow.js +1 -4
- package/lib/rules/no-tabs.js +8 -2
- package/lib/rules/no-this-before-super.js +12 -13
- package/lib/rules/no-trailing-spaces.js +19 -7
- package/lib/rules/no-unmodified-loop-condition.js +16 -29
- package/lib/rules/no-unneeded-ternary.js +3 -3
- package/lib/rules/no-unreachable.js +7 -7
- package/lib/rules/no-unsafe-finally.js +4 -7
- package/lib/rules/no-unsafe-negation.js +32 -9
- package/lib/rules/no-unused-expressions.js +11 -7
- package/lib/rules/no-unused-labels.js +3 -6
- package/lib/rules/no-unused-vars.js +22 -29
- package/lib/rules/no-use-before-define.js +10 -15
- package/lib/rules/no-useless-call.js +4 -4
- package/lib/rules/no-useless-concat.js +4 -4
- package/lib/rules/no-useless-constructor.js +14 -22
- package/lib/rules/no-useless-escape.js +3 -5
- package/lib/rules/no-useless-rename.js +7 -7
- package/lib/rules/no-useless-return.js +8 -15
- package/lib/rules/no-var.js +12 -25
- package/lib/rules/no-warning-comments.js +0 -1
- package/lib/rules/no-whitespace-before-property.js +3 -3
- package/lib/rules/object-curly-newline.js +7 -10
- package/lib/rules/object-curly-spacing.js +13 -14
- package/lib/rules/object-shorthand.js +1 -1
- package/lib/rules/one-var-declaration-per-line.js +2 -2
- package/lib/rules/operator-assignment.js +22 -1
- package/lib/rules/padded-blocks.js +1 -1
- package/lib/rules/padding-line-between-statements.js +0 -16
- package/lib/rules/prefer-arrow-callback.js +6 -6
- package/lib/rules/prefer-const.js +13 -21
- package/lib/rules/prefer-destructuring.js +1 -7
- package/lib/rules/prefer-named-capture-group.js +0 -1
- package/lib/rules/prefer-numeric-literals.js +32 -4
- package/lib/rules/prefer-object-spread.js +7 -7
- package/lib/rules/prefer-rest-params.js +3 -6
- package/lib/rules/prefer-spread.js +4 -4
- package/lib/rules/prefer-template.js +5 -6
- package/lib/rules/quote-props.js +1 -1
- package/lib/rules/quotes.js +5 -6
- package/lib/rules/radix.js +5 -10
- package/lib/rules/require-await.js +2 -5
- package/lib/rules/require-yield.js +2 -2
- package/lib/rules/rest-spread-spacing.js +1 -1
- package/lib/rules/sort-imports.js +3 -4
- package/lib/rules/sort-keys.js +1 -3
- package/lib/rules/space-before-blocks.js +1 -2
- package/lib/rules/space-in-parens.js +4 -4
- package/lib/rules/space-infix-ops.js +5 -5
- package/lib/rules/spaced-comment.js +15 -18
- package/lib/rules/strict.js +2 -4
- package/lib/rules/symbol-description.js +1 -2
- package/lib/rules/template-curly-spacing.js +2 -2
- package/lib/rules/use-isnan.js +40 -3
- package/lib/rules/utils/ast-utils.js +53 -81
- package/lib/rules/utils/fix-tracker.js +0 -6
- package/lib/rules/utils/lazy-loading-rule-map.js +0 -1
- package/lib/rules/vars-on-top.js +11 -11
- package/lib/shared/config-ops.js +2 -2
- package/lib/shared/runtime-info.js +8 -8
- package/lib/shared/traverser.js +2 -0
- package/lib/source-code/source-code.js +8 -8
- package/lib/source-code/token-store/backward-token-comment-cursor.js +5 -5
- package/lib/source-code/token-store/backward-token-cursor.js +5 -5
- package/lib/source-code/token-store/cursors.js +17 -19
- package/lib/source-code/token-store/decorative-cursor.js +1 -1
- package/lib/source-code/token-store/filter-cursor.js +2 -2
- package/lib/source-code/token-store/forward-token-comment-cursor.js +5 -5
- package/lib/source-code/token-store/forward-token-cursor.js +5 -5
- package/lib/source-code/token-store/index.js +86 -92
- package/lib/source-code/token-store/limit-cursor.js +2 -2
- package/lib/source-code/token-store/padded-token-cursor.js +7 -7
- package/lib/source-code/token-store/skip-cursor.js +2 -2
- package/lib/source-code/token-store/utils.js +9 -13
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,57 @@
|
|
1
|
+
v6.6.0 - October 25, 2019
|
2
|
+
|
3
|
+
* [`39dfe08`](https://github.com/eslint/eslint/commit/39dfe0880fa934e287e8ea1f7b56d5cba8d43765) Update: false positives in function-call-argument-newline (fixes #12123) (#12280) (Scott O'Hara)
|
4
|
+
* [`4d84210`](https://github.com/eslint/eslint/commit/4d842105c9c82026be668d7425213138903d4d41) Update: improve report location for no-trailing-spaces (fixes #12315) (#12477) (Milos Djermanovic)
|
5
|
+
* [`c6a7745`](https://github.com/eslint/eslint/commit/c6a7745a1371a85932bfae5fec039d1b6fcfc128) Update: no-trailing-spaces false negatives after comments (fixes #12479) (#12480) (Milos Djermanovic)
|
6
|
+
* [`0bffe95`](https://github.com/eslint/eslint/commit/0bffe953d2752dd2d3045f2f8771c96b6cee8fc4) Fix: no-misleading-character-class crash on invalid regex (fixes #12169) (#12347) (Milos Djermanovic)
|
7
|
+
* [`c6a9a3b`](https://github.com/eslint/eslint/commit/c6a9a3bc58b69dbf9be9cd09b0283c081ca211e7) Update: Add enforceForIndexOf option to use-isnan (fixes #12207) (#12379) (Milos Djermanovic)
|
8
|
+
* [`364877b`](https://github.com/eslint/eslint/commit/364877b2504e8f7ece04770b93d517e2f27458d0) Update: measure plugin loading time and output in debug message (#12395) (Victor Homyakov)
|
9
|
+
* [`1744fab`](https://github.com/eslint/eslint/commit/1744faba3c93c869f7dbbf0a704d32e2692d6856) Fix: operator-assignment removes and duplicates comments (#12485) (Milos Djermanovic)
|
10
|
+
* [`52ca11a`](https://github.com/eslint/eslint/commit/52ca11a66ab6c2fb5a71d8b9869482f14f98cb9d) Fix: operator-assignment invalid autofix with adjacent tokens (#12483) (Milos Djermanovic)
|
11
|
+
* [`0f6d0dc`](https://github.com/eslint/eslint/commit/0f6d0dcdf5adc30079a7379bbf605a4ef3887a85) Fix: CLIEngine#addPlugin reset lastConfigArrays (fixes #12425) (#12468) (Toru Nagashima)
|
12
|
+
* [`923a8cb`](https://github.com/eslint/eslint/commit/923a8cb752b8dee1e622c5fd36f3f53288e30602) Chore: Fix lint failure in JSDoc comment (#12489) (Brandon Mills)
|
13
|
+
* [`aac3be4`](https://github.com/eslint/eslint/commit/aac3be435cccc241781150fcac728df04d086fa8) Update: Add ignored prop regex no-param-reassign (#11275) (Luke Bennett)
|
14
|
+
* [`e5382d6`](https://github.com/eslint/eslint/commit/e5382d6e4eb1344f537b6f107535269e9939fcb8) Chore: Remove unused parameter in dot-location (#12464) (Milos Djermanovic)
|
15
|
+
* [`49faefb`](https://github.com/eslint/eslint/commit/49faefbee3fc7daaf2482d9d7d23513d6ffda9e8) Fix: no-obj-calls false positive (fixes #12437) (#12467) (Toru Nagashima)
|
16
|
+
* [`b3dbd96`](https://github.com/eslint/eslint/commit/b3dbd9657bbeac6571111a4429b03fc085ba6655) Fix: problematic installation issue (fixes #11018) (#12309) (Toru Nagashima)
|
17
|
+
* [`cd7c29b`](https://github.com/eslint/eslint/commit/cd7c29b17085c14c9cf6345201c72a192c0d0e0c) Sponsors: Sync README with website (ESLint Jenkins)
|
18
|
+
* [`8233873`](https://github.com/eslint/eslint/commit/8233873b8e5facd80ab7b172bff1e896a9c5fd39) Docs: Add note about Node.js requiring SSL support (fixes #11413) (#12475) (Nicholas C. Zakas)
|
19
|
+
* [`89e8aaf`](https://github.com/eslint/eslint/commit/89e8aafcc622a4763bed6b9d62f148ef95798f38) Fix: improve report location for no-tabs (#12471) (Milos Djermanovic)
|
20
|
+
* [`7dffe48`](https://github.com/eslint/eslint/commit/7dffe482d646d4e5f94fa87a22f3b5b2e0a4b189) Update: Enable function string option in comma-dangle (fixes #12058) (#12462) (YeonJuan)
|
21
|
+
* [`e15e1f9`](https://github.com/eslint/eslint/commit/e15e1f933f287d274a726e7f0f0a1dd80f0964af) Docs: fix doc for no-unneeded-ternary rule (fixes #12098) (#12410) (Sam Rae)
|
22
|
+
* [`b1dc58f`](https://github.com/eslint/eslint/commit/b1dc58f0a717cb3d19300c845ca23a21ceb610d3) Sponsors: Sync README with website (ESLint Jenkins)
|
23
|
+
* [`61749c9`](https://github.com/eslint/eslint/commit/61749c94bd8a2ebcdfb89e0cd48c4a029a945079) Chore: Provide debug log for parser errors (#12474) (Brad Zacher)
|
24
|
+
* [`7c8bbe0`](https://github.com/eslint/eslint/commit/7c8bbe0391944e1f92e083a04715bf4b3fe6be5d) Update: enforceForOrderingRelations no-unsafe-negation (fixes #12163) (#12414) (Sam Rae)
|
25
|
+
* [`349ed67`](https://github.com/eslint/eslint/commit/349ed6700e1155384597e1e6035550a96cb8a42d) Update: improve report location for no-mixed-operators (#12328) (Chiawen Chen)
|
26
|
+
* [`a102eaa`](https://github.com/eslint/eslint/commit/a102eaa9ac19e1c6d92f79a4033e9048cfb64c0d) Fix: prefer-numeric-literals invalid autofix with adjacent tokens (#12387) (Milos Djermanovic)
|
27
|
+
* [`6e7c18d`](https://github.com/eslint/eslint/commit/6e7c18ddb30b32ee5b2e842cc8258aa7aebb7445) Update: enforceForNewInMemberExpressions no-extra-parens (fixes #12428) (#12436) (Milos Djermanovic)
|
28
|
+
* [`51fbbd7`](https://github.com/eslint/eslint/commit/51fbbd78f98f223d17071650f5117d07f60dadc2) Fix: array-bracket-newline consistent error with comments (fixes #12416) (#12441) (Milos Djermanovic)
|
29
|
+
* [`e657d4c`](https://github.com/eslint/eslint/commit/e657d4ccb9f3dd5cacceaaa40ffe24ac29a1349a) Fix: report full dot location in dot-location (#12452) (Milos Djermanovic)
|
30
|
+
* [`2d6e345`](https://github.com/eslint/eslint/commit/2d6e345e3c2626b0f2252f22cfaffdf53ea0871a) Update: make isSpaceBetweenTokens() ignore newline in comments (#12407) (YeonJuan)
|
31
|
+
* [`84f71de`](https://github.com/eslint/eslint/commit/84f71de0e686e0fe37b83d6728ce1825caaa44fb) Update: remove default overrides in keyword-spacing (fixes #12369) (#12411) (YeonJuan)
|
32
|
+
* [`18a0b0e`](https://github.com/eslint/eslint/commit/18a0b0e3df927428a22b5b5295f9faee4bd57246) Update: improve report location for no-space-in-parens (#12364) (Chiawen Chen)
|
33
|
+
* [`d61c8a5`](https://github.com/eslint/eslint/commit/d61c8a5a75447a36276f2d4f84afb3e1129618da) Update: improve report location for no-multi-spaces (#12329) (Chiawen Chen)
|
34
|
+
* [`561093f`](https://github.com/eslint/eslint/commit/561093fc4267a4ae317d63bc9f103020fad88802) Upgrade: bump inquirer to ^7.0.0 (#12440) (Joe Graham)
|
35
|
+
* [`fb633b2`](https://github.com/eslint/eslint/commit/fb633b2bbd0a390b247047524fdd1f612dbab803) Chore: Add a script for testing with more control (#12444) (Eric Wang)
|
36
|
+
* [`012ec51`](https://github.com/eslint/eslint/commit/012ec5151113a2be06fc0e4cd208d714e52dbc57) Sponsors: Sync README with website (ESLint Jenkins)
|
37
|
+
* [`874fe16`](https://github.com/eslint/eslint/commit/874fe1642a10a0fb937ccccdd4d22343b84f80dc) New: pass cwd from cli engine (#12389) (Eric Wang)
|
38
|
+
* [`b962775`](https://github.com/eslint/eslint/commit/b962775b8cb7c90985a5ab63e56744bb2ba79644) Update: no-self-assign should detect member expression with this (#12279) (Tibor Blenessy)
|
39
|
+
* [`02977f2`](https://github.com/eslint/eslint/commit/02977f25a922dd0b8617c16116bb4364d0f30e94) Docs: Clarify `eslint:recommended` semver policy (#12429) (Kevin Partington)
|
40
|
+
* [`97045ae`](https://github.com/eslint/eslint/commit/97045ae0805e6503887eef0b131dcb9e70b6d185) Docs: Fixes object type for `rules` in "Use a Plugin" (#12409) (Daisy Develops)
|
41
|
+
* [`24ca088`](https://github.com/eslint/eslint/commit/24ca088fdc901feef8f10b050414fbde64b55c7d) Docs: Fix typo in v6 migration guide (#12412) (Benjamim Sonntag)
|
42
|
+
* [`b094008`](https://github.com/eslint/eslint/commit/b094008fb196dc1de5b4c27b7dbf0bcbb4b7b352) Chore: update version parameter name (#12402) (Toru Nagashima)
|
43
|
+
* [`e5637ba`](https://github.com/eslint/eslint/commit/e5637badd42f087d115f81575b832097fe6fe554) Chore: enable jsdoc/require-description (#12365) (Kai Cataldo)
|
44
|
+
* [`d31f337`](https://github.com/eslint/eslint/commit/d31f3370396ec4868722bdc044aa697b135ac183) Sponsors: Sync README with website (ESLint Jenkins)
|
45
|
+
* [`7ffb22f`](https://github.com/eslint/eslint/commit/7ffb22f61cf1622511a7fe42b5ead7c3b216df5e) Chore: Clean up inline directive parsing (#12375) (Jordan Eldredge)
|
46
|
+
* [`84467c0`](https://github.com/eslint/eslint/commit/84467c07461cc47ee43807ba9014e13700473c5c) Docs: fix wrong max-depth example (fixes #11991) (#12358) (Gabriel R Sezefredo)
|
47
|
+
* [`3642342`](https://github.com/eslint/eslint/commit/364234262efabd91fa8bd53161d9d3e1e37e7944) Docs: Fix minor formatting/grammar errors (#12371) (cherryblossom000)
|
48
|
+
* [`c47fa0d`](https://github.com/eslint/eslint/commit/c47fa0dfc76211b3b0e5649c63acdd9606ce0eca) Docs: Fix missing word in sentence (#12361) (Dan Boulet)
|
49
|
+
* [`8108f49`](https://github.com/eslint/eslint/commit/8108f49f9fa0c2de80b3b66c847551beff585951) Chore: enable additional eslint-plugin-jsdoc rules (#12336) (Kai Cataldo)
|
50
|
+
* [`b718d2e`](https://github.com/eslint/eslint/commit/b718d2e6c9fe3fc56aa7cfc68b1a40b5cd8a7c01) Chore: update issue template with --eslint-fix flag (#12352) (James George)
|
51
|
+
* [`20ba14d`](https://github.com/eslint/eslint/commit/20ba14dc78fc2654b2920d14877dde21c6c10da4) Sponsors: Sync README with website (ESLint Jenkins)
|
52
|
+
* [`566a947`](https://github.com/eslint/eslint/commit/566a947f67c8038a50e204d68723519778a78a0f) Sponsors: Sync README with website (ESLint Jenkins)
|
53
|
+
* [`070cbd0`](https://github.com/eslint/eslint/commit/070cbd0a2ec07831962a25c4276d08e097302416) Sponsors: Sync README with website (ESLint Jenkins)
|
54
|
+
|
1
55
|
v6.5.1 - September 30, 2019
|
2
56
|
|
3
57
|
* [`0d3d7d9`](https://github.com/eslint/eslint/commit/0d3d7d9cdd83a7f0e035c95f716a91b9ecc4868b) Docs: fix typo in no-magic-numbers (#12345) (Josiah Rooney)
|
package/README.md
CHANGED
@@ -40,7 +40,7 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J
|
|
40
40
|
|
41
41
|
## <a name="installation-and-usage"></a>Installation and Usage
|
42
42
|
|
43
|
-
Prerequisites: [Node.js](https://nodejs.org/) (`^8.10.0`, `^10.13.0`, or `>=11.10.1`),
|
43
|
+
Prerequisites: [Node.js](https://nodejs.org/) (`^8.10.0`, `^10.13.0`, or `>=11.10.1`) built with SSL support. (If you are using an official Node.js distribution, SSL is always built in.)
|
44
44
|
|
45
45
|
You can install ESLint using npm:
|
46
46
|
|
@@ -156,8 +156,9 @@ ESLint follows [semantic versioning](https://semver.org). However, due to the na
|
|
156
156
|
* A new CLI capability is created.
|
157
157
|
* New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
|
158
158
|
* A new formatter is created.
|
159
|
+
* `eslint:recommended` is updated and will result in strictly fewer errors (e.g., rule removals).
|
159
160
|
* Major release (likely to break your lint build)
|
160
|
-
* `eslint:recommended` is updated.
|
161
|
+
* `eslint:recommended` is updated and may result in new errors (e.g., rule additions, most rule option updates).
|
161
162
|
* A new option to an existing rule that results in ESLint reporting more errors by default.
|
162
163
|
* An existing formatter is removed.
|
163
164
|
* Part of the public API is removed or changed in an incompatible way.
|
@@ -264,7 +265,7 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
264
265
|
<h3>Gold Sponsors</h3>
|
265
266
|
<p><a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/eeb91aa/logo.png" alt="Shopify" height="96"></a> <a href="http://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://badoo.com/team?utm_source=eslint"><img src="https://images.opencollective.com/badoo/2826a3b/logo.png" alt="Badoo" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://opensource.facebook.com"><img src="https://images.opencollective.com/fbopensource/fbb8a5b/logo.png" alt="Facebook Open Source" height="96"></a></p><h3>Silver Sponsors</h3>
|
266
267
|
<p><a href="https://www.ampproject.org/"><img src="https://images.opencollective.com/amp/c8a3b25/logo.png" alt="AMP Project" height="64"></a></p><h3>Bronze Sponsors</h3>
|
267
|
-
<p><a href="https://
|
268
|
+
<p><a href="https://uxplanet.org/top-ui-ux-design-agencies-user-experience-firms-8c54697e290"><img src="https://images.opencollective.com/ui-ux-design-agencies/cae5dfe/logo.png" alt="UI UX Design Agencies" height="32"></a> <a href="https://www.bugsnag.com/platforms?utm_source=Open Collective&utm_medium=Website&utm_content=open-source&utm_campaign=2019-community&utm_term="><img src="https://images.opencollective.com/bugsnag-stability-monitoring/c2cef36/logo.png" alt="Bugsnag Stability Monitoring" height="32"></a> <a href="https://www.minitool.com"><img src="https://images.opencollective.com/minitool-software-ltd/6d68e16/logo.png" alt="MiniTool Software Ltd" height="32"></a> <a href="https://www.codacy.com/?utm_source=eslint&utm_medium=cpm&utm_campaign=eslint-sponsorship"><img src="https://images.opencollective.com/codacy/ed22716/logo.png" alt="Codacy" height="32"></a> <a href="https://mixpanel.com"><img src="https://images.opencollective.com/mixpanel/cd682f7/logo.png" alt="Mixpanel" height="32"></a> <a href="https://www.vpsserver.com"><img src="https://images.opencollective.com/vpsservercom/logo.png" alt="VPS Server" height="32"></a> <a href="https://icons8.com"><img src="https://images.opencollective.com/icons8/0b37d14/logo.png" alt="Free Icons by Icons8" height="32"></a> <a href="https://www.crosswordsolver.com"><img src="https://images.opencollective.com/crosswordsolver/d4481d6/logo.png" alt="Crosswordsolver" height="32"></a> <a href="https://clay.global"><img src="https://images.opencollective.com/clayglobal/2468f34/logo.png" alt="clay" height="32"></a> <a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/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/bc73c28/logo.png" alt="TekHattan" height="32"></a> <a href="https://www.marfeel.com/"><img src="https://images.opencollective.com/marfeel/4b88e30/logo.png" alt="Marfeel" height="32"></a> <a href="http://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://jsheroes.io/"><img src="https://images.opencollective.com/jsheroes1/9fedf0b/logo.png" alt="JSHeroes " height="32"></a></p>
|
268
269
|
<!--sponsorsend-->
|
269
270
|
|
270
271
|
## <a name="technology-sponsors"></a>Technology Sponsors
|
@@ -152,8 +152,9 @@ function createCLIConfigArray({
|
|
152
152
|
*/
|
153
153
|
class ConfigurationNotFoundError extends Error {
|
154
154
|
|
155
|
+
// eslint-disable-next-line jsdoc/require-description
|
155
156
|
/**
|
156
|
-
* @param {string} directoryPath
|
157
|
+
* @param {string} directoryPath The directory path.
|
157
158
|
*/
|
158
159
|
constructor(directoryPath) {
|
159
160
|
super(`No ESLint configuration found in ${directoryPath}.`);
|
@@ -145,7 +145,7 @@ function validateFixTypes(fixTypes) {
|
|
145
145
|
|
146
146
|
/**
|
147
147
|
* It will calculate the error and warning count for collection of messages per file
|
148
|
-
* @param {LintMessage[]} messages
|
148
|
+
* @param {LintMessage[]} messages Collection of messages
|
149
149
|
* @returns {Object} Contains the stats
|
150
150
|
* @private
|
151
151
|
*/
|
@@ -173,7 +173,7 @@ function calculateStatsPerFile(messages) {
|
|
173
173
|
|
174
174
|
/**
|
175
175
|
* It will calculate the error and warning count for collection of results from all files
|
176
|
-
* @param {LintResult[]} results
|
176
|
+
* @param {LintResult[]} results Collection of messages from all the files
|
177
177
|
* @returns {Object} Contains the stats
|
178
178
|
* @private
|
179
179
|
*/
|
@@ -272,8 +272,8 @@ function verifyText({
|
|
272
272
|
|
273
273
|
/**
|
274
274
|
* Returns result with warning by ignore settings
|
275
|
-
* @param {string} filePath
|
276
|
-
* @param {string} baseDir
|
275
|
+
* @param {string} filePath File path of checked code
|
276
|
+
* @param {string} baseDir Absolute path of base directory
|
277
277
|
* @returns {LintResult} Result with single warning
|
278
278
|
* @private
|
279
279
|
*/
|
@@ -387,7 +387,6 @@ function isErrorMessage(message) {
|
|
387
387
|
* name will be the `cacheFile/.cache_hashOfCWD`
|
388
388
|
*
|
389
389
|
* if cacheFile points to a file or looks like a file then in will just use that file
|
390
|
-
*
|
391
390
|
* @param {string} cacheFile The name of file to be used to store the cache
|
392
391
|
* @param {string} cwd Current working directory
|
393
392
|
* @returns {string} the resolved path to the cache file
|
@@ -568,7 +567,7 @@ class CLIEngine {
|
|
568
567
|
});
|
569
568
|
const lintResultCache =
|
570
569
|
options.cache ? new LintResultCache(cacheFilePath) : null;
|
571
|
-
const linter = new Linter();
|
570
|
+
const linter = new Linter({ cwd: options.cwd });
|
572
571
|
|
573
572
|
/** @type {ConfigArray[]} */
|
574
573
|
const lastConfigArrays = [configArrayFactory.getConfigArrayForFile()];
|
@@ -668,11 +667,14 @@ class CLIEngine {
|
|
668
667
|
addPlugin(name, pluginObject) {
|
669
668
|
const {
|
670
669
|
additionalPluginPool,
|
671
|
-
configArrayFactory
|
670
|
+
configArrayFactory,
|
671
|
+
lastConfigArrays
|
672
672
|
} = internalSlotsMap.get(this);
|
673
673
|
|
674
674
|
additionalPluginPool.set(name, pluginObject);
|
675
675
|
configArrayFactory.clearCache();
|
676
|
+
lastConfigArrays.length = 1;
|
677
|
+
lastConfigArrays[0] = configArrayFactory.getConfigArrayForFile();
|
676
678
|
}
|
677
679
|
|
678
680
|
/**
|
@@ -126,7 +126,6 @@ function isNonNullObject(x) {
|
|
126
126
|
*
|
127
127
|
* Assign every property values of `y` to `x` if `x` doesn't have the property.
|
128
128
|
* If `x`'s property value is an object, it does recursive.
|
129
|
-
*
|
130
129
|
* @param {Object} target The destination to merge
|
131
130
|
* @param {Object|undefined} source The source to merge.
|
132
131
|
* @returns {void}
|
@@ -157,7 +156,6 @@ function mergeWithoutOverwrite(target, source) {
|
|
157
156
|
/**
|
158
157
|
* Merge plugins.
|
159
158
|
* `target`'s definition is prior to `source`'s.
|
160
|
-
*
|
161
159
|
* @param {Record<string, DependentPlugin>} target The destination to merge
|
162
160
|
* @param {Record<string, DependentPlugin>|undefined} source The source to merge.
|
163
161
|
* @returns {void}
|
@@ -187,7 +185,6 @@ function mergePlugins(target, source) {
|
|
187
185
|
/**
|
188
186
|
* Merge rule configs.
|
189
187
|
* `target`'s definition is prior to `source`'s.
|
190
|
-
*
|
191
188
|
* @param {Record<string, Array>} target The destination to merge
|
192
189
|
* @param {Record<string, RuleConf>|undefined} source The source to merge.
|
193
190
|
* @returns {void}
|
@@ -382,7 +379,6 @@ function ensurePluginMemberMaps(instance) {
|
|
382
379
|
* You need to call `ConfigArray#extractConfig(filePath)` method in order to
|
383
380
|
* extract, merge and get only the config data which is related to an arbitrary
|
384
381
|
* file.
|
385
|
-
*
|
386
382
|
* @extends {Array<ConfigArrayElement>}
|
387
383
|
*/
|
388
384
|
class ConfigArray extends Array {
|
@@ -81,6 +81,7 @@ class ConfigDependency {
|
|
81
81
|
this.importerPath = importerPath;
|
82
82
|
}
|
83
83
|
|
84
|
+
// eslint-disable-next-line jsdoc/require-description
|
84
85
|
/**
|
85
86
|
* @returns {Object} a JSON compatible object.
|
86
87
|
*/
|
@@ -95,6 +96,7 @@ class ConfigDependency {
|
|
95
96
|
return obj;
|
96
97
|
}
|
97
98
|
|
99
|
+
// eslint-disable-next-line jsdoc/require-description
|
98
100
|
/**
|
99
101
|
* @returns {Object} an object to display by `console.log()`.
|
100
102
|
*/
|
@@ -166,6 +166,7 @@ class OverrideTester {
|
|
166
166
|
));
|
167
167
|
}
|
168
168
|
|
169
|
+
// eslint-disable-next-line jsdoc/require-description
|
169
170
|
/**
|
170
171
|
* @returns {Object} a JSON compatible object.
|
171
172
|
*/
|
@@ -182,6 +183,7 @@ class OverrideTester {
|
|
182
183
|
};
|
183
184
|
}
|
184
185
|
|
186
|
+
// eslint-disable-next-line jsdoc/require-description
|
185
187
|
/**
|
186
188
|
* @returns {Object} an object to display by `console.log()`.
|
187
189
|
*/
|
@@ -859,8 +859,14 @@ class ConfigArrayFactory {
|
|
859
859
|
if (filePath) {
|
860
860
|
try {
|
861
861
|
writeDebugLogForLoading(request, relativeTo, filePath);
|
862
|
+
|
863
|
+
const startTime = Date.now();
|
864
|
+
const pluginDefinition = require(filePath);
|
865
|
+
|
866
|
+
debug(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`);
|
867
|
+
|
862
868
|
return new ConfigDependency({
|
863
|
-
definition: normalizePlugin(
|
869
|
+
definition: normalizePlugin(pluginDefinition),
|
864
870
|
filePath,
|
865
871
|
id,
|
866
872
|
importerName,
|
@@ -149,9 +149,10 @@ function readdirSafeSync(directoryPath) {
|
|
149
149
|
*/
|
150
150
|
class NoFilesFoundError extends Error {
|
151
151
|
|
152
|
+
// eslint-disable-next-line jsdoc/require-description
|
152
153
|
/**
|
153
|
-
* @param {string} pattern
|
154
|
-
* @param {boolean} globDisabled
|
154
|
+
* @param {string} pattern The glob pattern which was not found.
|
155
|
+
* @param {boolean} globDisabled If `true` then the pattern was a glob pattern, but glob was disabled.
|
155
156
|
*/
|
156
157
|
constructor(pattern, globDisabled) {
|
157
158
|
super(`No files matching '${pattern}' were found${globDisabled ? " (glob was disabled)" : ""}.`);
|
@@ -165,8 +166,9 @@ class NoFilesFoundError extends Error {
|
|
165
166
|
*/
|
166
167
|
class AllFilesIgnoredError extends Error {
|
167
168
|
|
169
|
+
// eslint-disable-next-line jsdoc/require-description
|
168
170
|
/**
|
169
|
-
* @param {string} pattern
|
171
|
+
* @param {string} pattern The glob pattern which was not found.
|
170
172
|
*/
|
171
173
|
constructor(pattern) {
|
172
174
|
super(`All files matched by '${pattern}' are ignored.`);
|
@@ -96,6 +96,7 @@ function renderMessages(messages, parentIndex, rulesMeta) {
|
|
96
96
|
}).join("\n");
|
97
97
|
}
|
98
98
|
|
99
|
+
// eslint-disable-next-line jsdoc/require-description
|
99
100
|
/**
|
100
101
|
* @param {Array} results Test results.
|
101
102
|
* @param {Object} rulesMeta Dictionary containing metadata for each rule executed by the analysis.
|
@@ -121,6 +121,7 @@ function relativize(globPattern, relativePathToOldBaseDir) {
|
|
121
121
|
*/
|
122
122
|
class IgnoredPaths {
|
123
123
|
|
124
|
+
// eslint-disable-next-line jsdoc/require-description
|
124
125
|
/**
|
125
126
|
* @param {Object} providedOptions object containing 'ignore', 'ignorePath' and 'patterns' properties
|
126
127
|
*/
|
package/lib/init/autoconfig.js
CHANGED
@@ -31,7 +31,6 @@ const MAX_CONFIG_COMBINATIONS = 17, // 16 combinations + 1 for severity only
|
|
31
31
|
|
32
32
|
/**
|
33
33
|
* Information about a rule configuration, in the context of a Registry.
|
34
|
-
*
|
35
34
|
* @typedef {Object} registryItem
|
36
35
|
* @param {ruleConfig} config A valid configuration for the rule
|
37
36
|
* @param {number} specificity The number of elements in the ruleConfig array
|
@@ -70,6 +69,7 @@ function makeRegistryItems(rulesConfig) {
|
|
70
69
|
*/
|
71
70
|
class Registry {
|
72
71
|
|
72
|
+
// eslint-disable-next-line jsdoc/require-description
|
73
73
|
/**
|
74
74
|
* @param {rulesConfig} [rulesConfig] Hash of rule names and arrays of possible configurations
|
75
75
|
*/
|
@@ -82,7 +82,6 @@ class Registry {
|
|
82
82
|
*
|
83
83
|
* It will set the registry's `rule` property to an object having rule names
|
84
84
|
* as keys and an array of registryItems as values.
|
85
|
-
*
|
86
85
|
* @returns {void}
|
87
86
|
*/
|
88
87
|
populateFromCoreRules() {
|
@@ -101,7 +100,6 @@ class Registry {
|
|
101
100
|
* configurations.
|
102
101
|
*
|
103
102
|
* The length of the returned array will be <= MAX_CONFIG_COMBINATIONS.
|
104
|
-
*
|
105
103
|
* @returns {Object[]} "rules" configurations to use for linting
|
106
104
|
*/
|
107
105
|
buildRuleSets() {
|
@@ -114,7 +112,6 @@ class Registry {
|
|
114
112
|
*
|
115
113
|
* This is broken out into its own function so that it doesn't need to be
|
116
114
|
* created inside of the while loop.
|
117
|
-
*
|
118
115
|
* @param {string} rule The ruleId to add.
|
119
116
|
* @returns {void}
|
120
117
|
*/
|
@@ -162,7 +159,6 @@ class Registry {
|
|
162
159
|
*
|
163
160
|
* Note: this also removes rule configurations which were not linted
|
164
161
|
* (meaning, they have an undefined errorCount).
|
165
|
-
*
|
166
162
|
* @returns {void}
|
167
163
|
*/
|
168
164
|
stripFailingConfigs() {
|
@@ -185,7 +181,6 @@ class Registry {
|
|
185
181
|
|
186
182
|
/**
|
187
183
|
* Removes rule configurations which were not included in a ruleSet
|
188
|
-
*
|
189
184
|
* @returns {void}
|
190
185
|
*/
|
191
186
|
stripExtraConfigs() {
|
@@ -204,7 +199,6 @@ class Registry {
|
|
204
199
|
* Creates a registry of rules which had no error-free configs.
|
205
200
|
* The new registry is intended to be analyzed to determine whether its rules
|
206
201
|
* should be disabled or set to warning.
|
207
|
-
*
|
208
202
|
* @returns {Registry} A registry of failing rules.
|
209
203
|
*/
|
210
204
|
getFailingRulesRegistry() {
|
@@ -225,7 +219,6 @@ class Registry {
|
|
225
219
|
/**
|
226
220
|
* Create an eslint config for any rules which only have one configuration
|
227
221
|
* in the registry.
|
228
|
-
*
|
229
222
|
* @returns {Object} An eslint config with rules section populated
|
230
223
|
*/
|
231
224
|
createConfig() {
|
@@ -243,7 +236,6 @@ class Registry {
|
|
243
236
|
|
244
237
|
/**
|
245
238
|
* Return a cloned registry containing only configs with a desired specificity
|
246
|
-
*
|
247
239
|
* @param {number} specificity Only keep configs with this specificity
|
248
240
|
* @returns {Registry} A registry of rules
|
249
241
|
*/
|
@@ -261,7 +253,6 @@ class Registry {
|
|
261
253
|
|
262
254
|
/**
|
263
255
|
* Lint SourceCodes against all configurations in the registry, and record results
|
264
|
-
*
|
265
256
|
* @param {Object[]} sourceCodes SourceCode objects for each filename
|
266
257
|
* @param {Object} config ESLint config object
|
267
258
|
* @param {progressCallback} [cb] Optional callback for reporting execution status
|
@@ -327,7 +318,6 @@ class Registry {
|
|
327
318
|
*
|
328
319
|
* This will return a new config with `"extends": "eslint:recommended"` and
|
329
320
|
* only the rules which have configurations different from the recommended config.
|
330
|
-
*
|
331
321
|
* @param {Object} config config object
|
332
322
|
* @returns {Object} config object using `"extends": "eslint:recommended"`
|
333
323
|
*/
|
package/lib/init/config-file.js
CHANGED
@@ -23,7 +23,6 @@ const debug = require("debug")("eslint:config-file");
|
|
23
23
|
* Determines sort order for object keys for json-stable-stringify
|
24
24
|
*
|
25
25
|
* see: https://github.com/samn/json-stable-stringify#cmp
|
26
|
-
*
|
27
26
|
* @param {Object} a The first comparison object ({key: akey, value: avalue})
|
28
27
|
* @param {Object} b The second comparison object ({key: bkey, value: bvalue})
|
29
28
|
* @returns {number} 1 or -1, used in stringify cmp method
|
@@ -147,7 +147,6 @@ function getModulesList(config, installESLint) {
|
|
147
147
|
*
|
148
148
|
* Note: This clones the config object and returns a new config to avoid mutating
|
149
149
|
* the original config parameter.
|
150
|
-
*
|
151
150
|
* @param {Object} answers answers received from inquirer
|
152
151
|
* @param {Object} config config object
|
153
152
|
* @returns {Object} config object with configured rules
|
package/lib/init/config-rule.js
CHANGED
@@ -33,7 +33,6 @@ function explodeArray(xs) {
|
|
33
33
|
*
|
34
34
|
* For example:
|
35
35
|
* combineArrays([a, [b, c]], [x, y]); // -> [[a, x], [a, y], [b, c, x], [b, c, y]]
|
36
|
-
*
|
37
36
|
* @param {Array} arr1 The first array to combine.
|
38
37
|
* @param {Array} arr2 The second array to combine.
|
39
38
|
* @returns {Array} A mixture of the elements of the first and second arrays.
|
@@ -71,7 +70,6 @@ function combineArrays(arr1, arr2) {
|
|
71
70
|
* [{before: true}, {before: false}],
|
72
71
|
* [{after: true}, {after: false}]
|
73
72
|
* ]
|
74
|
-
*
|
75
73
|
* @param {Object[]} objects Array of objects, each with one property/value pair
|
76
74
|
* @returns {Array[]} Array of arrays of objects grouped by property
|
77
75
|
*/
|
@@ -98,7 +96,6 @@ function groupByProperty(objects) {
|
|
98
96
|
* element in the array is the severity, and is the only required element.
|
99
97
|
* Configs may also have one or more additional elements to specify rule
|
100
98
|
* configuration or options.
|
101
|
-
*
|
102
99
|
* @typedef {Array|number} ruleConfig
|
103
100
|
* @param {number} 0 The rule's severity (0, 1, 2).
|
104
101
|
*/
|
@@ -134,7 +131,6 @@ function groupByProperty(objects) {
|
|
134
131
|
* {before: false, after: true},
|
135
132
|
* {before: false, after: false}
|
136
133
|
* ]
|
137
|
-
*
|
138
134
|
* @param {Object[]} objArr1 Single key/value objects, all with the same key
|
139
135
|
* @param {Object[]} objArr2 Single key/value objects, all with another key
|
140
136
|
* @returns {Object[]} Combined objects for each combination of input properties and values
|
@@ -178,6 +174,7 @@ function combinePropertyObjects(objArr1, objArr2) {
|
|
178
174
|
*/
|
179
175
|
class RuleConfigSet {
|
180
176
|
|
177
|
+
// eslint-disable-next-line jsdoc/require-description
|
181
178
|
/**
|
182
179
|
* @param {ruleConfig[]} configs Valid rule configurations
|
183
180
|
*/
|
@@ -193,7 +190,6 @@ class RuleConfigSet {
|
|
193
190
|
/**
|
194
191
|
* Add a severity level to the front of all configs in the instance.
|
195
192
|
* This should only be called after all configs have been added to the instance.
|
196
|
-
*
|
197
193
|
* @returns {void}
|
198
194
|
*/
|
199
195
|
addErrorSeverity() {
|
package/lib/init/npm-utils.js
CHANGED
@@ -21,7 +21,6 @@ const fs = require("fs"),
|
|
21
21
|
/**
|
22
22
|
* Find the closest package.json file, starting at process.cwd (by default),
|
23
23
|
* and working up to root.
|
24
|
-
*
|
25
24
|
* @param {string} [startDir=process.cwd()] Starting directory
|
26
25
|
* @returns {string} Absolute path to closest package.json file
|
27
26
|
*/
|
@@ -88,7 +87,6 @@ function fetchPeerDependencies(packageName) {
|
|
88
87
|
|
89
88
|
/**
|
90
89
|
* Check whether node modules are include in a project's package.json.
|
91
|
-
*
|
92
90
|
* @param {string[]} packages Array of node module names
|
93
91
|
* @param {Object} opt Options Object
|
94
92
|
* @param {boolean} opt.dependencies Set to true to check for direct dependencies
|
@@ -136,7 +134,6 @@ function check(packages, opt) {
|
|
136
134
|
* package.json.
|
137
135
|
*
|
138
136
|
* Convenience wrapper around check().
|
139
|
-
*
|
140
137
|
* @param {string[]} packages Array of node modules to check.
|
141
138
|
* @param {string} rootDir The directory contianing a package.json
|
142
139
|
* @returns {Object} An object whose keys are the module names
|
@@ -151,7 +148,6 @@ function checkDeps(packages, rootDir) {
|
|
151
148
|
* package.json.
|
152
149
|
*
|
153
150
|
* Convenience wrapper around check().
|
154
|
-
*
|
155
151
|
* @param {string[]} packages Array of node modules to check.
|
156
152
|
* @returns {Object} An object whose keys are the module names
|
157
153
|
* and values are booleans indicating installation.
|
@@ -162,7 +158,6 @@ function checkDevDeps(packages) {
|
|
162
158
|
|
163
159
|
/**
|
164
160
|
* Check whether package.json is found in current path.
|
165
|
-
*
|
166
161
|
* @param {string} [startDir] Starting directory
|
167
162
|
* @returns {boolean} Whether a package.json is found in current path.
|
168
163
|
*/
|