eslint 7.0.0 → 7.3.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 +78 -0
- package/README.md +14 -10
- package/lib/cli-engine/cli-engine.js +2 -2
- package/lib/cli-engine/config-array-factory.js +34 -2
- package/lib/init/config-initializer.js +92 -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/linter/linter.js +2 -1
- package/lib/rule-tester/rule-tester.js +9 -0
- package/lib/rules/accessor-pairs.js +1 -1
- package/lib/rules/arrow-parens.js +19 -3
- package/lib/rules/block-spacing.js +19 -2
- package/lib/rules/callback-return.js +1 -1
- 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/global-require.js +1 -1
- package/lib/rules/handle-callback-err.js +1 -1
- package/lib/rules/id-match.js +2 -1
- package/lib/rules/index.js +3 -0
- package/lib/rules/key-spacing.js +6 -2
- package/lib/rules/keyword-spacing.js +9 -2
- package/lib/rules/linebreak-style.js +8 -2
- package/lib/rules/max-lines-per-function.js +1 -1
- package/lib/rules/max-lines.js +34 -8
- package/lib/rules/multiline-ternary.js +44 -25
- package/lib/rules/no-buffer-constructor.js +1 -1
- 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 +30 -2
- package/lib/rules/no-invalid-regexp.js +1 -1
- package/lib/rules/no-loss-of-precision.js +198 -0
- package/lib/rules/no-misleading-character-class.js +1 -1
- package/lib/rules/no-mixed-operators.js +3 -2
- package/lib/rules/no-mixed-requires.js +1 -1
- package/lib/rules/no-mixed-spaces-and-tabs.js +14 -6
- package/lib/rules/no-new-func.js +22 -19
- package/lib/rules/no-new-require.js +1 -1
- package/lib/rules/no-new-symbol.js +2 -1
- package/lib/rules/no-path-concat.js +1 -1
- package/lib/rules/no-process-env.js +1 -1
- package/lib/rules/no-process-exit.js +1 -1
- 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-restricted-modules.js +1 -1
- package/lib/rules/no-sync.js +1 -1
- 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/one-var-declaration-per-line.js +1 -1
- package/lib/rules/operator-linebreak.js +2 -5
- package/lib/rules/padded-blocks.js +19 -5
- package/lib/rules/prefer-named-capture-group.js +1 -1
- package/lib/rules/quote-props.js +2 -2
- package/lib/rules/rest-spread-spacing.js +3 -6
- package/lib/rules/semi-spacing.js +33 -8
- package/lib/rules/template-tag-spacing.js +8 -2
- package/lib/rules/utils/ast-utils.js +106 -9
- package/lib/source-code/source-code.js +1 -0
- package/messages/extend-config-missing.txt +1 -1
- package/messages/no-config-found.txt +1 -1
- package/messages/plugin-conflict.txt +1 -1
- package/messages/plugin-missing.txt +1 -1
- package/messages/whitespace-found.txt +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,80 @@
|
|
1
|
+
v7.3.1 - June 22, 2020
|
2
|
+
|
3
|
+
* [`de77c11`](https://github.com/eslint/eslint/commit/de77c11e7515f2097ff355ddc0d7b6db9c83c892) Fix: Replace Infinity with Number.MAX_SAFE_INTEGER (fixes #13427) (#13435) (Nicholas C. Zakas)
|
4
|
+
v7.3.0 - June 19, 2020
|
5
|
+
|
6
|
+
* [`638a6d6`](https://github.com/eslint/eslint/commit/638a6d6be18b4a37cfdc7223e1f5acd3718694be) Update: add missing `additionalProperties: false` to some rules' schema (#13198) (Milos Djermanovic)
|
7
|
+
* [`949a5cd`](https://github.com/eslint/eslint/commit/949a5cd741c2e930cfb43d80a9b6b084f9d677c3) Update: fix operator-linebreak overrides schema (#13199) (Milos Djermanovic)
|
8
|
+
* [`9e1414e`](https://github.com/eslint/eslint/commit/9e1414ee16b8caf582920f8fdf3b6ee1eb0b7cd5) New: Add no-promise-executor-return rule (fixes #12640) (#12648) (Milos Djermanovic)
|
9
|
+
* [`09cc0a2`](https://github.com/eslint/eslint/commit/09cc0a2bb5bcf3bcb0766a3c989871f268518437) Update: max-lines reporting loc improvement (refs #12334) (#13318) (Anix)
|
10
|
+
* [`ee2fc2e`](https://github.com/eslint/eslint/commit/ee2fc2e90d0f9dfcdba852b0609156bee5280b92) Update: object-property-newline end location (refs #12334) (#13399) (Anix)
|
11
|
+
* [`d98152a`](https://github.com/eslint/eslint/commit/d98152a3d8c72e4f5ac4c6fa10a615b12090c8f7) Update: added empty error array check for false negative (#13200) (Anix)
|
12
|
+
* [`7fb45cf`](https://github.com/eslint/eslint/commit/7fb45cf13e9908d489bd6d5fba3b7243c01508b9) Fix: clone config before validating (fixes #12592) (#13034) (Anix)
|
13
|
+
* [`aed46f6`](https://github.com/eslint/eslint/commit/aed46f69d54da167d9838149954ceeb4b02be5fd) Sponsors: Sync README with website (ESLint Jenkins)
|
14
|
+
* [`7686d7f`](https://github.com/eslint/eslint/commit/7686d7feaccc7b8fee927eda6602d641d8de1e5c) Update: semi-spacing should check do-while statements (#13358) (Milos Djermanovic)
|
15
|
+
* [`cbd0d00`](https://github.com/eslint/eslint/commit/cbd0d00a1ec2824d7e025bbbc084855ed0bf08bb) Update: disallow multiple options in comma-dangle schema (fixes #13165) (#13166) (Milos Djermanovic)
|
16
|
+
* [`b550330`](https://github.com/eslint/eslint/commit/b550330d739c73a7a8f887064e7c911d05a95f9a) New: Add no-unreachable-loop rule (fixes #12381) (#12660) (Milos Djermanovic)
|
17
|
+
* [`13999d2`](https://github.com/eslint/eslint/commit/13999d292080f814fa4fb266e011d61c184197c4) Update: curly should check consequent `if` statements (#12947) (Milos Djermanovic)
|
18
|
+
* [`c42e548`](https://github.com/eslint/eslint/commit/c42e54893b79b470ca7745bd2a626ffd069e017b) Chore: enable exceptRange option in the yoda rule (#12857) (Milos Djermanovic)
|
19
|
+
* [`6cfbd03`](https://github.com/eslint/eslint/commit/6cfbd03b3f22edb4d1c9c61c64eea7c129da71aa) Update: Drop @typescript-eslint/eslint-recommended from `eslint --init` (#13340) (Minh Nguyen)
|
20
|
+
* [`796f269`](https://github.com/eslint/eslint/commit/796f269e448fdcbf8a5a62edf1990bd857efd1af) Chore: update eslint-config-eslint's required node version (#13379) (薛定谔的猫)
|
21
|
+
* [`9d0186e`](https://github.com/eslint/eslint/commit/9d0186e55bee769ea6aa08dc5a62682f58316412) Docs: Fix changelog versions (#13410) (Tony Brix)
|
22
|
+
* [`1ee3c42`](https://github.com/eslint/eslint/commit/1ee3c42ceeee56b650bcc4206ed783b795f65643) Docs: On maxEOF with eol-last (fixes #12742) (#13374) (Arthur Dias)
|
23
|
+
* [`2a21049`](https://github.com/eslint/eslint/commit/2a210499288ed14ec9a6fd72decabfb77504c197) Update: key-spacing loc changes for extra space (refs #12334) (#13362) (Anix)
|
24
|
+
* [`7ce7988`](https://github.com/eslint/eslint/commit/7ce7988f411da64248a64a9d9d2b7884d5ba39e0) Chore: Replace the inquirer dependency with enquirer (#13254) (Selwyn)
|
25
|
+
* [`0f1f5ed`](https://github.com/eslint/eslint/commit/0f1f5ed2a20b8fb575d4360316861cf4c2b9b7bc) Docs: Add security policy link to README (#13403) (Nicholas C. Zakas)
|
26
|
+
* [`9e9ba89`](https://github.com/eslint/eslint/commit/9e9ba897c566601cfe90522099c635ea316b235f) Sponsors: Sync README with website (ESLint Jenkins)
|
27
|
+
* [`ca59fb9`](https://github.com/eslint/eslint/commit/ca59fb95a395c0a02ed23768a70e086480ab1f6d) Sponsors: Sync README with website (ESLint Jenkins)
|
28
|
+
v7.2.0 - June 5, 2020
|
29
|
+
|
30
|
+
* [`b735a48`](https://github.com/eslint/eslint/commit/b735a485e77bcc791e4c4c6b8716801d94e98b2c) Update: add enforceForFunctionPrototypeMethods option to no-extra-parens (#12895) (Milos Djermanovic)
|
31
|
+
* [`27ef73f`](https://github.com/eslint/eslint/commit/27ef73ffb7428d5eff792d443186a2313e417bda) Update: reporter locr of func-call-spacing (refs #12334) (#13311) (Anix)
|
32
|
+
* [`353bfe9`](https://github.com/eslint/eslint/commit/353bfe9760ec640f470859855d4018df084a4e88) Update: handle parentheses in multiline-ternary (fixes #13195) (#13367) (Milos Djermanovic)
|
33
|
+
* [`a7fd343`](https://github.com/eslint/eslint/commit/a7fd343991cde99d8a219e3b25616db5792fe9a9) Update: keyword-spacing unexpected space loc improve (refs #12334) (#13377) (Anix)
|
34
|
+
* [`e49732e`](https://github.com/eslint/eslint/commit/e49732eb41bff6347ca7718c3c5ca1d13f1cd2d3) Fix: Ignore import expressions in no-unused-expressions rule (#13387) (Veniamin Krol)
|
35
|
+
* [`220349f`](https://github.com/eslint/eslint/commit/220349f5404060effe02fb5ec176a92e1383c3b5) Chore: Remove duplicate health files (#13380) (Nicholas C. Zakas)
|
36
|
+
* [`dd949ae`](https://github.com/eslint/eslint/commit/dd949aedb81fa772e10568920156daf075d25ea2) Update: support `??` operator, import.meta, and `export * as ns` (#13196) (Toru Nagashima)
|
37
|
+
* [`d5fce9f`](https://github.com/eslint/eslint/commit/d5fce9fa07e37ce61010a1fbb65964f1f7aefd82) Update: enable es2020 environment in --init (#13357) (Milos Djermanovic)
|
38
|
+
* [`21b1583`](https://github.com/eslint/eslint/commit/21b15832e326f96d349c063cd7e85e72c3abb670) Docs: fixed broken hash link for working-with-rules.md (#13386) (Yosuke Ota)
|
39
|
+
* [`b76aef7`](https://github.com/eslint/eslint/commit/b76aef778befb32afe7ad249934b132dc49713d2) Update: Improve report location for template-tag-spacing (refs #12334) (#13203) (Milos Djermanovic)
|
40
|
+
* [`578efad`](https://github.com/eslint/eslint/commit/578efad331b797e28c0f5f1547ce4769d2ea23ee) Chore: update no-unused-vars caughtErrors in eslint-config-eslint (#13351) (Milos Djermanovic)
|
41
|
+
* [`426088c`](https://github.com/eslint/eslint/commit/426088c966dc79dc338b33100f3adf827b147d69) Fix: no-unused-vars updated location to last reference (fixes #13181) (#13354) (Anix)
|
42
|
+
* [`cb50b69`](https://github.com/eslint/eslint/commit/cb50b69c08d4393e32d5c42c537d769c51dd34d8) Update: Improve location for no-mixed-spaces-and-tabs (refs #12334) (#13365) (Milos Djermanovic)
|
43
|
+
* [`f858f2a`](https://github.com/eslint/eslint/commit/f858f2a8f83232484491bd90b0bc5001b5056ad0) Chore: Add Tidelift to funding.yml (#13371) (Nicholas C. Zakas)
|
44
|
+
* [`ee30e5d`](https://github.com/eslint/eslint/commit/ee30e5d8bb1a4c82a2a3fbe1b9ee9f979b55c5c4) Sponsors: Sync README with website (ESLint Jenkins)
|
45
|
+
* [`c29bd9f`](https://github.com/eslint/eslint/commit/c29bd9f75582e5b1a403a8ffd0aafd1ffc8c58e1) Chore: Add breaking/core change link to issue templates (#13344) (Kai Cataldo)
|
46
|
+
* [`d55490f`](https://github.com/eslint/eslint/commit/d55490fa73ff69416de375e4c1cd67b6edba531c) Sponsors: Sync README with website (ESLint Jenkins)
|
47
|
+
|
48
|
+
v7.1.0 - May 22, 2020
|
49
|
+
|
50
|
+
* [`a93083a`](https://github.com/eslint/eslint/commit/a93083af89c6f9714dcdd4a7f27c8655a0b0dba6) Fix: astUtils.getNextLocation returns invalid location after CRLF (#13275) (Milos Djermanovic)
|
51
|
+
* [`df01af1`](https://github.com/eslint/eslint/commit/df01af184d93b3d64b37cee786cad59bd0d7aacb) Update: padded-blocks loc position changes (refs #12334) (#13328) (Anix)
|
52
|
+
* [`bd3f092`](https://github.com/eslint/eslint/commit/bd3f092efa579944f75bfbc277b35f85e6d966ed) Fix: max-lines-per-function flagging arrow IIFEs (fixes #13332) (#13336) (cherryblossom000)
|
53
|
+
* [`25462b2`](https://github.com/eslint/eslint/commit/25462b23eac4ed1ded97eeae6187b5d8baa58e78) Update: block-spacing changed loc for extra (refs #12334) (#13314) (Anix)
|
54
|
+
* [`de0aab9`](https://github.com/eslint/eslint/commit/de0aab95005f172db72196fc3fd18e91ee9a5880) Fix: report end loc in one-var-declaration-per-line (refs #12334) (#13326) (YeonJuan)
|
55
|
+
* [`1710296`](https://github.com/eslint/eslint/commit/1710296082083602a904b080908657bb431fb56c) Fix: no-new-symbol false positive with Symbol as an argument (#13337) (Milos Djermanovic)
|
56
|
+
* [`cc01451`](https://github.com/eslint/eslint/commit/cc014514c29626e556acb0a528e3478b3725e284) Fix: arrow-parens no reporting for comments inside (fixes #12995) (#13312) (Anix)
|
57
|
+
* [`a195141`](https://github.com/eslint/eslint/commit/a19514193a42f4f00732559ff828b33a6ec9d7c5) Update: reporting location for semi-spacing (refs #12334) (#13285) (Anix)
|
58
|
+
* [`e3e4c41`](https://github.com/eslint/eslint/commit/e3e4c41ab625a5af8d4614d1c6d32c656f104f6b) Fix: fix false positives of no-new-func (#13333) (Pig Fang)
|
59
|
+
* [`611c676`](https://github.com/eslint/eslint/commit/611c676dfd671013d81810724f184e2a9c5ad5d7) Docs: Update new rules policies (#13343) (Nicholas C. Zakas)
|
60
|
+
* [`3a5fbb3`](https://github.com/eslint/eslint/commit/3a5fbb3d634be688615950c0a5fa8aead6ff08b5) Chore: correct fileoverview doc in accessor-pairs (#13335) (YeonJuan)
|
61
|
+
* [`b0a6b81`](https://github.com/eslint/eslint/commit/b0a6b8134e3b399beeb69432a02232a1037f7c46) Update: Improve report location for rest-spread-spacing (refs #12334) (#13313) (Milos Djermanovic)
|
62
|
+
* [`68c8ee3`](https://github.com/eslint/eslint/commit/68c8ee3ab70187972aef4c4e866bcf29da70a207) Fix: Stop path analyzer on unknown nodes (#13305) (Ilya Volodin)
|
63
|
+
* [`89e1081`](https://github.com/eslint/eslint/commit/89e10811c4df666216aae58bff5f855cd9df738b) Update: Improve report location for linebreak-style (refs #12334) (#13317) (Milos Djermanovic)
|
64
|
+
* [`0891379`](https://github.com/eslint/eslint/commit/08913798b4ec420b261b8fbc470504f9f248c840) Docs: Document the "correct" way to build an array with values (#13246) (Ed S)
|
65
|
+
* [`88127d7`](https://github.com/eslint/eslint/commit/88127d74d56b88cc5a0758856995716050021131) Chore: remove checkbox from PR template prerequesites (#13330) (Kai Cataldo)
|
66
|
+
* [`c636d57`](https://github.com/eslint/eslint/commit/c636d5708c461a8ff1ea55e5df56d4f76f9c4044) New: no-loss-of-precision (fixes #11279) (#12747) (jmoore914)
|
67
|
+
* [`72a4e10`](https://github.com/eslint/eslint/commit/72a4e1044592057c4a3f39dbb1dbe61b00ea8af6) Chore: Mark SourceCode getComments() method as deprecated (fixes #13293) (#13296) (SuperOleg39)
|
68
|
+
* [`7f14846`](https://github.com/eslint/eslint/commit/7f1484690665b4f4b9cd9680ca8bb7b5cf56e48a) Docs: fix broken link in Node.js API docs (#13307) (Kai Cataldo)
|
69
|
+
* [`02aeba1`](https://github.com/eslint/eslint/commit/02aeba19afb301140514097235a9f2a00a9acb2a) Sponsors: Sync README with website (ESLint Jenkins)
|
70
|
+
* [`1f17533`](https://github.com/eslint/eslint/commit/1f175338cba29960aab67a540f516051f9d428c8) Docs: Gitter -> Discord URL (refs #13039) (#13308) (Nicholas C. Zakas)
|
71
|
+
* [`82a448a`](https://github.com/eslint/eslint/commit/82a448a7deff24e9207f60dfe77622c00102bd99) Docs: improve documentation of no-return-await (#13215) (Linus Unnebäck)
|
72
|
+
* [`742941d`](https://github.com/eslint/eslint/commit/742941d7fdc3fd79ff8c5d2588413e0d3a5a525b) Update: added typescript-eslint/recommended configs for init (#13235) (Anix)
|
73
|
+
* [`3d03df0`](https://github.com/eslint/eslint/commit/3d03df08c8000403a85baffe2a000287f3335114) Sponsors: Sync README with website (ESLint Jenkins)
|
74
|
+
* [`f44a6b4`](https://github.com/eslint/eslint/commit/f44a6b4fd92602af8e2c75d5852f796ec064aa8e) Chore: fix invalid syntax in require-await tests (#13277) (Milos Djermanovic)
|
75
|
+
* [`2c778fb`](https://github.com/eslint/eslint/commit/2c778fb6e31b7943bb27a47a6e15dcbfd8336f39) Fix: remove custom plugins from replacedBy metadata (#13274) (Kai Cataldo)
|
76
|
+
* [`0db3b1d`](https://github.com/eslint/eslint/commit/0db3b1d5cc5e4e1de21462679581b7a4d89ff36e) Sponsors: Sync README with website (ESLint Jenkins)
|
77
|
+
|
1
78
|
v7.0.0 - May 8, 2020
|
2
79
|
|
3
80
|
* [`b98d8bd`](https://github.com/eslint/eslint/commit/b98d8bda4630fe8278c5aa2b6650630770568fe5) Upgrade: eslint-release@2.0.0 (#13271) (Kai Cataldo)
|
@@ -208,6 +285,7 @@ v7.0.0 - May 8, 2020
|
|
208
285
|
* [`39f5a45`](https://github.com/eslint/eslint/commit/39f5a453579b2ad732212edeb71f84ecb0991f97) Chore: add test cases for for-direction (#12698) (YeonJuan)
|
209
286
|
* [`b340304`](https://github.com/eslint/eslint/commit/b3403045e535921df6d34785a4ce053e14ba27fd) Chore: Add extra test, improve docs (#12492) (Kevin Partington)
|
210
287
|
* [`827259e`](https://github.com/eslint/eslint/commit/827259ea009f98a0fdf3f7ebf1bfb6cd661ce28d) Build: package.json update for eslint-config-eslint release (ESLint Jenkins)
|
288
|
+
|
211
289
|
v7.0.0-rc.0 - April 24, 2020
|
212
290
|
|
213
291
|
* [`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
@@ -5,7 +5,6 @@
|
|
5
5
|
<br />
|
6
6
|
[](https://opencollective.com/eslint)
|
7
7
|
[](https://opencollective.com/eslint)
|
8
|
-
[](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
9
8
|
[](https://twitter.com/intent/user?screen_name=geteslint)
|
10
9
|
|
11
10
|
# ESLint
|
@@ -18,7 +17,7 @@
|
|
18
17
|
[Code of Conduct](https://js.foundation/community/code-of-conduct) |
|
19
18
|
[Twitter](https://twitter.com/geteslint) |
|
20
19
|
[Mailing List](https://groups.google.com/group/eslint) |
|
21
|
-
[Chat Room](https://
|
20
|
+
[Chat Room](https://eslint.org/chat)
|
22
21
|
|
23
22
|
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and JSHint with a few exceptions:
|
24
23
|
|
@@ -34,11 +33,12 @@ ESLint is a tool for identifying and reporting on patterns found in ECMAScript/J
|
|
34
33
|
4. [Filing Issues](#filing-issues)
|
35
34
|
5. [Frequently Asked Questions](#faq)
|
36
35
|
6. [Releases](#releases)
|
37
|
-
7. [
|
38
|
-
8. [
|
39
|
-
9. [
|
40
|
-
10. [
|
41
|
-
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)
|
42
42
|
|
43
43
|
## <a name="installation-and-usage"></a>Installation and Usage
|
44
44
|
|
@@ -134,12 +134,16 @@ Once a language feature has been adopted into the ECMAScript standard (stage 4 a
|
|
134
134
|
|
135
135
|
### Where to ask for help?
|
136
136
|
|
137
|
-
Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://
|
137
|
+
Join our [Mailing List](https://groups.google.com/group/eslint) or [Chatroom](https://eslint.org/chat).
|
138
138
|
|
139
139
|
## <a name="releases"></a>Releases
|
140
140
|
|
141
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.
|
142
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
|
+
|
143
147
|
## <a name="semantic-versioning-policy"></a>Semantic Versioning Policy
|
144
148
|
|
145
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:
|
@@ -251,8 +255,8 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
251
255
|
<!--sponsorsstart-->
|
252
256
|
<h3>Gold Sponsors</h3>
|
253
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>
|
254
|
-
<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>
|
255
|
-
<p><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/
|
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://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://cooltechzone.com/netflix-vpn"><img src="https://images.opencollective.com/vpn-netflix/4850160/logo.png" alt="vpn netflix" 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/0b37d14/logo.png" alt="Free Icons by Icons8" 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>
|
256
260
|
<!--sponsorsend-->
|
257
261
|
|
258
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
|
}
|
@@ -517,7 +517,7 @@ class ConfigArrayFactory {
|
|
517
517
|
try {
|
518
518
|
loadPackageJSONConfigFile(filePath);
|
519
519
|
return filePath;
|
520
|
-
} catch
|
520
|
+
} catch { /* ignore */ }
|
521
521
|
} else {
|
522
522
|
return filePath;
|
523
523
|
}
|
@@ -697,6 +697,38 @@ class ConfigArrayFactory {
|
|
697
697
|
ctx.matchBasePath
|
698
698
|
);
|
699
699
|
|
700
|
+
/**
|
701
|
+
* Cloning the rule's config as we are setting `useDefaults` to true`
|
702
|
+
* which mutates the config with its default value if present. And when we
|
703
|
+
* refer to a same variable for config for different rules, that referred variable will
|
704
|
+
* be mutated and it will be used for both.
|
705
|
+
*
|
706
|
+
* Example:
|
707
|
+
*
|
708
|
+
* const commonRuleConfig = ['error', {}];
|
709
|
+
*
|
710
|
+
* Now if we use this variable as a config for rules like this
|
711
|
+
*
|
712
|
+
* {
|
713
|
+
* rules: {
|
714
|
+
* "a" : commonRuleConfig,
|
715
|
+
* "b" : commonRuleConfig,
|
716
|
+
* }
|
717
|
+
* }
|
718
|
+
*
|
719
|
+
* And if these rules have default values in their schema, their
|
720
|
+
* config will be mutated with default values, the mutated `commonRuleConfig` will be used for `b` as well and it probably
|
721
|
+
* throw schema voilation errors.
|
722
|
+
*
|
723
|
+
* Refer https://github.com/eslint/eslint/issues/12592
|
724
|
+
*/
|
725
|
+
const clonedRulesConfig = rules && JSON.parse(
|
726
|
+
JSON.stringify(
|
727
|
+
rules,
|
728
|
+
(key, value) => (value === Infinity ? Number.MAX_SAFE_INTEGER : value)
|
729
|
+
)
|
730
|
+
);
|
731
|
+
|
700
732
|
// Flatten `extends`.
|
701
733
|
for (const extendName of extendList.filter(Boolean)) {
|
702
734
|
yield* this._loadExtends(extendName, ctx);
|
@@ -731,7 +763,7 @@ class ConfigArrayFactory {
|
|
731
763
|
processor,
|
732
764
|
reportUnusedDisableDirectives,
|
733
765
|
root,
|
734
|
-
rules,
|
766
|
+
rules: clonedRulesConfig,
|
735
767
|
settings
|
736
768
|
};
|
737
769
|
|
@@ -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,7 @@ function processAnswers(answers) {
|
|
325
321
|
}
|
326
322
|
}
|
327
323
|
if (answers.typescript && config.extends.includes("eslint:recommended")) {
|
328
|
-
config.extends.push("plugin:@typescript-eslint/
|
324
|
+
config.extends.push("plugin:@typescript-eslint/recommended");
|
329
325
|
}
|
330
326
|
|
331
327
|
// normalize extends
|
@@ -349,7 +345,7 @@ function getLocalESLintVersion() {
|
|
349
345
|
const eslint = require(eslintPath);
|
350
346
|
|
351
347
|
return eslint.linter.version || null;
|
352
|
-
} catch
|
348
|
+
} catch {
|
353
349
|
return null;
|
354
350
|
}
|
355
351
|
}
|
@@ -412,7 +408,7 @@ function installModules(modules) {
|
|
412
408
|
npmUtils.installSyncSaveDev(modules);
|
413
409
|
}
|
414
410
|
|
415
|
-
/* istanbul ignore next: no need to test
|
411
|
+
/* istanbul ignore next: no need to test enquirer */
|
416
412
|
/**
|
417
413
|
* Ask user to install modules.
|
418
414
|
* @param {string[]} modules Array of modules to be installed.
|
@@ -428,14 +424,19 @@ function askInstallModules(modules, packageJsonExists) {
|
|
428
424
|
|
429
425
|
log.info("The config that you've selected requires the following dependencies:\n");
|
430
426
|
log.info(modules.join(" "));
|
431
|
-
return
|
427
|
+
return enquirer.prompt([
|
432
428
|
{
|
433
|
-
type: "
|
429
|
+
type: "toggle",
|
434
430
|
name: "executeInstallation",
|
435
431
|
message: "Would you like to install them now with npm?",
|
436
|
-
|
437
|
-
|
438
|
-
|
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;
|
439
440
|
}
|
440
441
|
}
|
441
442
|
]).then(({ executeInstallation }) => {
|
@@ -445,114 +446,124 @@ function askInstallModules(modules, packageJsonExists) {
|
|
445
446
|
});
|
446
447
|
}
|
447
448
|
|
448
|
-
/* istanbul ignore next: no need to test
|
449
|
+
/* istanbul ignore next: no need to test enquirer */
|
449
450
|
/**
|
450
451
|
* Ask use a few questions on command prompt
|
451
452
|
* @returns {Promise} The promise with the result of the prompt
|
452
453
|
*/
|
453
454
|
function promptUser() {
|
454
455
|
|
455
|
-
return
|
456
|
+
return enquirer.prompt([
|
456
457
|
{
|
457
|
-
type: "
|
458
|
+
type: "select",
|
458
459
|
name: "purpose",
|
459
460
|
message: "How would you like to use ESLint?",
|
460
|
-
|
461
|
+
|
462
|
+
// The returned number matches the name value of nth in the choices array.
|
463
|
+
initial: 1,
|
461
464
|
choices: [
|
462
|
-
{
|
463
|
-
{
|
464
|
-
{
|
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" }
|
465
468
|
]
|
466
469
|
},
|
467
470
|
{
|
468
|
-
type: "
|
471
|
+
type: "select",
|
469
472
|
name: "moduleType",
|
470
473
|
message: "What type of modules does your project use?",
|
471
|
-
|
474
|
+
initial: 0,
|
472
475
|
choices: [
|
473
|
-
{
|
474
|
-
{
|
475
|
-
{
|
476
|
+
{ message: "JavaScript modules (import/export)", name: "esm" },
|
477
|
+
{ message: "CommonJS (require/exports)", name: "commonjs" },
|
478
|
+
{ message: "None of these", name: "none" }
|
476
479
|
]
|
477
480
|
},
|
478
481
|
{
|
479
|
-
type: "
|
482
|
+
type: "select",
|
480
483
|
name: "framework",
|
481
484
|
message: "Which framework does your project use?",
|
482
|
-
|
485
|
+
initial: 0,
|
483
486
|
choices: [
|
484
|
-
{
|
485
|
-
{
|
486
|
-
{
|
487
|
+
{ message: "React", name: "react" },
|
488
|
+
{ message: "Vue.js", name: "vue" },
|
489
|
+
{ message: "None of these", name: "none" }
|
487
490
|
]
|
488
491
|
},
|
489
492
|
{
|
490
|
-
type: "
|
493
|
+
type: "toggle",
|
491
494
|
name: "typescript",
|
492
495
|
message: "Does your project use TypeScript?",
|
493
|
-
|
496
|
+
enabled: "Yes",
|
497
|
+
disabled: "No",
|
498
|
+
initial: 0
|
494
499
|
},
|
495
500
|
{
|
496
|
-
type: "
|
501
|
+
type: "multiselect",
|
497
502
|
name: "env",
|
498
503
|
message: "Where does your code run?",
|
499
|
-
|
504
|
+
hint: "(Press <space> to select, <a> to toggle all, <i> to invert selection)",
|
505
|
+
initial: 0,
|
500
506
|
choices: [
|
501
|
-
{
|
502
|
-
{
|
507
|
+
{ message: "Browser", name: "browser" },
|
508
|
+
{ message: "Node", name: "node" }
|
503
509
|
]
|
504
510
|
},
|
505
511
|
{
|
506
|
-
type: "
|
512
|
+
type: "select",
|
507
513
|
name: "source",
|
508
514
|
message: "How would you like to define a style for your project?",
|
509
|
-
default: "guide",
|
510
515
|
choices: [
|
511
|
-
{
|
512
|
-
{
|
513
|
-
{
|
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" }
|
514
519
|
],
|
515
|
-
|
516
|
-
return answers.purpose
|
520
|
+
skip() {
|
521
|
+
return this.state.answers.purpose !== "style";
|
522
|
+
},
|
523
|
+
result(input) {
|
524
|
+
return this.skipped ? null : input;
|
517
525
|
}
|
518
526
|
},
|
519
527
|
{
|
520
|
-
type: "
|
528
|
+
type: "select",
|
521
529
|
name: "styleguide",
|
522
530
|
message: "Which style guide do you want to follow?",
|
523
531
|
choices: [
|
524
|
-
{
|
525
|
-
{
|
526
|
-
{
|
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" }
|
527
535
|
],
|
528
|
-
|
529
|
-
answers.packageJsonExists = npmUtils.checkPackageJson();
|
530
|
-
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;
|
531
542
|
}
|
532
543
|
},
|
533
544
|
{
|
534
545
|
type: "input",
|
535
546
|
name: "patterns",
|
536
547
|
message: "Which file(s), path(s), or glob(s) should be examined?",
|
537
|
-
|
538
|
-
return
|
548
|
+
skip() {
|
549
|
+
return this.state.answers.source !== "auto";
|
539
550
|
},
|
540
551
|
validate(input) {
|
541
|
-
if (input.trim().length === 0 && input.trim() !== ",") {
|
552
|
+
if (!this.skipped && input.trim().length === 0 && input.trim() !== ",") {
|
542
553
|
return "You must tell us what code to examine. Try again.";
|
543
554
|
}
|
544
555
|
return true;
|
545
556
|
}
|
546
557
|
},
|
547
558
|
{
|
548
|
-
type: "
|
559
|
+
type: "select",
|
549
560
|
name: "format",
|
550
561
|
message: "What format do you want your config file to be in?",
|
551
|
-
|
562
|
+
initial: 0,
|
552
563
|
choices: ["JavaScript", "YAML", "JSON"]
|
553
564
|
},
|
554
565
|
{
|
555
|
-
type: "
|
566
|
+
type: "toggle",
|
556
567
|
name: "installESLint",
|
557
568
|
message(answers) {
|
558
569
|
const verb = semver.ltr(answers.localESLintVersion, answers.requiredESLintVersionRange)
|
@@ -561,9 +572,14 @@ function promptUser() {
|
|
561
572
|
|
562
573
|
return `The style guide "${answers.styleguide}" requires eslint@${answers.requiredESLintVersionRange}. You are currently using eslint@${answers.localESLintVersion}.\n Do you want to ${verb}?`;
|
563
574
|
},
|
564
|
-
|
565
|
-
|
566
|
-
|
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;
|
567
583
|
}
|
568
584
|
}
|
569
585
|
]).then(earlyAnswers => {
|
@@ -616,33 +632,35 @@ function promptUser() {
|
|
616
632
|
}
|
617
633
|
|
618
634
|
// continue with the style questions otherwise...
|
619
|
-
return
|
635
|
+
return enquirer.prompt([
|
620
636
|
{
|
621
|
-
type: "
|
637
|
+
type: "select",
|
622
638
|
name: "indent",
|
623
639
|
message: "What style of indentation do you use?",
|
624
|
-
|
625
|
-
choices: [{
|
640
|
+
initial: 0,
|
641
|
+
choices: [{ message: "Tabs", name: "tab" }, { message: "Spaces", name: 4 }]
|
626
642
|
},
|
627
643
|
{
|
628
|
-
type: "
|
644
|
+
type: "select",
|
629
645
|
name: "quotes",
|
630
646
|
message: "What quotes do you use for strings?",
|
631
|
-
|
632
|
-
choices: [{
|
647
|
+
initial: 0,
|
648
|
+
choices: [{ message: "Double", name: "double" }, { message: "Single", name: "single" }]
|
633
649
|
},
|
634
650
|
{
|
635
|
-
type: "
|
651
|
+
type: "select",
|
636
652
|
name: "linebreak",
|
637
653
|
message: "What line endings do you use?",
|
638
|
-
|
639
|
-
choices: [{
|
654
|
+
initial: 0,
|
655
|
+
choices: [{ message: "Unix", name: "unix" }, { message: "Windows", name: "windows" }]
|
640
656
|
},
|
641
657
|
{
|
642
|
-
type: "
|
658
|
+
type: "toggle",
|
643
659
|
name: "semi",
|
644
660
|
message: "Do you require semicolons?",
|
645
|
-
|
661
|
+
enabled: "Yes",
|
662
|
+
disabled: "No",
|
663
|
+
initial: 1
|
646
664
|
}
|
647
665
|
]).then(answers => {
|
648
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
|
/**
|