eslint 7.4.0 → 7.8.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 +86 -0
- package/README.md +29 -17
- package/conf/config-schema.js +12 -0
- package/lib/cli-engine/cascading-config-array-factory.js +12 -0
- package/lib/cli-engine/cli-engine.js +2 -2
- package/lib/cli-engine/config-array/config-array.js +12 -0
- package/lib/cli-engine/config-array/config-dependency.js +12 -0
- package/lib/cli-engine/config-array/extracted-config.js +12 -0
- package/lib/cli-engine/config-array/ignore-pattern.js +12 -0
- package/lib/cli-engine/config-array/index.js +12 -0
- package/lib/cli-engine/config-array/override-tester.js +12 -0
- package/lib/cli-engine/config-array-factory.js +13 -1
- package/lib/cli-engine/formatters/checkstyle.js +2 -2
- package/lib/eslint/eslint.js +7 -1
- package/lib/init/autoconfig.js +1 -1
- package/lib/init/config-initializer.js +3 -3
- package/lib/linter/code-path-analysis/code-path-analyzer.js +76 -0
- package/lib/linter/code-path-analysis/code-path-segment.js +0 -1
- package/lib/linter/code-path-analysis/code-path-state.js +61 -2
- package/lib/linter/code-path-analysis/debug-helpers.js +26 -19
- package/lib/linter/config-comment-parser.js +1 -1
- package/lib/linter/linter.js +6 -3
- package/lib/rule-tester/rule-tester.js +10 -0
- package/lib/rules/accessor-pairs.js +1 -14
- package/lib/rules/array-callback-return.js +5 -7
- package/lib/rules/arrow-body-style.js +41 -6
- package/lib/rules/comma-dangle.js +1 -2
- package/lib/rules/consistent-return.js +1 -12
- package/lib/rules/constructor-super.js +18 -1
- package/lib/rules/dot-location.js +20 -14
- package/lib/rules/dot-notation.js +36 -33
- package/lib/rules/func-call-spacing.js +42 -6
- package/lib/rules/func-name-matching.js +1 -4
- package/lib/rules/global-require.js +2 -1
- package/lib/rules/id-blacklist.js +233 -0
- package/lib/rules/id-length.js +19 -1
- package/lib/rules/indent.js +23 -3
- package/lib/rules/index.js +1 -3
- package/lib/rules/keyword-spacing.js +2 -2
- package/lib/rules/max-len.js +13 -2
- package/lib/rules/new-cap.js +10 -14
- package/lib/rules/newline-per-chained-call.js +15 -5
- package/lib/rules/no-alert.js +10 -3
- package/lib/rules/no-duplicate-case.js +23 -4
- package/lib/rules/no-eval.js +8 -38
- package/lib/rules/no-extend-native.js +37 -40
- package/lib/rules/no-extra-bind.js +57 -17
- package/lib/rules/no-extra-boolean-cast.js +7 -0
- package/lib/rules/no-extra-parens.js +27 -7
- package/lib/rules/no-implicit-coercion.js +11 -6
- package/lib/rules/no-implied-eval.js +7 -28
- package/lib/rules/no-import-assign.js +33 -32
- package/lib/rules/no-irregular-whitespace.js +22 -12
- package/lib/rules/no-loss-of-precision.js +10 -2
- package/lib/rules/no-magic-numbers.js +24 -11
- package/lib/rules/no-obj-calls.js +7 -4
- package/lib/rules/no-prototype-builtins.js +13 -3
- package/lib/rules/no-self-assign.js +3 -53
- package/lib/rules/no-setter-return.js +5 -8
- package/lib/rules/no-underscore-dangle.js +66 -21
- package/lib/rules/no-unexpected-multiline.js +2 -2
- package/lib/rules/no-unneeded-ternary.js +0 -2
- package/lib/rules/no-unused-expressions.js +55 -23
- package/lib/rules/no-useless-call.js +10 -7
- package/lib/rules/no-warning-comments.js +40 -7
- package/lib/rules/no-whitespace-before-property.js +16 -4
- package/lib/rules/object-curly-newline.js +4 -4
- package/lib/rules/operator-assignment.js +4 -43
- package/lib/rules/padding-line-between-statements.js +2 -2
- package/lib/rules/prefer-arrow-callback.js +90 -25
- package/lib/rules/prefer-exponentiation-operator.js +1 -1
- package/lib/rules/prefer-numeric-literals.js +14 -13
- package/lib/rules/prefer-promise-reject-errors.js +1 -3
- package/lib/rules/prefer-regex-literals.js +2 -5
- package/lib/rules/prefer-spread.js +2 -6
- package/lib/rules/radix.js +5 -2
- package/lib/rules/sort-imports.js +28 -0
- package/lib/rules/use-isnan.js +1 -1
- package/lib/rules/utils/ast-utils.js +363 -165
- package/lib/rules/wrap-iife.js +9 -2
- package/lib/rules/yoda.js +2 -55
- package/lib/shared/config-validator.js +14 -2
- package/lib/shared/relative-module-resolver.js +12 -0
- package/lib/shared/types.js +1 -1
- 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 +7 -7
- package/conf/environments.js +0 -168
- package/lib/shared/config-ops.js +0 -130
- package/lib/shared/naming.js +0 -97
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,86 @@
|
|
1
|
+
v7.8.0 - August 31, 2020
|
2
|
+
|
3
|
+
* [`58abd93`](https://github.com/eslint/eslint/commit/58abd9311900a8af5a3c0963daaf64675bdd8383) Update: support logical assignments in code path analysis (refs #13569) (#13612) (Milos Djermanovic)
|
4
|
+
* [`db7488e`](https://github.com/eslint/eslint/commit/db7488e6326fd1b7ea04c5062beb1c5f75fc15ed) Update: support logical assignments in core rules (refs #13569) (#13618) (Milos Djermanovic)
|
5
|
+
* [`3729219`](https://github.com/eslint/eslint/commit/372921924778f2e525535985e17c97b988546210) Docs: Update Step 1 of Development Environment documentation (klkhan)
|
6
|
+
* [`a320324`](https://github.com/eslint/eslint/commit/a32032430a0779a4e3b2d137d4d0682844084b82) Chore: Test formatted integers in no-dupe-keys (refs #13568) (#13626) (Brandon Mills)
|
7
|
+
* [`88a9ade`](https://github.com/eslint/eslint/commit/88a9ade7643bb166efbab45cee15f3269496f4be) Update: add es2021 environment (refs #13602) (#13603) (Milos Djermanovic)
|
8
|
+
* [`0003dc0`](https://github.com/eslint/eslint/commit/0003dc0f966f2b47555595586f84eb3163cb0179) Update: support numeric separators (refs #13568) (#13581) (Milos Djermanovic)
|
9
|
+
* [`96b11a0`](https://github.com/eslint/eslint/commit/96b11a0717bf32b94ec768611574372320fb774b) Update: Add exceptionPatterns to id-length rule (fixes #13094) (#13576) (sodam)
|
10
|
+
* [`3439fea`](https://github.com/eslint/eslint/commit/3439fea5c0ed330d01d874b0c9df51dd51ae792c) Update: support numeric-separator in no-loss-of-precision (refs #13568) (#13574) (Anix)
|
11
|
+
* [`ed64767`](https://github.com/eslint/eslint/commit/ed64767859d776145d68145419a61f5379b4dd63) Update: add comment to message in no-warning-comments (fixes #12327) (#13522) (Anix)
|
12
|
+
* [`e60ec07`](https://github.com/eslint/eslint/commit/e60ec07fad0c1d4c966f28d214c5379da753ff4e) Sponsors: Sync README with website (ESLint Jenkins)
|
13
|
+
* [`483bf7f`](https://github.com/eslint/eslint/commit/483bf7f3cc40e0d866798d6ca9ee1c19aa77ddd2) Docs: fix examples in object-curly-newline (#13605) (Soobin Bak)
|
14
|
+
* [`1c35d57`](https://github.com/eslint/eslint/commit/1c35d57b0a5f374cc55f1727a7561bcab1962e83) Docs: Remove stale Keybase 2FA instructions (#13622) (Brandon Mills)
|
15
|
+
* [`82669fa`](https://github.com/eslint/eslint/commit/82669fa66670a00988db5b1d10fe8f3bf30be84e) Chore: Extract some functionality to eslintrc (refs #13481) (#13613) (Nicholas C. Zakas)
|
16
|
+
* [`4111d21`](https://github.com/eslint/eslint/commit/4111d21a046b73892e2c84f92815a21ef4db63e1) Docs: Fix typo and missing article before noun in docs (#13611) (Patrice Sandhu)
|
17
|
+
* [`091e52a`](https://github.com/eslint/eslint/commit/091e52ae1ca408f3e668f394c14d214c9ce806e6) Upgrade: espree@7.3.0 (refs #13568) (#13609) (Kai Cataldo)
|
18
|
+
* [`05074fb`](https://github.com/eslint/eslint/commit/05074fb2c243e904e8c09d714ad9d084acdd80d2) Sponsors: Sync README with website (ESLint Jenkins)
|
19
|
+
* [`bdb65ec`](https://github.com/eslint/eslint/commit/bdb65ec2e672c9815bee356b61d1cd60a1072152) Chore: add 3rd party parsers in BUG_REPORT template (#13606) (YeonJuan)
|
20
|
+
* [`f954476`](https://github.com/eslint/eslint/commit/f954476fb6b0664679c73babd5e8a0647572b81f) Chore: add common 3rd party parsers to issue template (#13596) (Kai Cataldo)
|
21
|
+
* [`2bee6d2`](https://github.com/eslint/eslint/commit/2bee6d256ae0516c9a9003bb3fdca24ff93253b5) Chore: Mark config-related files (refs #13481) (#13597) (Nicholas C. Zakas)
|
22
|
+
* [`66442a9`](https://github.com/eslint/eslint/commit/66442a9faf9872db4a40f56dde28c48f4d02fc7b) Update: Add no-magic-numbers 'ignoreDefaultValues' option (#12611) (Dieter Luypaert)
|
23
|
+
* [`b487164`](https://github.com/eslint/eslint/commit/b487164d01dd0bf66fdf2df0e374ce1c3bdb0339) Docs: add exponentiation operators to operator-assignment documentation (#13577) (Milos Djermanovic)
|
24
|
+
* [`2f27836`](https://github.com/eslint/eslint/commit/2f27836e989f3dfe236e34054b490febc359bc48) Sponsors: Sync README with website (ESLint Jenkins)
|
25
|
+
* [`60eafc1`](https://github.com/eslint/eslint/commit/60eafc15075f38955cb6816bf1f0bcf6e6e6d3a6) Sponsors: Sync README with website (ESLint Jenkins)
|
26
|
+
|
27
|
+
v7.7.0 - August 14, 2020
|
28
|
+
|
29
|
+
* [`b46f3ee`](https://github.com/eslint/eslint/commit/b46f3ee0dae4add9df99cae940b641ad8de58b9e) Update: allowFunctionParams option in no-underscore-dangle (fixes 12579) (#13545) (Sunghyun Cho)
|
30
|
+
* [`26aa245`](https://github.com/eslint/eslint/commit/26aa2452b5f407fabc25dad21182180e4d3be532) Docs: clarify "case" specifier in padding-line-between-statements (#13562) (Milos Djermanovic)
|
31
|
+
* [`082891c`](https://github.com/eslint/eslint/commit/082891c042d72953fe86cd3ce9c96e661760793d) Docs: Update semantic versioning policy (#13563) (Nicholas C. Zakas)
|
32
|
+
* [`4e0b672`](https://github.com/eslint/eslint/commit/4e0b672eb4bf39f7502a550b08b25a56a196f19f) Fix: revert "Update: disallow multiple options in comma-dangle schema" (#13564) (Kai Cataldo)
|
33
|
+
* [`254990e`](https://github.com/eslint/eslint/commit/254990e87914457ca25ea2d7ee012964e56fc9e5) Fix: indent for async arrow functions (fixes #13497) (#13544) (Anix)
|
34
|
+
* [`28ca339`](https://github.com/eslint/eslint/commit/28ca339259b07c96c73f2ef28cbf112b96395855) Sponsors: Sync README with website (ESLint Jenkins)
|
35
|
+
* [`2e4158d`](https://github.com/eslint/eslint/commit/2e4158d3ec9cfed6400bf70795fd7171e96ff9b3) Sponsors: Sync README with website (ESLint Jenkins)
|
36
|
+
* [`488d159`](https://github.com/eslint/eslint/commit/488d1595aef43c4d52cccdb2c97977884f0375a8) Sponsors: Sync README with website (ESLint Jenkins)
|
37
|
+
* [`c44306e`](https://github.com/eslint/eslint/commit/c44306e52778309a79232ceab8b55a9aa0f2dfda) Sponsors: Sync README with website (ESLint Jenkins)
|
38
|
+
* [`6677180`](https://github.com/eslint/eslint/commit/6677180495e16a02d150d0552e7e5d5f6b77fcc5) Sponsors: Sync README with website (ESLint Jenkins)
|
39
|
+
* [`07db7b8`](https://github.com/eslint/eslint/commit/07db7b8080c2f68ee28e7d447db356c33e6fddce) Sponsors: Sync README with website (ESLint Jenkins)
|
40
|
+
* [`d4ce4d3`](https://github.com/eslint/eslint/commit/d4ce4d3b8492c3e4654ed1f51f2c48e6c0ad272f) Sponsors: Sync README with website (ESLint Jenkins)
|
41
|
+
* [`284e954`](https://github.com/eslint/eslint/commit/284e954f93126c50e0aa9b88f42afb03a47ad967) Sponsors: Sync README with website (ESLint Jenkins)
|
42
|
+
* [`ae9b54e`](https://github.com/eslint/eslint/commit/ae9b54e59b01aa9f50ee31f5b6787d86e6b59de6) Sponsors: Sync README with website (ESLint Jenkins)
|
43
|
+
* [`9124a15`](https://github.com/eslint/eslint/commit/9124a1599638a1caf4b7e252d1cb66abdc5e51c6) Chore: remove leche (fixes #13287) (#13533) (Mark de Dios)
|
44
|
+
* [`5c4c7f5`](https://github.com/eslint/eslint/commit/5c4c7f515c2e8e83f2186a66ddce75d6477abeb0) Sponsors: Sync README with website (ESLint Jenkins)
|
45
|
+
* [`48d8ec8`](https://github.com/eslint/eslint/commit/48d8ec8cf320c69aed17c6b6c78f19e7c1e587ca) Sponsors: Sync README with website (ESLint Jenkins)
|
46
|
+
|
47
|
+
v7.6.0 - July 31, 2020
|
48
|
+
|
49
|
+
* [`ecb2b73`](https://github.com/eslint/eslint/commit/ecb2b7343a0d14fb57d297a16be6c1b176fb3dbf) Update: require `meta` for fixable rules in RuleTester (refs #13349) (#13489) (Milos Djermanovic)
|
50
|
+
* [`6fb4edd`](https://github.com/eslint/eslint/commit/6fb4edde3b7a7ae2faf8ac956a7342fbf80865fc) Docs: fix broken links in developer guide (#13518) (Sam Chen)
|
51
|
+
* [`318fe10`](https://github.com/eslint/eslint/commit/318fe103dbf2548eee293ff456ef0b829dbe3db3) Fix: Do not output `undefined` as line and column when it's unavailable (#13519) (haya14busa)
|
52
|
+
* [`493b5b4`](https://github.com/eslint/eslint/commit/493b5b40cae7a076fdeb19740f8c88fb4ae9c1fb) Sponsors: Sync README with website (ESLint Jenkins)
|
53
|
+
* [`f100143`](https://github.com/eslint/eslint/commit/f100143fa5f529aacb2b50e650a00d2697ca4c54) Sponsors: Sync README with website (ESLint Jenkins)
|
54
|
+
* [`16b10fe`](https://github.com/eslint/eslint/commit/16b10fe8ba3c78939d5ada4a25caf2f0c9e6a058) Fix: Update the chatroom link to go directly to help channel (#13536) (Nicholas C. Zakas)
|
55
|
+
* [`f937eb9`](https://github.com/eslint/eslint/commit/f937eb95407f60d3772bcb956e227aaf99e48777) Sponsors: Sync README with website (ESLint Jenkins)
|
56
|
+
* [`e71e298`](https://github.com/eslint/eslint/commit/e71e2980cd2e319afc70d8c859c7ffd59cf4157b) Update: Change no-duplicate-case to comparing tokens (fixes #13485) (#13494) (Yosuke Ota)
|
57
|
+
* [`6c4aea4`](https://github.com/eslint/eslint/commit/6c4aea44fd78e1eecea5fe3c37e1921e3b1e98a6) Docs: add ECMAScript 2020 to README (#13510) (Milos Djermanovic)
|
58
|
+
|
59
|
+
v7.5.0 - July 18, 2020
|
60
|
+
|
61
|
+
* [`6ea3178`](https://github.com/eslint/eslint/commit/6ea3178776eae0e40c3f5498893e8aab0e23686b) Update: optional chaining support (fixes #12642) (#13416) (Toru Nagashima)
|
62
|
+
* [`540b1af`](https://github.com/eslint/eslint/commit/540b1af77278ae649b621aa8d4bf8d6de03c3155) Chore: enable consistent-meta-messages internal rule (#13487) (Milos Djermanovic)
|
63
|
+
* [`885a145`](https://github.com/eslint/eslint/commit/885a1455691265db88dc0befe9b48a69d69e8b9c) Docs: clarify behavior if `meta.fixable` is omitted (refs #13349) (#13493) (Milos Djermanovic)
|
64
|
+
* [`1a01b42`](https://github.com/eslint/eslint/commit/1a01b420eaab0de03dab5cc190a9f2a860c21a84) Docs: Update technology sponsors in README (#13478) (Nicholas C. Zakas)
|
65
|
+
* [`6ed9e8e`](https://github.com/eslint/eslint/commit/6ed9e8e4ff038c0259b0e7fe7ab7f4fd4ec55801) Upgrade: lodash@4.17.19 (#13499) (Yohan Siguret)
|
66
|
+
* [`45cdf00`](https://github.com/eslint/eslint/commit/45cdf00da6aeff3d584d37b0710fc8d6ad9456d6) Sponsors: Sync README with website (ESLint Jenkins)
|
67
|
+
* [`f1cc725`](https://github.com/eslint/eslint/commit/f1cc725ba1b8646dcf06a83716d96ad9bb726172) Docs: fix linebreaks between versions in changelog (#13488) (Milos Djermanovic)
|
68
|
+
* [`f4d7b9e`](https://github.com/eslint/eslint/commit/f4d7b9e1a599346b2f21ff9de003b311b51411e6) Update: deprecate id-blacklist rule (#13465) (Dimitri Mitropoulos)
|
69
|
+
* [`e14a645`](https://github.com/eslint/eslint/commit/e14a645aa495558081490f990ba221e21aa6b27c) Chore: use espree.latestEcmaVersion in fuzzer (#13484) (Milos Djermanovic)
|
70
|
+
* [`61097fe`](https://github.com/eslint/eslint/commit/61097fe5cc275d414a0c8e19b31c6060cb5568b7) Docs: Update int rule level to string (#13483) (Brandon Mills)
|
71
|
+
* [`c8f9c82`](https://github.com/eslint/eslint/commit/c8f9c8210cf4b9da8f07922093d7b219abad9f10) Update: Improve report location no-irregular-whitespace (refs #12334) (#13462) (Milos Djermanovic)
|
72
|
+
* [`f2e68ec`](https://github.com/eslint/eslint/commit/f2e68ec1d6cee6299e8a5cdf76c522c11d3008dd) Build: update webpack resolve.mainFields to match website config (#13457) (Milos Djermanovic)
|
73
|
+
* [`a96bc5e`](https://github.com/eslint/eslint/commit/a96bc5ec06f3a48bfe458bccd68d4d3b2a280ed9) Fix: arrow-body-style fixer for `in` wrap (fixes #11849) (#13228) (Anix)
|
74
|
+
* [`748734f`](https://github.com/eslint/eslint/commit/748734fdd497fbf61f3a616ff4a09169135b9396) Upgrade: Updated puppeteer version to v4.0.0 (#13444) (odidev)
|
75
|
+
* [`e951457`](https://github.com/eslint/eslint/commit/e951457b7aaa1b12b135588d36e3f4db4d7b8463) Docs: fix wording in configuring.md (#13469) (Piper)
|
76
|
+
* [`0af1d28`](https://github.com/eslint/eslint/commit/0af1d2828d27885483737867653ba1659af72005) Update: add allowSeparatedGroups option to sort-imports (fixes #12951) (#13455) (Milos Djermanovic)
|
77
|
+
* [`1050ee7`](https://github.com/eslint/eslint/commit/1050ee78a95da9484ff333dc1c74dac64c05da6f) Update: Improve report location for no-unneeded-ternary (refs #12334) (#13456) (Milos Djermanovic)
|
78
|
+
* [`b77b420`](https://github.com/eslint/eslint/commit/b77b4202bd1d5d1306f6f645e88d7a41a51715db) Update: Improve report location for max-len (refs #12334) (#13458) (Milos Djermanovic)
|
79
|
+
* [`095194c`](https://github.com/eslint/eslint/commit/095194c0fc0eb02aa69fde6b4280696e0e4de214) Fix: add end location to reports in object-curly-newline (refs #12334) (#13460) (Milos Djermanovic)
|
80
|
+
* [`10251bb`](https://github.com/eslint/eslint/commit/10251bbaeba80ac15244f385fc42cf2f2a30e5d2) Fix: add end location to reports in keyword-spacing (refs #12334) (#13461) (Milos Djermanovic)
|
81
|
+
* [`2ea7ee5`](https://github.com/eslint/eslint/commit/2ea7ee51a4e05ee76a6dae5954c3b6263b0970a3) Sponsors: Sync README with website (ESLint Jenkins)
|
82
|
+
* [`b55fd3b`](https://github.com/eslint/eslint/commit/b55fd3b8c05a29a465a794a524b06c1a28cddf0c) Sponsors: Sync README with website (ESLint Jenkins)
|
83
|
+
|
1
84
|
v7.4.0 - July 3, 2020
|
2
85
|
|
3
86
|
* [`f21bad2`](https://github.com/eslint/eslint/commit/f21bad2680406a2671b877f8dba47f4475d0cc64) Docs: fix description for `never` in multiline-ternary (fixes #13368) (#13452) (Milos Djermanovic)
|
@@ -18,9 +101,11 @@ v7.4.0 - July 3, 2020
|
|
18
101
|
* [`0655f66`](https://github.com/eslint/eslint/commit/0655f66525d167ca1288167b79a77087cfc8fcf6) Update: improve report location in arrow-body-style (refs #12334) (#13424) (YeonJuan)
|
19
102
|
* [`d53d69a`](https://github.com/eslint/eslint/commit/d53d69af08cfe55f42e0a0ca725b1014dabccc21) Update: prefer-regex-literal detect regex literals (fixes #12840) (#12842) (Mathias Schreck)
|
20
103
|
* [`004adae`](https://github.com/eslint/eslint/commit/004adae3f959414f56e44e5884f6221e9dcda142) Update: rename id-blacklist to id-denylist (fixes #13407) (#13408) (Kai Cataldo)
|
104
|
+
|
21
105
|
v7.3.1 - June 22, 2020
|
22
106
|
|
23
107
|
* [`de77c11`](https://github.com/eslint/eslint/commit/de77c11e7515f2097ff355ddc0d7b6db9c83c892) Fix: Replace Infinity with Number.MAX_SAFE_INTEGER (fixes #13427) (#13435) (Nicholas C. Zakas)
|
108
|
+
|
24
109
|
v7.3.0 - June 19, 2020
|
25
110
|
|
26
111
|
* [`638a6d6`](https://github.com/eslint/eslint/commit/638a6d6be18b4a37cfdc7223e1f5acd3718694be) Update: add missing `additionalProperties: false` to some rules' schema (#13198) (Milos Djermanovic)
|
@@ -45,6 +130,7 @@ v7.3.0 - June 19, 2020
|
|
45
130
|
* [`0f1f5ed`](https://github.com/eslint/eslint/commit/0f1f5ed2a20b8fb575d4360316861cf4c2b9b7bc) Docs: Add security policy link to README (#13403) (Nicholas C. Zakas)
|
46
131
|
* [`9e9ba89`](https://github.com/eslint/eslint/commit/9e9ba897c566601cfe90522099c635ea316b235f) Sponsors: Sync README with website (ESLint Jenkins)
|
47
132
|
* [`ca59fb9`](https://github.com/eslint/eslint/commit/ca59fb95a395c0a02ed23768a70e086480ab1f6d) Sponsors: Sync README with website (ESLint Jenkins)
|
133
|
+
|
48
134
|
v7.2.0 - June 5, 2020
|
49
135
|
|
50
136
|
* [`b735a48`](https://github.com/eslint/eslint/commit/b735a485e77bcc791e4c4c6b8716801d94e98b2c) Update: add enforceForFunctionPrototypeMethods option to no-extra-parens (#12895) (Milos Djermanovic)
|
package/README.md
CHANGED
@@ -122,7 +122,7 @@ Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [confi
|
|
122
122
|
|
123
123
|
### What ECMAScript versions does ESLint support?
|
124
124
|
|
125
|
-
ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, and
|
125
|
+
ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, 2018, 2019, and 2020. You can set your desired ECMAScript syntax (and other settings, like global variables or your target environments) through [configuration](https://eslint.org/docs/user-guide/configuring).
|
126
126
|
|
127
127
|
### What about experimental features?
|
128
128
|
|
@@ -149,27 +149,32 @@ ESLint takes security seriously. We work hard to ensure that ESLint is safe for
|
|
149
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:
|
150
150
|
|
151
151
|
* Patch release (intended to not break your lint build)
|
152
|
-
* A bug fix in a rule that results in ESLint reporting fewer errors.
|
152
|
+
* A bug fix in a rule that results in ESLint reporting fewer linting errors.
|
153
153
|
* A bug fix to the CLI or core (including formatters).
|
154
154
|
* Improvements to documentation.
|
155
155
|
* Non-user-facing changes such as refactoring code, adding, deleting, or modifying tests, and increasing test coverage.
|
156
156
|
* Re-releasing after a failed release (i.e., publishing a release that doesn't work for anyone).
|
157
157
|
* Minor release (might break your lint build)
|
158
|
-
* A bug fix in a rule that results in ESLint reporting more errors.
|
158
|
+
* A bug fix in a rule that results in ESLint reporting more linting errors.
|
159
159
|
* A new rule is created.
|
160
|
-
* A new option to an existing rule that does not result in ESLint reporting more errors by default.
|
160
|
+
* A new option to an existing rule that does not result in ESLint reporting more linting errors by default.
|
161
161
|
* An existing rule is deprecated.
|
162
162
|
* A new CLI capability is created.
|
163
163
|
* New capabilities to the public API are added (new classes, new methods, new arguments to existing methods, etc.).
|
164
164
|
* A new formatter is created.
|
165
|
-
* `eslint:recommended` is updated and will result in strictly fewer errors (e.g., rule removals).
|
165
|
+
* `eslint:recommended` is updated and will result in strictly fewer linting errors (e.g., rule removals).
|
166
166
|
* Major release (likely to break your lint build)
|
167
|
-
* `eslint:recommended` is updated and may result in new errors (e.g., rule additions, most rule option updates).
|
168
|
-
* A new option to an existing rule that results in ESLint reporting more errors by default.
|
167
|
+
* `eslint:recommended` is updated and may result in new linting errors (e.g., rule additions, most rule option updates).
|
168
|
+
* A new option to an existing rule that results in ESLint reporting more linting errors by default.
|
169
169
|
* An existing formatter is removed.
|
170
|
-
* Part of the public API is removed or changed in an incompatible way.
|
170
|
+
* Part of the public API is removed or changed in an incompatible way. The public API includes:
|
171
|
+
* Rule schemas
|
172
|
+
* Configuration schema
|
173
|
+
* Command-line options
|
174
|
+
* Node.js API
|
175
|
+
* Rule, formatter, parser, plugin APIs
|
171
176
|
|
172
|
-
According to our policy, any minor update may report more errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (`~`) in `package.json` e.g. `"eslint": "~3.1.0"` to guarantee the results of your builds.
|
177
|
+
According to our policy, any minor update may report more linting errors than the previous release (ex: from a bug fix). As such, we recommend using the tilde (`~`) in `package.json` e.g. `"eslint": "~3.1.0"` to guarantee the results of your builds.
|
173
178
|
|
174
179
|
## <a name="license"></a>License
|
175
180
|
|
@@ -206,6 +211,11 @@ Toru Nagashima
|
|
206
211
|
<img src="https://github.com/kaicataldo.png?s=75" width="75" height="75"><br />
|
207
212
|
Kai Cataldo
|
208
213
|
</a>
|
214
|
+
</td><td align="center" valign="top" width="11%">
|
215
|
+
<a href="https://github.com/mdjermanovic">
|
216
|
+
<img src="https://github.com/mdjermanovic.png?s=75" width="75" height="75"><br />
|
217
|
+
Milos Djermanovic
|
218
|
+
</a>
|
209
219
|
</td></tr></tbody></table>
|
210
220
|
|
211
221
|
|
@@ -218,11 +228,6 @@ The people who review and implement new features.
|
|
218
228
|
<img src="https://github.com/aladdin-add.png?s=75" width="75" height="75"><br />
|
219
229
|
薛定谔的猫
|
220
230
|
</a>
|
221
|
-
</td><td align="center" valign="top" width="11%">
|
222
|
-
<a href="https://github.com/mdjermanovic">
|
223
|
-
<img src="https://github.com/mdjermanovic.png?s=75" width="75" height="75"><br />
|
224
|
-
Milos Djermanovic
|
225
|
-
</a>
|
226
231
|
</td></tr></tbody></table>
|
227
232
|
|
228
233
|
|
@@ -238,6 +243,11 @@ The people who review and fix bugs and help triage issues.
|
|
238
243
|
Pig Fang
|
239
244
|
</a>
|
240
245
|
</td><td align="center" valign="top" width="11%">
|
246
|
+
<a href="https://github.com/anikethsaha">
|
247
|
+
<img src="https://github.com/anikethsaha.png?s=75" width="75" height="75"><br />
|
248
|
+
Anix
|
249
|
+
</a>
|
250
|
+
</td><td align="center" valign="top" width="11%">
|
241
251
|
<a href="https://github.com/yeonjuan">
|
242
252
|
<img src="https://github.com/yeonjuan.png?s=75" width="75" height="75"><br />
|
243
253
|
YeonJuan
|
@@ -254,11 +264,13 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
254
264
|
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
255
265
|
<!--sponsorsstart-->
|
256
266
|
<h3>Gold Sponsors</h3>
|
257
|
-
<p><a href="https://www.
|
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://
|
267
|
+
<p><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> <a href="https://aka.ms/microsoftfossfund"><img src="https://avatars1.githubusercontent.com/u/67931232?u=7fddc652a464d7151b97e8f108392af7d54fa3e8&v=4" alt="Microsoft FOSS Fund Sponsorships" height="96"></a></p><h3>Silver Sponsors</h3>
|
268
|
+
<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> <a href="https://eslint.org/"><img src="https://images.opencollective.com/eslint/96b09dc/logo.png" alt="ESLint" height="64"></a> <a href="https://eslint.org/"><img src="https://images.opencollective.com/eslint/96b09dc/logo.png" alt="ESLint" height="64"></a></p><h3>Bronze Sponsors</h3>
|
269
|
+
<p><a href="https://vpn-review.com/netflix-vpn"><img src="https://images.opencollective.com/vpn-for-netflix/4887627/logo.png" alt="vpn for netflix" height="32"></a> <a href="https://www.veikkaajat.com"><img src="https://images.opencollective.com/veikkaajat/b92b427/logo.png" alt="Veikkaajat.com" height="32"></a> <a href="https://www.nettikasinot.media/"><img src="https://images.opencollective.com/nettikasinot-media/2dba7da/logo.png" alt="Nettikasinot.media" height="32"></a> <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://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="null"><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://www.marfeel.com/"><img src="https://images.opencollective.com/marfeel/4b88e30/logo.png" alt="Marfeel" height="32"></a> <a href="https://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a></p>
|
260
270
|
<!--sponsorsend-->
|
261
271
|
|
262
272
|
## <a name="technology-sponsors"></a>Technology Sponsors
|
263
273
|
|
264
274
|
* Site search ([eslint.org](https://eslint.org)) is sponsored by [Algolia](https://www.algolia.com)
|
275
|
+
* Hosting for ([eslint.org](https://eslint.org)) is sponsored by [Netlify](https://www.netlify.com)
|
276
|
+
* Password management is sponsored by [1Password](https://www.1password.com)
|
package/conf/config-schema.js
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview Defines a schema for configs.
|
3
15
|
* @author Sylvan Mably
|
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview `CascadingConfigArrayFactory` class.
|
3
15
|
*
|
@@ -19,8 +19,8 @@ const fs = require("fs");
|
|
19
19
|
const path = require("path");
|
20
20
|
const defaultOptions = require("../../conf/default-cli-options");
|
21
21
|
const pkg = require("../../package.json");
|
22
|
-
const ConfigOps = require("
|
23
|
-
const naming = require("
|
22
|
+
const ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops");
|
23
|
+
const naming = require("@eslint/eslintrc/lib/shared/naming");
|
24
24
|
const ModuleResolver = require("../shared/relative-module-resolver");
|
25
25
|
const { Linter } = require("../linter");
|
26
26
|
const builtInRules = require("../rules");
|
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview `ConfigArray` class.
|
3
15
|
*
|
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview `ConfigDependency` class.
|
3
15
|
*
|
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview `ExtractedConfig` class.
|
3
15
|
*
|
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview `IgnorePattern` class.
|
3
15
|
*
|
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview `ConfigArray` class.
|
3
15
|
* @author Toru Nagashima <https://github.com/mysticatea>
|
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview `OverrideTester` class.
|
3
15
|
*
|
@@ -1,3 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* STOP!!! DO NOT MODIFY.
|
3
|
+
*
|
4
|
+
* This file is part of the ongoing work to move the eslintrc-style config
|
5
|
+
* system into the @eslint/eslintrc package. This file needs to remain
|
6
|
+
* unchanged in order for this work to proceed.
|
7
|
+
*
|
8
|
+
* If you think you need to change this file, please contact @nzakas first.
|
9
|
+
*
|
10
|
+
* Thanks in advance for your cooperation.
|
11
|
+
*/
|
12
|
+
|
1
13
|
/**
|
2
14
|
* @fileoverview The factory of `ConfigArray` objects.
|
3
15
|
*
|
@@ -44,7 +56,7 @@ const path = require("path");
|
|
44
56
|
const importFresh = require("import-fresh");
|
45
57
|
const stripComments = require("strip-json-comments");
|
46
58
|
const { validateConfigSchema } = require("../shared/config-validator");
|
47
|
-
const naming = require("
|
59
|
+
const naming = require("@eslint/eslintrc/lib/shared/naming");
|
48
60
|
const ModuleResolver = require("../shared/relative-module-resolver");
|
49
61
|
const {
|
50
62
|
ConfigArray,
|
@@ -42,8 +42,8 @@ module.exports = function(results) {
|
|
42
42
|
|
43
43
|
messages.forEach(message => {
|
44
44
|
output += [
|
45
|
-
`<error line="${xmlEscape(message.line)}"`,
|
46
|
-
`column="${xmlEscape(message.column)}"`,
|
45
|
+
`<error line="${xmlEscape(message.line || 0)}"`,
|
46
|
+
`column="${xmlEscape(message.column || 0)}"`,
|
47
47
|
`severity="${xmlEscape(getMessageType(message))}"`,
|
48
48
|
`message="${xmlEscape(message.message)}${message.ruleId ? ` (${message.ruleId})` : ""}"`,
|
49
49
|
`source="${message.ruleId ? xmlEscape(`eslint.rules.${message.ruleId}`) : ""}" />`
|
package/lib/eslint/eslint.js
CHANGED
@@ -15,7 +15,13 @@ const fs = require("fs");
|
|
15
15
|
const { promisify } = require("util");
|
16
16
|
const { CLIEngine, getCLIEngineInternalSlots } = require("../cli-engine/cli-engine");
|
17
17
|
const BuiltinRules = require("../rules");
|
18
|
-
const {
|
18
|
+
const {
|
19
|
+
Legacy: {
|
20
|
+
ConfigOps: {
|
21
|
+
getRuleSeverity
|
22
|
+
}
|
23
|
+
}
|
24
|
+
} = require("@eslint/eslintrc");
|
19
25
|
const { version } = require("../../package.json");
|
20
26
|
|
21
27
|
//------------------------------------------------------------------------------
|
package/lib/init/autoconfig.js
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
const lodash = require("lodash"),
|
13
13
|
recConfig = require("../../conf/eslint-recommended"),
|
14
|
-
ConfigOps = require("
|
14
|
+
ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"),
|
15
15
|
{ Linter } = require("../linter"),
|
16
16
|
configRule = require("./config-rule");
|
17
17
|
|
@@ -17,9 +17,9 @@ const util = require("util"),
|
|
17
17
|
semver = require("semver"),
|
18
18
|
espree = require("espree"),
|
19
19
|
recConfig = require("../../conf/eslint-recommended"),
|
20
|
-
ConfigOps = require("
|
20
|
+
ConfigOps = require("@eslint/eslintrc/lib/shared/config-ops"),
|
21
21
|
log = require("../shared/logging"),
|
22
|
-
naming = require("
|
22
|
+
naming = require("@eslint/eslintrc/lib/shared/naming"),
|
23
23
|
ModuleResolver = require("../shared/relative-module-resolver"),
|
24
24
|
autoconfig = require("./autoconfig.js"),
|
25
25
|
ConfigFile = require("./config-file"),
|
@@ -265,7 +265,7 @@ function processAnswers(answers) {
|
|
265
265
|
};
|
266
266
|
|
267
267
|
config.parserOptions.ecmaVersion = espree.latestEcmaVersion;
|
268
|
-
config.env.
|
268
|
+
config.env.es2021 = true;
|
269
269
|
|
270
270
|
// set the module type
|
271
271
|
if (answers.moduleType === "esm") {
|
@@ -39,6 +39,17 @@ function isHandledLogicalOperator(operator) {
|
|
39
39
|
return operator === "&&" || operator === "||" || operator === "??";
|
40
40
|
}
|
41
41
|
|
42
|
+
/**
|
43
|
+
* Checks whether the given assignment operator is a logical assignment operator.
|
44
|
+
* Logical assignments are taken into account for the code path analysis
|
45
|
+
* because of their short-circuiting semantics.
|
46
|
+
* @param {string} operator The operator found in the AssignmentExpression node
|
47
|
+
* @returns {boolean} `true` if the operator is "&&=" or "||=" or "??="
|
48
|
+
*/
|
49
|
+
function isLogicalAssignmentOperator(operator) {
|
50
|
+
return operator === "&&=" || operator === "||=" || operator === "??=";
|
51
|
+
}
|
52
|
+
|
42
53
|
/**
|
43
54
|
* Gets the label if the parent node of a given node is a LabeledStatement.
|
44
55
|
* @param {ASTNode} node A node to get.
|
@@ -71,6 +82,9 @@ function isForkingByTrueOrFalse(node) {
|
|
71
82
|
case "LogicalExpression":
|
72
83
|
return isHandledLogicalOperator(parent.operator);
|
73
84
|
|
85
|
+
case "AssignmentExpression":
|
86
|
+
return isLogicalAssignmentOperator(parent.operator);
|
87
|
+
|
74
88
|
default:
|
75
89
|
return false;
|
76
90
|
}
|
@@ -244,6 +258,19 @@ function preprocess(analyzer, node) {
|
|
244
258
|
const parent = node.parent;
|
245
259
|
|
246
260
|
switch (parent.type) {
|
261
|
+
|
262
|
+
// The `arguments.length == 0` case is in `postprocess` function.
|
263
|
+
case "CallExpression":
|
264
|
+
if (parent.optional === true && parent.arguments.length >= 1 && parent.arguments[0] === node) {
|
265
|
+
state.makeOptionalRight();
|
266
|
+
}
|
267
|
+
break;
|
268
|
+
case "MemberExpression":
|
269
|
+
if (parent.optional === true && parent.property === node) {
|
270
|
+
state.makeOptionalRight();
|
271
|
+
}
|
272
|
+
break;
|
273
|
+
|
247
274
|
case "LogicalExpression":
|
248
275
|
if (
|
249
276
|
parent.right === node &&
|
@@ -253,6 +280,15 @@ function preprocess(analyzer, node) {
|
|
253
280
|
}
|
254
281
|
break;
|
255
282
|
|
283
|
+
case "AssignmentExpression":
|
284
|
+
if (
|
285
|
+
parent.right === node &&
|
286
|
+
isLogicalAssignmentOperator(parent.operator)
|
287
|
+
) {
|
288
|
+
state.makeLogicalRight();
|
289
|
+
}
|
290
|
+
break;
|
291
|
+
|
256
292
|
case "ConditionalExpression":
|
257
293
|
case "IfStatement":
|
258
294
|
|
@@ -377,6 +413,20 @@ function processCodePathToEnter(analyzer, node) {
|
|
377
413
|
analyzer.emitter.emit("onCodePathStart", codePath, node);
|
378
414
|
break;
|
379
415
|
|
416
|
+
case "ChainExpression":
|
417
|
+
state.pushChainContext();
|
418
|
+
break;
|
419
|
+
case "CallExpression":
|
420
|
+
if (node.optional === true) {
|
421
|
+
state.makeOptionalNode();
|
422
|
+
}
|
423
|
+
break;
|
424
|
+
case "MemberExpression":
|
425
|
+
if (node.optional === true) {
|
426
|
+
state.makeOptionalNode();
|
427
|
+
}
|
428
|
+
break;
|
429
|
+
|
380
430
|
case "LogicalExpression":
|
381
431
|
if (isHandledLogicalOperator(node.operator)) {
|
382
432
|
state.pushChoiceContext(
|
@@ -386,6 +436,15 @@ function processCodePathToEnter(analyzer, node) {
|
|
386
436
|
}
|
387
437
|
break;
|
388
438
|
|
439
|
+
case "AssignmentExpression":
|
440
|
+
if (isLogicalAssignmentOperator(node.operator)) {
|
441
|
+
state.pushChoiceContext(
|
442
|
+
node.operator.slice(0, -1), // removes `=` from the end
|
443
|
+
isForkingByTrueOrFalse(node)
|
444
|
+
);
|
445
|
+
}
|
446
|
+
break;
|
447
|
+
|
389
448
|
case "ConditionalExpression":
|
390
449
|
case "IfStatement":
|
391
450
|
state.pushChoiceContext("test", false);
|
@@ -449,6 +508,10 @@ function processCodePathToExit(analyzer, node) {
|
|
449
508
|
let dontForward = false;
|
450
509
|
|
451
510
|
switch (node.type) {
|
511
|
+
case "ChainExpression":
|
512
|
+
state.popChainContext();
|
513
|
+
break;
|
514
|
+
|
452
515
|
case "IfStatement":
|
453
516
|
case "ConditionalExpression":
|
454
517
|
state.popChoiceContext();
|
@@ -460,6 +523,12 @@ function processCodePathToExit(analyzer, node) {
|
|
460
523
|
}
|
461
524
|
break;
|
462
525
|
|
526
|
+
case "AssignmentExpression":
|
527
|
+
if (isLogicalAssignmentOperator(node.operator)) {
|
528
|
+
state.popChoiceContext();
|
529
|
+
}
|
530
|
+
break;
|
531
|
+
|
463
532
|
case "SwitchStatement":
|
464
533
|
state.popSwitchContext();
|
465
534
|
break;
|
@@ -583,6 +652,13 @@ function postprocess(analyzer, node) {
|
|
583
652
|
break;
|
584
653
|
}
|
585
654
|
|
655
|
+
// The `arguments.length >= 1` case is in `preprocess` function.
|
656
|
+
case "CallExpression":
|
657
|
+
if (node.optional === true && node.arguments.length === 0) {
|
658
|
+
CodePath.getState(analyzer.codePath).makeOptionalRight();
|
659
|
+
}
|
660
|
+
break;
|
661
|
+
|
586
662
|
default:
|
587
663
|
break;
|
588
664
|
}
|