eslint 7.1.0 → 7.4.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 +69 -0
- package/README.md +12 -7
- package/lib/cli-engine/cli-engine.js +2 -2
- package/lib/cli-engine/config-array-factory.js +1 -1
- package/lib/init/config-initializer.js +91 -74
- package/lib/linter/code-path-analysis/code-path-analyzer.js +2 -2
- package/lib/linter/code-path-analysis/code-path-state.js +34 -12
- package/lib/linter/config-comment-parser.js +1 -1
- package/lib/rule-tester/rule-tester.js +9 -0
- package/lib/rules/array-callback-return.js +21 -10
- package/lib/rules/arrow-body-style.js +2 -2
- package/lib/rules/arrow-parens.js +91 -108
- package/lib/rules/camelcase.js +47 -0
- package/lib/rules/comma-dangle.js +2 -1
- package/lib/rules/curly.js +8 -1
- package/lib/rules/func-call-spacing.js +18 -3
- package/lib/rules/{id-blacklist.js → id-denylist.js} +12 -12
- package/lib/rules/id-match.js +2 -1
- package/lib/rules/index.js +6 -1
- package/lib/rules/key-spacing.js +6 -2
- package/lib/rules/keyword-spacing.js +9 -2
- package/lib/rules/max-lines.js +34 -8
- package/lib/rules/multiline-ternary.js +44 -25
- package/lib/rules/no-control-regex.js +1 -1
- package/lib/rules/no-extra-boolean-cast.js +3 -0
- package/lib/rules/no-extra-parens.js +50 -4
- package/lib/rules/no-invalid-regexp.js +1 -1
- package/lib/rules/no-misleading-character-class.js +1 -1
- package/lib/rules/no-mixed-operators.js +3 -2
- package/lib/rules/no-mixed-spaces-and-tabs.js +14 -6
- package/lib/rules/no-promise-executor-return.js +121 -0
- package/lib/rules/no-regex-spaces.js +1 -1
- package/lib/rules/no-restricted-exports.js +6 -0
- package/lib/rules/no-unneeded-ternary.js +6 -4
- package/lib/rules/no-unreachable-loop.js +150 -0
- package/lib/rules/no-unused-expressions.js +1 -1
- package/lib/rules/no-unused-vars.js +5 -2
- package/lib/rules/no-useless-backreference.js +1 -1
- package/lib/rules/object-property-newline.js +1 -1
- package/lib/rules/operator-linebreak.js +2 -5
- package/lib/rules/padded-blocks.js +2 -1
- package/lib/rules/prefer-named-capture-group.js +1 -1
- package/lib/rules/prefer-regex-literals.js +66 -8
- package/lib/rules/quote-props.js +2 -2
- package/lib/rules/semi-spacing.js +1 -0
- package/lib/rules/template-tag-spacing.js +8 -2
- package/lib/rules/utils/ast-utils.js +55 -3
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,70 @@
|
|
1
|
+
v7.4.0 - July 3, 2020
|
2
|
+
|
3
|
+
* [`f21bad2`](https://github.com/eslint/eslint/commit/f21bad2680406a2671b877f8dba47f4475d0cc64) Docs: fix description for `never` in multiline-ternary (fixes #13368) (#13452) (Milos Djermanovic)
|
4
|
+
* [`ada2c89`](https://github.com/eslint/eslint/commit/ada2c891298382f82dfabf37cacd59a1057b2bb7) Fix: support typescript generics in arrow-parens (fixes #12570) (#13451) (Milos Djermanovic)
|
5
|
+
* [`89ee01e`](https://github.com/eslint/eslint/commit/89ee01e083f1e02293bf8d1447f9b0fdb3cb9384) Fix: Revert config cloning (fixes #13447) (#13449) (薛定谔的猫)
|
6
|
+
* [`0a463db`](https://github.com/eslint/eslint/commit/0a463dbf7cc5a77d442879c9117204d4d38db972) Docs: fix no-multiple-empty-lines examples (fixes #13432) (#13433) (Milos Djermanovic)
|
7
|
+
* [`ff5317e`](https://github.com/eslint/eslint/commit/ff5317e93425f93cfdf808609551ee67b2032543) Update: Improve array-callback-return report message (#13395) (Philip (flip) Kromer)
|
8
|
+
* [`3f51930`](https://github.com/eslint/eslint/commit/3f51930eea7cddc921a9ee3cb0328c7b649c0f83) Fix: false positive new with member in no-extra-parens (fixes #12740) (#13375) (YeonJuan)
|
9
|
+
* [`825a5b9`](https://github.com/eslint/eslint/commit/825a5b98d3d84f6eb72b75f7d8519de763cc8898) Fix: Clarify documentation on implicit ignore behavior (fixes #12348) (#12600) (Scott Hardin)
|
10
|
+
* [`c139156`](https://github.com/eslint/eslint/commit/c1391566a5f765f25716527de7b5cdee16c0ce36) Sponsors: Sync README with website (ESLint Jenkins)
|
11
|
+
* [`0c17e9d`](https://github.com/eslint/eslint/commit/0c17e9d2ac307cc288eea6ed7971bd5a7d33321a) Sponsors: Sync README with website (ESLint Jenkins)
|
12
|
+
* [`c680387`](https://github.com/eslint/eslint/commit/c680387ba61f6dccf0390d24a85d871fa83e9fea) Sponsors: Sync README with website (ESLint Jenkins)
|
13
|
+
* [`bf3939b`](https://github.com/eslint/eslint/commit/bf3939bbd9a33d0eb96cebe6a53bf61c855f9ba6) Sponsors: Sync README with website (ESLint Jenkins)
|
14
|
+
* [`7baf02e`](https://github.com/eslint/eslint/commit/7baf02e983af909800261263f125cca901a5bd0f) Sponsors: Sync README with website (ESLint Jenkins)
|
15
|
+
* [`5c4c3fd`](https://github.com/eslint/eslint/commit/5c4c3fdfbda18a13223ad36f44283adbfee8c496) Sponsors: Sync README with website (ESLint Jenkins)
|
16
|
+
* [`53912aa`](https://github.com/eslint/eslint/commit/53912aab1856327b399cca26cbb2ba81fd01bfa2) Sponsors: Sync README with website (ESLint Jenkins)
|
17
|
+
* [`51e42ec`](https://github.com/eslint/eslint/commit/51e42eca3e87d8259815d736ffe81e604f184057) Update: Add option "ignoreGlobals" to camelcase rule (fixes #11716) (#12782) (David Gasperoni)
|
18
|
+
* [`0655f66`](https://github.com/eslint/eslint/commit/0655f66525d167ca1288167b79a77087cfc8fcf6) Update: improve report location in arrow-body-style (refs #12334) (#13424) (YeonJuan)
|
19
|
+
* [`d53d69a`](https://github.com/eslint/eslint/commit/d53d69af08cfe55f42e0a0ca725b1014dabccc21) Update: prefer-regex-literal detect regex literals (fixes #12840) (#12842) (Mathias Schreck)
|
20
|
+
* [`004adae`](https://github.com/eslint/eslint/commit/004adae3f959414f56e44e5884f6221e9dcda142) Update: rename id-blacklist to id-denylist (fixes #13407) (#13408) (Kai Cataldo)
|
21
|
+
v7.3.1 - June 22, 2020
|
22
|
+
|
23
|
+
* [`de77c11`](https://github.com/eslint/eslint/commit/de77c11e7515f2097ff355ddc0d7b6db9c83c892) Fix: Replace Infinity with Number.MAX_SAFE_INTEGER (fixes #13427) (#13435) (Nicholas C. Zakas)
|
24
|
+
v7.3.0 - June 19, 2020
|
25
|
+
|
26
|
+
* [`638a6d6`](https://github.com/eslint/eslint/commit/638a6d6be18b4a37cfdc7223e1f5acd3718694be) Update: add missing `additionalProperties: false` to some rules' schema (#13198) (Milos Djermanovic)
|
27
|
+
* [`949a5cd`](https://github.com/eslint/eslint/commit/949a5cd741c2e930cfb43d80a9b6b084f9d677c3) Update: fix operator-linebreak overrides schema (#13199) (Milos Djermanovic)
|
28
|
+
* [`9e1414e`](https://github.com/eslint/eslint/commit/9e1414ee16b8caf582920f8fdf3b6ee1eb0b7cd5) New: Add no-promise-executor-return rule (fixes #12640) (#12648) (Milos Djermanovic)
|
29
|
+
* [`09cc0a2`](https://github.com/eslint/eslint/commit/09cc0a2bb5bcf3bcb0766a3c989871f268518437) Update: max-lines reporting loc improvement (refs #12334) (#13318) (Anix)
|
30
|
+
* [`ee2fc2e`](https://github.com/eslint/eslint/commit/ee2fc2e90d0f9dfcdba852b0609156bee5280b92) Update: object-property-newline end location (refs #12334) (#13399) (Anix)
|
31
|
+
* [`d98152a`](https://github.com/eslint/eslint/commit/d98152a3d8c72e4f5ac4c6fa10a615b12090c8f7) Update: added empty error array check for false negative (#13200) (Anix)
|
32
|
+
* [`7fb45cf`](https://github.com/eslint/eslint/commit/7fb45cf13e9908d489bd6d5fba3b7243c01508b9) Fix: clone config before validating (fixes #12592) (#13034) (Anix)
|
33
|
+
* [`aed46f6`](https://github.com/eslint/eslint/commit/aed46f69d54da167d9838149954ceeb4b02be5fd) Sponsors: Sync README with website (ESLint Jenkins)
|
34
|
+
* [`7686d7f`](https://github.com/eslint/eslint/commit/7686d7feaccc7b8fee927eda6602d641d8de1e5c) Update: semi-spacing should check do-while statements (#13358) (Milos Djermanovic)
|
35
|
+
* [`cbd0d00`](https://github.com/eslint/eslint/commit/cbd0d00a1ec2824d7e025bbbc084855ed0bf08bb) Update: disallow multiple options in comma-dangle schema (fixes #13165) (#13166) (Milos Djermanovic)
|
36
|
+
* [`b550330`](https://github.com/eslint/eslint/commit/b550330d739c73a7a8f887064e7c911d05a95f9a) New: Add no-unreachable-loop rule (fixes #12381) (#12660) (Milos Djermanovic)
|
37
|
+
* [`13999d2`](https://github.com/eslint/eslint/commit/13999d292080f814fa4fb266e011d61c184197c4) Update: curly should check consequent `if` statements (#12947) (Milos Djermanovic)
|
38
|
+
* [`c42e548`](https://github.com/eslint/eslint/commit/c42e54893b79b470ca7745bd2a626ffd069e017b) Chore: enable exceptRange option in the yoda rule (#12857) (Milos Djermanovic)
|
39
|
+
* [`6cfbd03`](https://github.com/eslint/eslint/commit/6cfbd03b3f22edb4d1c9c61c64eea7c129da71aa) Update: Drop @typescript-eslint/eslint-recommended from `eslint --init` (#13340) (Minh Nguyen)
|
40
|
+
* [`796f269`](https://github.com/eslint/eslint/commit/796f269e448fdcbf8a5a62edf1990bd857efd1af) Chore: update eslint-config-eslint's required node version (#13379) (薛定谔的猫)
|
41
|
+
* [`9d0186e`](https://github.com/eslint/eslint/commit/9d0186e55bee769ea6aa08dc5a62682f58316412) Docs: Fix changelog versions (#13410) (Tony Brix)
|
42
|
+
* [`1ee3c42`](https://github.com/eslint/eslint/commit/1ee3c42ceeee56b650bcc4206ed783b795f65643) Docs: On maxEOF with eol-last (fixes #12742) (#13374) (Arthur Dias)
|
43
|
+
* [`2a21049`](https://github.com/eslint/eslint/commit/2a210499288ed14ec9a6fd72decabfb77504c197) Update: key-spacing loc changes for extra space (refs #12334) (#13362) (Anix)
|
44
|
+
* [`7ce7988`](https://github.com/eslint/eslint/commit/7ce7988f411da64248a64a9d9d2b7884d5ba39e0) Chore: Replace the inquirer dependency with enquirer (#13254) (Selwyn)
|
45
|
+
* [`0f1f5ed`](https://github.com/eslint/eslint/commit/0f1f5ed2a20b8fb575d4360316861cf4c2b9b7bc) Docs: Add security policy link to README (#13403) (Nicholas C. Zakas)
|
46
|
+
* [`9e9ba89`](https://github.com/eslint/eslint/commit/9e9ba897c566601cfe90522099c635ea316b235f) Sponsors: Sync README with website (ESLint Jenkins)
|
47
|
+
* [`ca59fb9`](https://github.com/eslint/eslint/commit/ca59fb95a395c0a02ed23768a70e086480ab1f6d) Sponsors: Sync README with website (ESLint Jenkins)
|
48
|
+
v7.2.0 - June 5, 2020
|
49
|
+
|
50
|
+
* [`b735a48`](https://github.com/eslint/eslint/commit/b735a485e77bcc791e4c4c6b8716801d94e98b2c) Update: add enforceForFunctionPrototypeMethods option to no-extra-parens (#12895) (Milos Djermanovic)
|
51
|
+
* [`27ef73f`](https://github.com/eslint/eslint/commit/27ef73ffb7428d5eff792d443186a2313e417bda) Update: reporter locr of func-call-spacing (refs #12334) (#13311) (Anix)
|
52
|
+
* [`353bfe9`](https://github.com/eslint/eslint/commit/353bfe9760ec640f470859855d4018df084a4e88) Update: handle parentheses in multiline-ternary (fixes #13195) (#13367) (Milos Djermanovic)
|
53
|
+
* [`a7fd343`](https://github.com/eslint/eslint/commit/a7fd343991cde99d8a219e3b25616db5792fe9a9) Update: keyword-spacing unexpected space loc improve (refs #12334) (#13377) (Anix)
|
54
|
+
* [`e49732e`](https://github.com/eslint/eslint/commit/e49732eb41bff6347ca7718c3c5ca1d13f1cd2d3) Fix: Ignore import expressions in no-unused-expressions rule (#13387) (Veniamin Krol)
|
55
|
+
* [`220349f`](https://github.com/eslint/eslint/commit/220349f5404060effe02fb5ec176a92e1383c3b5) Chore: Remove duplicate health files (#13380) (Nicholas C. Zakas)
|
56
|
+
* [`dd949ae`](https://github.com/eslint/eslint/commit/dd949aedb81fa772e10568920156daf075d25ea2) Update: support `??` operator, import.meta, and `export * as ns` (#13196) (Toru Nagashima)
|
57
|
+
* [`d5fce9f`](https://github.com/eslint/eslint/commit/d5fce9fa07e37ce61010a1fbb65964f1f7aefd82) Update: enable es2020 environment in --init (#13357) (Milos Djermanovic)
|
58
|
+
* [`21b1583`](https://github.com/eslint/eslint/commit/21b15832e326f96d349c063cd7e85e72c3abb670) Docs: fixed broken hash link for working-with-rules.md (#13386) (Yosuke Ota)
|
59
|
+
* [`b76aef7`](https://github.com/eslint/eslint/commit/b76aef778befb32afe7ad249934b132dc49713d2) Update: Improve report location for template-tag-spacing (refs #12334) (#13203) (Milos Djermanovic)
|
60
|
+
* [`578efad`](https://github.com/eslint/eslint/commit/578efad331b797e28c0f5f1547ce4769d2ea23ee) Chore: update no-unused-vars caughtErrors in eslint-config-eslint (#13351) (Milos Djermanovic)
|
61
|
+
* [`426088c`](https://github.com/eslint/eslint/commit/426088c966dc79dc338b33100f3adf827b147d69) Fix: no-unused-vars updated location to last reference (fixes #13181) (#13354) (Anix)
|
62
|
+
* [`cb50b69`](https://github.com/eslint/eslint/commit/cb50b69c08d4393e32d5c42c537d769c51dd34d8) Update: Improve location for no-mixed-spaces-and-tabs (refs #12334) (#13365) (Milos Djermanovic)
|
63
|
+
* [`f858f2a`](https://github.com/eslint/eslint/commit/f858f2a8f83232484491bd90b0bc5001b5056ad0) Chore: Add Tidelift to funding.yml (#13371) (Nicholas C. Zakas)
|
64
|
+
* [`ee30e5d`](https://github.com/eslint/eslint/commit/ee30e5d8bb1a4c82a2a3fbe1b9ee9f979b55c5c4) Sponsors: Sync README with website (ESLint Jenkins)
|
65
|
+
* [`c29bd9f`](https://github.com/eslint/eslint/commit/c29bd9f75582e5b1a403a8ffd0aafd1ffc8c58e1) Chore: Add breaking/core change link to issue templates (#13344) (Kai Cataldo)
|
66
|
+
* [`d55490f`](https://github.com/eslint/eslint/commit/d55490fa73ff69416de375e4c1cd67b6edba531c) Sponsors: Sync README with website (ESLint Jenkins)
|
67
|
+
|
1
68
|
v7.1.0 - May 22, 2020
|
2
69
|
|
3
70
|
* [`a93083a`](https://github.com/eslint/eslint/commit/a93083af89c6f9714dcdd4a7f27c8655a0b0dba6) Fix: astUtils.getNextLocation returns invalid location after CRLF (#13275) (Milos Djermanovic)
|
@@ -27,6 +94,7 @@ v7.1.0 - May 22, 2020
|
|
27
94
|
* [`f44a6b4`](https://github.com/eslint/eslint/commit/f44a6b4fd92602af8e2c75d5852f796ec064aa8e) Chore: fix invalid syntax in require-await tests (#13277) (Milos Djermanovic)
|
28
95
|
* [`2c778fb`](https://github.com/eslint/eslint/commit/2c778fb6e31b7943bb27a47a6e15dcbfd8336f39) Fix: remove custom plugins from replacedBy metadata (#13274) (Kai Cataldo)
|
29
96
|
* [`0db3b1d`](https://github.com/eslint/eslint/commit/0db3b1d5cc5e4e1de21462679581b7a4d89ff36e) Sponsors: Sync README with website (ESLint Jenkins)
|
97
|
+
|
30
98
|
v7.0.0 - May 8, 2020
|
31
99
|
|
32
100
|
* [`b98d8bd`](https://github.com/eslint/eslint/commit/b98d8bda4630fe8278c5aa2b6650630770568fe5) Upgrade: eslint-release@2.0.0 (#13271) (Kai Cataldo)
|
@@ -237,6 +305,7 @@ v7.0.0 - May 8, 2020
|
|
237
305
|
* [`39f5a45`](https://github.com/eslint/eslint/commit/39f5a453579b2ad732212edeb71f84ecb0991f97) Chore: add test cases for for-direction (#12698) (YeonJuan)
|
238
306
|
* [`b340304`](https://github.com/eslint/eslint/commit/b3403045e535921df6d34785a4ce053e14ba27fd) Chore: Add extra test, improve docs (#12492) (Kevin Partington)
|
239
307
|
* [`827259e`](https://github.com/eslint/eslint/commit/827259ea009f98a0fdf3f7ebf1bfb6cd661ce28d) Build: package.json update for eslint-config-eslint release (ESLint Jenkins)
|
308
|
+
|
240
309
|
v7.0.0-rc.0 - April 24, 2020
|
241
310
|
|
242
311
|
* [`0b1d65a`](https://github.com/eslint/eslint/commit/0b1d65a45aa5dfe08cd596c420490e81b546317e) Update: Improve report location for array-callback-return (refs #12334) (#13109) (Milos Djermanovic)
|
package/README.md
CHANGED
@@ -33,11 +33,12 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J
|
|
33
33
|
4. [Filing Issues](#filing-issues)
|
34
34
|
5. [Frequently Asked Questions](#faq)
|
35
35
|
6. [Releases](#releases)
|
36
|
-
7. [
|
37
|
-
8. [
|
38
|
-
9. [
|
39
|
-
10. [
|
40
|
-
11. [
|
36
|
+
7. [Security Policy](#security-policy)
|
37
|
+
8. [Semantic Versioning Policy](#semantic-versioning-policy)
|
38
|
+
9. [License](#license)
|
39
|
+
10. [Team](#team)
|
40
|
+
11. [Sponsors](#sponsors)
|
41
|
+
12. [Technology Sponsors](#technology-sponsors)
|
41
42
|
|
42
43
|
## <a name="installation-and-usage"></a>Installation and Usage
|
43
44
|
|
@@ -139,6 +140,10 @@ Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](ht
|
|
139
140
|
|
140
141
|
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.
|
141
142
|
|
143
|
+
## <a name="security-policy"></a>Security Policy
|
144
|
+
|
145
|
+
ESLint takes security seriously. We work hard to ensure that ESLint is safe for everyone and that security issues are addressed quickly and responsibly. Read the full [security policy](https://github.com/eslint/.github/blob/master/SECURITY.md).
|
146
|
+
|
142
147
|
## <a name="semantic-versioning-policy"></a>Semantic Versioning Policy
|
143
148
|
|
144
149
|
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:
|
@@ -250,8 +255,8 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
250
255
|
<!--sponsorsstart-->
|
251
256
|
<h3>Gold Sponsors</h3>
|
252
257
|
<p><a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/e780cd4/logo.png" alt="Shopify" height="96"></a> <a href="https://www.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a></p><h3>Silver Sponsors</h3>
|
253
|
-
<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>
|
254
|
-
<p><a href="https://
|
258
|
+
<p><a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <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>
|
259
|
+
<p><a href="https://mytruemedia.com/"><img src="https://images.opencollective.com/my-true-media/03e2168/logo.png" alt="My True Media" height="32"></a> <a href="https://www.norgekasino.com"><img src="https://images.opencollective.com/norgekasino/ecfd57a/logo.png" alt="Norgekasino" height="32"></a> <a href="https://www.japanesecasino.com/"><img src="https://images.opencollective.com/japanesecasino/b0ffe3c/logo.png" alt="Japanesecasino" height="32"></a> <a href="https://bruce.agency"><img src="https://images.opencollective.com/brucemade/0c70c59/logo.png" alt="Bruce" height="32"></a> <a href="https://edubirdie.com/"><img src="https://images.opencollective.com/edubirdie2/b1d51ab/logo.png" alt="EduBirdie" height="32"></a> <a href="https://www.casinotop.com/"><img src="https://images.opencollective.com/casinotop-com/10fd95b/logo.png" alt="CasinoTop.com" height="32"></a> <a href="https://www.casinotopp.net/"><img src="https://images.opencollective.com/casino-topp/1dd399a/logo.png" alt="Casino Topp" height="32"></a> <a href="https://writersperhour.com/write-my-essay"><img src="https://images.opencollective.com/writersperhour/5787d4b/logo.png" alt="Writers Per Hour" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://www.kasinot.fi"><img src="https://images.opencollective.com/kasinot-fi/e09aa2e/logo.png" alt="Kasinot.fi" height="32"></a> <a href="https://www.pelisivut.com"><img src="https://images.opencollective.com/pelisivut/04f08f2/logo.png" alt="Pelisivut" height="32"></a> <a href="https://www.nettikasinot.org"><img src="https://images.opencollective.com/nettikasinot-org/53a4b44/logo.png" alt="Nettikasinot.org" height="32"></a> <a href="https://www.bonus.com.de/freispiele"><img src="https://images.opencollective.com/bonusfinder-deutschland/646169e/logo.png" alt="BonusFinder Deutschland" 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://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/6e889f6/logo.png" alt="Icons8: free icons, photos, illustrations, and music" 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/d5592fe/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></p>
|
255
260
|
<!--sponsorsend-->
|
256
261
|
|
257
262
|
## <a name="technology-sponsors"></a>Technology Sponsors
|
@@ -403,7 +403,7 @@ function getCacheFile(cacheFile, cwd) {
|
|
403
403
|
|
404
404
|
try {
|
405
405
|
fileStats = fs.lstatSync(resolvedCacheFile);
|
406
|
-
} catch
|
406
|
+
} catch {
|
407
407
|
fileStats = null;
|
408
408
|
}
|
409
409
|
|
@@ -991,7 +991,7 @@ class CLIEngine {
|
|
991
991
|
const npmFormat = naming.normalizePackageName(normalizedFormatName, "eslint-formatter");
|
992
992
|
|
993
993
|
formatterPath = ModuleResolver.resolve(npmFormat, path.join(cwd, "__placeholder__.js"));
|
994
|
-
} catch
|
994
|
+
} catch {
|
995
995
|
formatterPath = path.resolve(__dirname, "formatters", normalizedFormatName);
|
996
996
|
}
|
997
997
|
}
|
@@ -12,7 +12,7 @@
|
|
12
12
|
|
13
13
|
const util = require("util"),
|
14
14
|
path = require("path"),
|
15
|
-
|
15
|
+
enquirer = require("enquirer"),
|
16
16
|
ProgressBar = require("progress"),
|
17
17
|
semver = require("semver"),
|
18
18
|
espree = require("espree"),
|
@@ -146,7 +146,7 @@ function getModulesList(config, installESLint) {
|
|
146
146
|
*
|
147
147
|
* Note: This clones the config object and returns a new config to avoid mutating
|
148
148
|
* the original config parameter.
|
149
|
-
* @param {Object} answers answers received from
|
149
|
+
* @param {Object} answers answers received from enquirer
|
150
150
|
* @param {Object} config config object
|
151
151
|
* @returns {Object} config object with configured rules
|
152
152
|
*/
|
@@ -253,7 +253,7 @@ function configureRules(answers, config) {
|
|
253
253
|
|
254
254
|
/**
|
255
255
|
* process user's answers and create config object
|
256
|
-
* @param {Object} answers answers received from
|
256
|
+
* @param {Object} answers answers received from enquirer
|
257
257
|
* @returns {Object} config object
|
258
258
|
*/
|
259
259
|
function processAnswers(answers) {
|
@@ -265,11 +265,7 @@ function processAnswers(answers) {
|
|
265
265
|
};
|
266
266
|
|
267
267
|
config.parserOptions.ecmaVersion = espree.latestEcmaVersion;
|
268
|
-
config.env.
|
269
|
-
config.globals = {
|
270
|
-
Atomics: "readonly",
|
271
|
-
SharedArrayBuffer: "readonly"
|
272
|
-
};
|
268
|
+
config.env.es2020 = true;
|
273
269
|
|
274
270
|
// set the module type
|
275
271
|
if (answers.moduleType === "esm") {
|
@@ -325,7 +321,6 @@ function processAnswers(answers) {
|
|
325
321
|
}
|
326
322
|
}
|
327
323
|
if (answers.typescript && config.extends.includes("eslint:recommended")) {
|
328
|
-
config.extends.push("plugin:@typescript-eslint/eslint-recommended");
|
329
324
|
config.extends.push("plugin:@typescript-eslint/recommended");
|
330
325
|
}
|
331
326
|
|
@@ -350,7 +345,7 @@ function getLocalESLintVersion() {
|
|
350
345
|
const eslint = require(eslintPath);
|
351
346
|
|
352
347
|
return eslint.linter.version || null;
|
353
|
-
} catch
|
348
|
+
} catch {
|
354
349
|
return null;
|
355
350
|
}
|
356
351
|
}
|
@@ -413,7 +408,7 @@ function installModules(modules) {
|
|
413
408
|
npmUtils.installSyncSaveDev(modules);
|
414
409
|
}
|
415
410
|
|
416
|
-
/* istanbul ignore next: no need to test
|
411
|
+
/* istanbul ignore next: no need to test enquirer */
|
417
412
|
/**
|
418
413
|
* Ask user to install modules.
|
419
414
|
* @param {string[]} modules Array of modules to be installed.
|
@@ -429,14 +424,19 @@ function askInstallModules(modules, packageJsonExists) {
|
|
429
424
|
|
430
425
|
log.info("The config that you've selected requires the following dependencies:\n");
|
431
426
|
log.info(modules.join(" "));
|
432
|
-
return
|
427
|
+
return enquirer.prompt([
|
433
428
|
{
|
434
|
-
type: "
|
429
|
+
type: "toggle",
|
435
430
|
name: "executeInstallation",
|
436
431
|
message: "Would you like to install them now with npm?",
|
437
|
-
|
438
|
-
|
439
|
-
|
432
|
+
enabled: "Yes",
|
433
|
+
disabled: "No",
|
434
|
+
initial: 1,
|
435
|
+
skip() {
|
436
|
+
return !(modules.length && packageJsonExists);
|
437
|
+
},
|
438
|
+
result(input) {
|
439
|
+
return this.skipped ? null : input;
|
440
440
|
}
|
441
441
|
}
|
442
442
|
]).then(({ executeInstallation }) => {
|
@@ -446,114 +446,124 @@ function askInstallModules(modules, packageJsonExists) {
|
|
446
446
|
});
|
447
447
|
}
|
448
448
|
|
449
|
-
/* istanbul ignore next: no need to test
|
449
|
+
/* istanbul ignore next: no need to test enquirer */
|
450
450
|
/**
|
451
451
|
* Ask use a few questions on command prompt
|
452
452
|
* @returns {Promise} The promise with the result of the prompt
|
453
453
|
*/
|
454
454
|
function promptUser() {
|
455
455
|
|
456
|
-
return
|
456
|
+
return enquirer.prompt([
|
457
457
|
{
|
458
|
-
type: "
|
458
|
+
type: "select",
|
459
459
|
name: "purpose",
|
460
460
|
message: "How would you like to use ESLint?",
|
461
|
-
|
461
|
+
|
462
|
+
// The returned number matches the name value of nth in the choices array.
|
463
|
+
initial: 1,
|
462
464
|
choices: [
|
463
|
-
{
|
464
|
-
{
|
465
|
-
{
|
465
|
+
{ message: "To check syntax only", name: "syntax" },
|
466
|
+
{ message: "To check syntax and find problems", name: "problems" },
|
467
|
+
{ message: "To check syntax, find problems, and enforce code style", name: "style" }
|
466
468
|
]
|
467
469
|
},
|
468
470
|
{
|
469
|
-
type: "
|
471
|
+
type: "select",
|
470
472
|
name: "moduleType",
|
471
473
|
message: "What type of modules does your project use?",
|
472
|
-
|
474
|
+
initial: 0,
|
473
475
|
choices: [
|
474
|
-
{
|
475
|
-
{
|
476
|
-
{
|
476
|
+
{ message: "JavaScript modules (import/export)", name: "esm" },
|
477
|
+
{ message: "CommonJS (require/exports)", name: "commonjs" },
|
478
|
+
{ message: "None of these", name: "none" }
|
477
479
|
]
|
478
480
|
},
|
479
481
|
{
|
480
|
-
type: "
|
482
|
+
type: "select",
|
481
483
|
name: "framework",
|
482
484
|
message: "Which framework does your project use?",
|
483
|
-
|
485
|
+
initial: 0,
|
484
486
|
choices: [
|
485
|
-
{
|
486
|
-
{
|
487
|
-
{
|
487
|
+
{ message: "React", name: "react" },
|
488
|
+
{ message: "Vue.js", name: "vue" },
|
489
|
+
{ message: "None of these", name: "none" }
|
488
490
|
]
|
489
491
|
},
|
490
492
|
{
|
491
|
-
type: "
|
493
|
+
type: "toggle",
|
492
494
|
name: "typescript",
|
493
495
|
message: "Does your project use TypeScript?",
|
494
|
-
|
496
|
+
enabled: "Yes",
|
497
|
+
disabled: "No",
|
498
|
+
initial: 0
|
495
499
|
},
|
496
500
|
{
|
497
|
-
type: "
|
501
|
+
type: "multiselect",
|
498
502
|
name: "env",
|
499
503
|
message: "Where does your code run?",
|
500
|
-
|
504
|
+
hint: "(Press <space> to select, <a> to toggle all, <i> to invert selection)",
|
505
|
+
initial: 0,
|
501
506
|
choices: [
|
502
|
-
{
|
503
|
-
{
|
507
|
+
{ message: "Browser", name: "browser" },
|
508
|
+
{ message: "Node", name: "node" }
|
504
509
|
]
|
505
510
|
},
|
506
511
|
{
|
507
|
-
type: "
|
512
|
+
type: "select",
|
508
513
|
name: "source",
|
509
514
|
message: "How would you like to define a style for your project?",
|
510
|
-
default: "guide",
|
511
515
|
choices: [
|
512
|
-
{
|
513
|
-
{
|
514
|
-
{
|
516
|
+
{ message: "Use a popular style guide", name: "guide" },
|
517
|
+
{ message: "Answer questions about your style", name: "prompt" },
|
518
|
+
{ message: "Inspect your JavaScript file(s)", name: "auto" }
|
515
519
|
],
|
516
|
-
|
517
|
-
return answers.purpose
|
520
|
+
skip() {
|
521
|
+
return this.state.answers.purpose !== "style";
|
522
|
+
},
|
523
|
+
result(input) {
|
524
|
+
return this.skipped ? null : input;
|
518
525
|
}
|
519
526
|
},
|
520
527
|
{
|
521
|
-
type: "
|
528
|
+
type: "select",
|
522
529
|
name: "styleguide",
|
523
530
|
message: "Which style guide do you want to follow?",
|
524
531
|
choices: [
|
525
|
-
{
|
526
|
-
{
|
527
|
-
{
|
532
|
+
{ message: "Airbnb: https://github.com/airbnb/javascript", name: "airbnb" },
|
533
|
+
{ message: "Standard: https://github.com/standard/standard", name: "standard" },
|
534
|
+
{ message: "Google: https://github.com/google/eslint-config-google", name: "google" }
|
528
535
|
],
|
529
|
-
|
530
|
-
answers.packageJsonExists = npmUtils.checkPackageJson();
|
531
|
-
return answers.source === "guide" && answers.packageJsonExists;
|
536
|
+
skip() {
|
537
|
+
this.state.answers.packageJsonExists = npmUtils.checkPackageJson();
|
538
|
+
return !(this.state.answers.source === "guide" && this.state.answers.packageJsonExists);
|
539
|
+
},
|
540
|
+
result(input) {
|
541
|
+
return this.skipped ? null : input;
|
532
542
|
}
|
533
543
|
},
|
534
544
|
{
|
535
545
|
type: "input",
|
536
546
|
name: "patterns",
|
537
547
|
message: "Which file(s), path(s), or glob(s) should be examined?",
|
538
|
-
|
539
|
-
return
|
548
|
+
skip() {
|
549
|
+
return this.state.answers.source !== "auto";
|
540
550
|
},
|
541
551
|
validate(input) {
|
542
|
-
if (input.trim().length === 0 && input.trim() !== ",") {
|
552
|
+
if (!this.skipped && input.trim().length === 0 && input.trim() !== ",") {
|
543
553
|
return "You must tell us what code to examine. Try again.";
|
544
554
|
}
|
545
555
|
return true;
|
546
556
|
}
|
547
557
|
},
|
548
558
|
{
|
549
|
-
type: "
|
559
|
+
type: "select",
|
550
560
|
name: "format",
|
551
561
|
message: "What format do you want your config file to be in?",
|
552
|
-
|
562
|
+
initial: 0,
|
553
563
|
choices: ["JavaScript", "YAML", "JSON"]
|
554
564
|
},
|
555
565
|
{
|
556
|
-
type: "
|
566
|
+
type: "toggle",
|
557
567
|
name: "installESLint",
|
558
568
|
message(answers) {
|
559
569
|
const verb = semver.ltr(answers.localESLintVersion, answers.requiredESLintVersionRange)
|
@@ -562,9 +572,14 @@ function promptUser() {
|
|
562
572
|
|
563
573
|
return `The style guide "${answers.styleguide}" requires eslint@${answers.requiredESLintVersionRange}. You are currently using eslint@${answers.localESLintVersion}.\n Do you want to ${verb}?`;
|
564
574
|
},
|
565
|
-
|
566
|
-
|
567
|
-
|
575
|
+
enabled: "Yes",
|
576
|
+
disabled: "No",
|
577
|
+
initial: 1,
|
578
|
+
skip() {
|
579
|
+
return !(this.state.answers.source === "guide" && this.state.answers.packageJsonExists && hasESLintVersionConflict(this.state.answers));
|
580
|
+
},
|
581
|
+
result(input) {
|
582
|
+
return this.skipped ? null : input;
|
568
583
|
}
|
569
584
|
}
|
570
585
|
]).then(earlyAnswers => {
|
@@ -617,33 +632,35 @@ function promptUser() {
|
|
617
632
|
}
|
618
633
|
|
619
634
|
// continue with the style questions otherwise...
|
620
|
-
return
|
635
|
+
return enquirer.prompt([
|
621
636
|
{
|
622
|
-
type: "
|
637
|
+
type: "select",
|
623
638
|
name: "indent",
|
624
639
|
message: "What style of indentation do you use?",
|
625
|
-
|
626
|
-
choices: [{
|
640
|
+
initial: 0,
|
641
|
+
choices: [{ message: "Tabs", name: "tab" }, { message: "Spaces", name: 4 }]
|
627
642
|
},
|
628
643
|
{
|
629
|
-
type: "
|
644
|
+
type: "select",
|
630
645
|
name: "quotes",
|
631
646
|
message: "What quotes do you use for strings?",
|
632
|
-
|
633
|
-
choices: [{
|
647
|
+
initial: 0,
|
648
|
+
choices: [{ message: "Double", name: "double" }, { message: "Single", name: "single" }]
|
634
649
|
},
|
635
650
|
{
|
636
|
-
type: "
|
651
|
+
type: "select",
|
637
652
|
name: "linebreak",
|
638
653
|
message: "What line endings do you use?",
|
639
|
-
|
640
|
-
choices: [{
|
654
|
+
initial: 0,
|
655
|
+
choices: [{ message: "Unix", name: "unix" }, { message: "Windows", name: "windows" }]
|
641
656
|
},
|
642
657
|
{
|
643
|
-
type: "
|
658
|
+
type: "toggle",
|
644
659
|
name: "semi",
|
645
660
|
message: "Do you require semicolons?",
|
646
|
-
|
661
|
+
enabled: "Yes",
|
662
|
+
disabled: "No",
|
663
|
+
initial: 1
|
647
664
|
}
|
648
665
|
]).then(answers => {
|
649
666
|
const totalAnswers = Object.assign({}, earlyAnswers, answers);
|
@@ -33,10 +33,10 @@ function isCaseNode(node) {
|
|
33
33
|
* Checks whether the given logical operator is taken into account for the code
|
34
34
|
* path analysis.
|
35
35
|
* @param {string} operator The operator found in the LogicalExpression node
|
36
|
-
* @returns {boolean} `true` if the operator is "&&" or "||"
|
36
|
+
* @returns {boolean} `true` if the operator is "&&" or "||" or "??"
|
37
37
|
*/
|
38
38
|
function isHandledLogicalOperator(operator) {
|
39
|
-
return operator === "&&" || operator === "||";
|
39
|
+
return operator === "&&" || operator === "||" || operator === "??";
|
40
40
|
}
|
41
41
|
|
42
42
|
/**
|
@@ -201,6 +201,7 @@ function finalizeTestSegmentsOfFor(context, choiceContext, head) {
|
|
201
201
|
if (!choiceContext.processed) {
|
202
202
|
choiceContext.trueForkContext.add(head);
|
203
203
|
choiceContext.falseForkContext.add(head);
|
204
|
+
choiceContext.qqForkContext.add(head);
|
204
205
|
}
|
205
206
|
|
206
207
|
if (context.test !== true) {
|
@@ -351,6 +352,7 @@ class CodePathState {
|
|
351
352
|
isForkingAsResult,
|
352
353
|
trueForkContext: ForkContext.newEmpty(this.forkContext),
|
353
354
|
falseForkContext: ForkContext.newEmpty(this.forkContext),
|
355
|
+
qqForkContext: ForkContext.newEmpty(this.forkContext),
|
354
356
|
processed: false
|
355
357
|
};
|
356
358
|
}
|
@@ -370,6 +372,7 @@ class CodePathState {
|
|
370
372
|
switch (context.kind) {
|
371
373
|
case "&&":
|
372
374
|
case "||":
|
375
|
+
case "??":
|
373
376
|
|
374
377
|
/*
|
375
378
|
* If any result were not transferred from child contexts,
|
@@ -379,6 +382,7 @@ class CodePathState {
|
|
379
382
|
if (!context.processed) {
|
380
383
|
context.trueForkContext.add(headSegments);
|
381
384
|
context.falseForkContext.add(headSegments);
|
385
|
+
context.qqForkContext.add(headSegments);
|
382
386
|
}
|
383
387
|
|
384
388
|
/*
|
@@ -390,6 +394,7 @@ class CodePathState {
|
|
390
394
|
|
391
395
|
parentContext.trueForkContext.addAll(context.trueForkContext);
|
392
396
|
parentContext.falseForkContext.addAll(context.falseForkContext);
|
397
|
+
parentContext.qqForkContext.addAll(context.qqForkContext);
|
393
398
|
parentContext.processed = true;
|
394
399
|
|
395
400
|
return context;
|
@@ -456,13 +461,24 @@ class CodePathState {
|
|
456
461
|
* This got segments already from the child choice context.
|
457
462
|
* Creates the next path from own true/false fork context.
|
458
463
|
*/
|
459
|
-
|
460
|
-
|
461
|
-
|
464
|
+
let prevForkContext;
|
465
|
+
|
466
|
+
switch (context.kind) {
|
467
|
+
case "&&": // if true then go to the right-hand side.
|
468
|
+
prevForkContext = context.trueForkContext;
|
469
|
+
break;
|
470
|
+
case "||": // if false then go to the right-hand side.
|
471
|
+
prevForkContext = context.falseForkContext;
|
472
|
+
break;
|
473
|
+
case "??": // Both true/false can short-circuit, so needs the third path to go to the right-hand side. That's qqForkContext.
|
474
|
+
prevForkContext = context.qqForkContext;
|
475
|
+
break;
|
476
|
+
default:
|
477
|
+
throw new Error("unreachable");
|
478
|
+
}
|
462
479
|
|
463
480
|
forkContext.replaceHead(prevForkContext.makeNext(0, -1));
|
464
481
|
prevForkContext.clear();
|
465
|
-
|
466
482
|
context.processed = false;
|
467
483
|
} else {
|
468
484
|
|
@@ -471,14 +487,19 @@ class CodePathState {
|
|
471
487
|
* So addresses the head segments.
|
472
488
|
* The head segments are the path of the left-hand operand.
|
473
489
|
*/
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
490
|
+
switch (context.kind) {
|
491
|
+
case "&&": // the false path can short-circuit.
|
492
|
+
context.falseForkContext.add(forkContext.head);
|
493
|
+
break;
|
494
|
+
case "||": // the true path can short-circuit.
|
495
|
+
context.trueForkContext.add(forkContext.head);
|
496
|
+
break;
|
497
|
+
case "??": // both can short-circuit.
|
498
|
+
context.trueForkContext.add(forkContext.head);
|
499
|
+
context.falseForkContext.add(forkContext.head);
|
500
|
+
break;
|
501
|
+
default:
|
502
|
+
throw new Error("unreachable");
|
482
503
|
}
|
483
504
|
|
484
505
|
forkContext.replaceHead(forkContext.makeNext(-1, -1));
|
@@ -501,6 +522,7 @@ class CodePathState {
|
|
501
522
|
if (!context.processed) {
|
502
523
|
context.trueForkContext.add(forkContext.head);
|
503
524
|
context.falseForkContext.add(forkContext.head);
|
525
|
+
context.qqForkContext.add(forkContext.head);
|
504
526
|
}
|
505
527
|
|
506
528
|
context.processed = false;
|