eslint 7.3.1 → 7.7.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.
Files changed (73) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +28 -16
  3. package/lib/cli-engine/config-array-factory.js +1 -33
  4. package/lib/cli-engine/formatters/checkstyle.js +2 -2
  5. package/lib/linter/code-path-analysis/code-path-analyzer.js +38 -0
  6. package/lib/linter/code-path-analysis/code-path-segment.js +0 -1
  7. package/lib/linter/code-path-analysis/code-path-state.js +59 -0
  8. package/lib/linter/code-path-analysis/debug-helpers.js +26 -19
  9. package/lib/rule-tester/rule-tester.js +10 -0
  10. package/lib/rules/accessor-pairs.js +1 -14
  11. package/lib/rules/array-callback-return.js +26 -17
  12. package/lib/rules/arrow-body-style.js +43 -8
  13. package/lib/rules/arrow-parens.js +91 -108
  14. package/lib/rules/camelcase.js +47 -0
  15. package/lib/rules/comma-dangle.js +1 -2
  16. package/lib/rules/consistent-return.js +1 -12
  17. package/lib/rules/constructor-super.js +1 -0
  18. package/lib/rules/dot-location.js +20 -14
  19. package/lib/rules/dot-notation.js +36 -33
  20. package/lib/rules/func-call-spacing.js +42 -6
  21. package/lib/rules/func-name-matching.js +1 -4
  22. package/lib/rules/global-require.js +2 -1
  23. package/lib/rules/id-blacklist.js +14 -11
  24. package/lib/rules/id-denylist.js +230 -0
  25. package/lib/rules/indent.js +23 -3
  26. package/lib/rules/index.js +1 -0
  27. package/lib/rules/keyword-spacing.js +2 -2
  28. package/lib/rules/max-len.js +13 -2
  29. package/lib/rules/new-cap.js +10 -14
  30. package/lib/rules/newline-per-chained-call.js +15 -5
  31. package/lib/rules/no-alert.js +10 -3
  32. package/lib/rules/no-duplicate-case.js +23 -4
  33. package/lib/rules/no-eval.js +8 -38
  34. package/lib/rules/no-extend-native.js +37 -40
  35. package/lib/rules/no-extra-bind.js +57 -17
  36. package/lib/rules/no-extra-boolean-cast.js +7 -0
  37. package/lib/rules/no-extra-parens.js +48 -10
  38. package/lib/rules/no-implicit-coercion.js +11 -6
  39. package/lib/rules/no-implied-eval.js +7 -28
  40. package/lib/rules/no-import-assign.js +33 -32
  41. package/lib/rules/no-irregular-whitespace.js +22 -12
  42. package/lib/rules/no-magic-numbers.js +4 -8
  43. package/lib/rules/no-obj-calls.js +7 -4
  44. package/lib/rules/no-prototype-builtins.js +13 -3
  45. package/lib/rules/no-self-assign.js +3 -53
  46. package/lib/rules/no-setter-return.js +5 -8
  47. package/lib/rules/no-underscore-dangle.js +66 -21
  48. package/lib/rules/no-unexpected-multiline.js +2 -2
  49. package/lib/rules/no-unneeded-ternary.js +0 -2
  50. package/lib/rules/no-unused-expressions.js +55 -23
  51. package/lib/rules/no-useless-call.js +10 -7
  52. package/lib/rules/no-whitespace-before-property.js +16 -4
  53. package/lib/rules/object-curly-newline.js +4 -4
  54. package/lib/rules/operator-assignment.js +3 -42
  55. package/lib/rules/padding-line-between-statements.js +2 -2
  56. package/lib/rules/prefer-arrow-callback.js +90 -25
  57. package/lib/rules/prefer-exponentiation-operator.js +1 -1
  58. package/lib/rules/prefer-numeric-literals.js +4 -13
  59. package/lib/rules/prefer-promise-reject-errors.js +1 -3
  60. package/lib/rules/prefer-regex-literals.js +68 -13
  61. package/lib/rules/prefer-spread.js +2 -6
  62. package/lib/rules/radix.js +5 -2
  63. package/lib/rules/sort-imports.js +28 -0
  64. package/lib/rules/use-isnan.js +1 -1
  65. package/lib/rules/utils/ast-utils.js +317 -153
  66. package/lib/rules/wrap-iife.js +9 -2
  67. package/lib/rules/yoda.js +2 -55
  68. package/messages/extend-config-missing.txt +1 -1
  69. package/messages/no-config-found.txt +1 -1
  70. package/messages/plugin-conflict.txt +1 -1
  71. package/messages/plugin-missing.txt +1 -1
  72. package/messages/whitespace-found.txt +1 -1
  73. package/package.json +6 -7
package/CHANGELOG.md CHANGED
@@ -1,6 +1,85 @@
1
+ v7.7.0 - August 14, 2020
2
+
3
+ * [`b46f3ee`](https://github.com/eslint/eslint/commit/b46f3ee0dae4add9df99cae940b641ad8de58b9e) Update: allowFunctionParams option in no-underscore-dangle (fixes 12579) (#13545) (Sunghyun Cho)
4
+ * [`26aa245`](https://github.com/eslint/eslint/commit/26aa2452b5f407fabc25dad21182180e4d3be532) Docs: clarify "case" specifier in padding-line-between-statements (#13562) (Milos Djermanovic)
5
+ * [`082891c`](https://github.com/eslint/eslint/commit/082891c042d72953fe86cd3ce9c96e661760793d) Docs: Update semantic versioning policy (#13563) (Nicholas C. Zakas)
6
+ * [`4e0b672`](https://github.com/eslint/eslint/commit/4e0b672eb4bf39f7502a550b08b25a56a196f19f) Fix: revert "Update: disallow multiple options in comma-dangle schema" (#13564) (Kai Cataldo)
7
+ * [`254990e`](https://github.com/eslint/eslint/commit/254990e87914457ca25ea2d7ee012964e56fc9e5) Fix: indent for async arrow functions (fixes #13497) (#13544) (Anix)
8
+ * [`28ca339`](https://github.com/eslint/eslint/commit/28ca339259b07c96c73f2ef28cbf112b96395855) Sponsors: Sync README with website (ESLint Jenkins)
9
+ * [`2e4158d`](https://github.com/eslint/eslint/commit/2e4158d3ec9cfed6400bf70795fd7171e96ff9b3) Sponsors: Sync README with website (ESLint Jenkins)
10
+ * [`488d159`](https://github.com/eslint/eslint/commit/488d1595aef43c4d52cccdb2c97977884f0375a8) Sponsors: Sync README with website (ESLint Jenkins)
11
+ * [`c44306e`](https://github.com/eslint/eslint/commit/c44306e52778309a79232ceab8b55a9aa0f2dfda) Sponsors: Sync README with website (ESLint Jenkins)
12
+ * [`6677180`](https://github.com/eslint/eslint/commit/6677180495e16a02d150d0552e7e5d5f6b77fcc5) Sponsors: Sync README with website (ESLint Jenkins)
13
+ * [`07db7b8`](https://github.com/eslint/eslint/commit/07db7b8080c2f68ee28e7d447db356c33e6fddce) Sponsors: Sync README with website (ESLint Jenkins)
14
+ * [`d4ce4d3`](https://github.com/eslint/eslint/commit/d4ce4d3b8492c3e4654ed1f51f2c48e6c0ad272f) Sponsors: Sync README with website (ESLint Jenkins)
15
+ * [`284e954`](https://github.com/eslint/eslint/commit/284e954f93126c50e0aa9b88f42afb03a47ad967) Sponsors: Sync README with website (ESLint Jenkins)
16
+ * [`ae9b54e`](https://github.com/eslint/eslint/commit/ae9b54e59b01aa9f50ee31f5b6787d86e6b59de6) Sponsors: Sync README with website (ESLint Jenkins)
17
+ * [`9124a15`](https://github.com/eslint/eslint/commit/9124a1599638a1caf4b7e252d1cb66abdc5e51c6) Chore: remove leche (fixes #13287) (#13533) (Mark de Dios)
18
+ * [`5c4c7f5`](https://github.com/eslint/eslint/commit/5c4c7f515c2e8e83f2186a66ddce75d6477abeb0) Sponsors: Sync README with website (ESLint Jenkins)
19
+ * [`48d8ec8`](https://github.com/eslint/eslint/commit/48d8ec8cf320c69aed17c6b6c78f19e7c1e587ca) Sponsors: Sync README with website (ESLint Jenkins)
20
+
21
+ v7.6.0 - July 31, 2020
22
+
23
+ * [`ecb2b73`](https://github.com/eslint/eslint/commit/ecb2b7343a0d14fb57d297a16be6c1b176fb3dbf) Update: require `meta` for fixable rules in RuleTester (refs #13349) (#13489) (Milos Djermanovic)
24
+ * [`6fb4edd`](https://github.com/eslint/eslint/commit/6fb4edde3b7a7ae2faf8ac956a7342fbf80865fc) Docs: fix broken links in developer guide (#13518) (Sam Chen)
25
+ * [`318fe10`](https://github.com/eslint/eslint/commit/318fe103dbf2548eee293ff456ef0b829dbe3db3) Fix: Do not output `undefined` as line and column when it's unavailable (#13519) (haya14busa)
26
+ * [`493b5b4`](https://github.com/eslint/eslint/commit/493b5b40cae7a076fdeb19740f8c88fb4ae9c1fb) Sponsors: Sync README with website (ESLint Jenkins)
27
+ * [`f100143`](https://github.com/eslint/eslint/commit/f100143fa5f529aacb2b50e650a00d2697ca4c54) Sponsors: Sync README with website (ESLint Jenkins)
28
+ * [`16b10fe`](https://github.com/eslint/eslint/commit/16b10fe8ba3c78939d5ada4a25caf2f0c9e6a058) Fix: Update the chatroom link to go directly to help channel (#13536) (Nicholas C. Zakas)
29
+ * [`f937eb9`](https://github.com/eslint/eslint/commit/f937eb95407f60d3772bcb956e227aaf99e48777) Sponsors: Sync README with website (ESLint Jenkins)
30
+ * [`e71e298`](https://github.com/eslint/eslint/commit/e71e2980cd2e319afc70d8c859c7ffd59cf4157b) Update: Change no-duplicate-case to comparing tokens (fixes #13485) (#13494) (Yosuke Ota)
31
+ * [`6c4aea4`](https://github.com/eslint/eslint/commit/6c4aea44fd78e1eecea5fe3c37e1921e3b1e98a6) Docs: add ECMAScript 2020 to README (#13510) (Milos Djermanovic)
32
+
33
+ v7.5.0 - July 18, 2020
34
+
35
+ * [`6ea3178`](https://github.com/eslint/eslint/commit/6ea3178776eae0e40c3f5498893e8aab0e23686b) Update: optional chaining support (fixes #12642) (#13416) (Toru Nagashima)
36
+ * [`540b1af`](https://github.com/eslint/eslint/commit/540b1af77278ae649b621aa8d4bf8d6de03c3155) Chore: enable consistent-meta-messages internal rule (#13487) (Milos Djermanovic)
37
+ * [`885a145`](https://github.com/eslint/eslint/commit/885a1455691265db88dc0befe9b48a69d69e8b9c) Docs: clarify behavior if `meta.fixable` is omitted (refs #13349) (#13493) (Milos Djermanovic)
38
+ * [`1a01b42`](https://github.com/eslint/eslint/commit/1a01b420eaab0de03dab5cc190a9f2a860c21a84) Docs: Update technology sponsors in README (#13478) (Nicholas C. Zakas)
39
+ * [`6ed9e8e`](https://github.com/eslint/eslint/commit/6ed9e8e4ff038c0259b0e7fe7ab7f4fd4ec55801) Upgrade: lodash@4.17.19 (#13499) (Yohan Siguret)
40
+ * [`45cdf00`](https://github.com/eslint/eslint/commit/45cdf00da6aeff3d584d37b0710fc8d6ad9456d6) Sponsors: Sync README with website (ESLint Jenkins)
41
+ * [`f1cc725`](https://github.com/eslint/eslint/commit/f1cc725ba1b8646dcf06a83716d96ad9bb726172) Docs: fix linebreaks between versions in changelog (#13488) (Milos Djermanovic)
42
+ * [`f4d7b9e`](https://github.com/eslint/eslint/commit/f4d7b9e1a599346b2f21ff9de003b311b51411e6) Update: deprecate id-blacklist rule (#13465) (Dimitri Mitropoulos)
43
+ * [`e14a645`](https://github.com/eslint/eslint/commit/e14a645aa495558081490f990ba221e21aa6b27c) Chore: use espree.latestEcmaVersion in fuzzer (#13484) (Milos Djermanovic)
44
+ * [`61097fe`](https://github.com/eslint/eslint/commit/61097fe5cc275d414a0c8e19b31c6060cb5568b7) Docs: Update int rule level to string (#13483) (Brandon Mills)
45
+ * [`c8f9c82`](https://github.com/eslint/eslint/commit/c8f9c8210cf4b9da8f07922093d7b219abad9f10) Update: Improve report location no-irregular-whitespace (refs #12334) (#13462) (Milos Djermanovic)
46
+ * [`f2e68ec`](https://github.com/eslint/eslint/commit/f2e68ec1d6cee6299e8a5cdf76c522c11d3008dd) Build: update webpack resolve.mainFields to match website config (#13457) (Milos Djermanovic)
47
+ * [`a96bc5e`](https://github.com/eslint/eslint/commit/a96bc5ec06f3a48bfe458bccd68d4d3b2a280ed9) Fix: arrow-body-style fixer for `in` wrap (fixes #11849) (#13228) (Anix)
48
+ * [`748734f`](https://github.com/eslint/eslint/commit/748734fdd497fbf61f3a616ff4a09169135b9396) Upgrade: Updated puppeteer version to v4.0.0 (#13444) (odidev)
49
+ * [`e951457`](https://github.com/eslint/eslint/commit/e951457b7aaa1b12b135588d36e3f4db4d7b8463) Docs: fix wording in configuring.md (#13469) (Piper)
50
+ * [`0af1d28`](https://github.com/eslint/eslint/commit/0af1d2828d27885483737867653ba1659af72005) Update: add allowSeparatedGroups option to sort-imports (fixes #12951) (#13455) (Milos Djermanovic)
51
+ * [`1050ee7`](https://github.com/eslint/eslint/commit/1050ee78a95da9484ff333dc1c74dac64c05da6f) Update: Improve report location for no-unneeded-ternary (refs #12334) (#13456) (Milos Djermanovic)
52
+ * [`b77b420`](https://github.com/eslint/eslint/commit/b77b4202bd1d5d1306f6f645e88d7a41a51715db) Update: Improve report location for max-len (refs #12334) (#13458) (Milos Djermanovic)
53
+ * [`095194c`](https://github.com/eslint/eslint/commit/095194c0fc0eb02aa69fde6b4280696e0e4de214) Fix: add end location to reports in object-curly-newline (refs #12334) (#13460) (Milos Djermanovic)
54
+ * [`10251bb`](https://github.com/eslint/eslint/commit/10251bbaeba80ac15244f385fc42cf2f2a30e5d2) Fix: add end location to reports in keyword-spacing (refs #12334) (#13461) (Milos Djermanovic)
55
+ * [`2ea7ee5`](https://github.com/eslint/eslint/commit/2ea7ee51a4e05ee76a6dae5954c3b6263b0970a3) Sponsors: Sync README with website (ESLint Jenkins)
56
+ * [`b55fd3b`](https://github.com/eslint/eslint/commit/b55fd3b8c05a29a465a794a524b06c1a28cddf0c) Sponsors: Sync README with website (ESLint Jenkins)
57
+
58
+ v7.4.0 - July 3, 2020
59
+
60
+ * [`f21bad2`](https://github.com/eslint/eslint/commit/f21bad2680406a2671b877f8dba47f4475d0cc64) Docs: fix description for `never` in multiline-ternary (fixes #13368) (#13452) (Milos Djermanovic)
61
+ * [`ada2c89`](https://github.com/eslint/eslint/commit/ada2c891298382f82dfabf37cacd59a1057b2bb7) Fix: support typescript generics in arrow-parens (fixes #12570) (#13451) (Milos Djermanovic)
62
+ * [`89ee01e`](https://github.com/eslint/eslint/commit/89ee01e083f1e02293bf8d1447f9b0fdb3cb9384) Fix: Revert config cloning (fixes #13447) (#13449) (薛定谔的猫)
63
+ * [`0a463db`](https://github.com/eslint/eslint/commit/0a463dbf7cc5a77d442879c9117204d4d38db972) Docs: fix no-multiple-empty-lines examples (fixes #13432) (#13433) (Milos Djermanovic)
64
+ * [`ff5317e`](https://github.com/eslint/eslint/commit/ff5317e93425f93cfdf808609551ee67b2032543) Update: Improve array-callback-return report message (#13395) (Philip (flip) Kromer)
65
+ * [`3f51930`](https://github.com/eslint/eslint/commit/3f51930eea7cddc921a9ee3cb0328c7b649c0f83) Fix: false positive new with member in no-extra-parens (fixes #12740) (#13375) (YeonJuan)
66
+ * [`825a5b9`](https://github.com/eslint/eslint/commit/825a5b98d3d84f6eb72b75f7d8519de763cc8898) Fix: Clarify documentation on implicit ignore behavior (fixes #12348) (#12600) (Scott Hardin)
67
+ * [`c139156`](https://github.com/eslint/eslint/commit/c1391566a5f765f25716527de7b5cdee16c0ce36) Sponsors: Sync README with website (ESLint Jenkins)
68
+ * [`0c17e9d`](https://github.com/eslint/eslint/commit/0c17e9d2ac307cc288eea6ed7971bd5a7d33321a) Sponsors: Sync README with website (ESLint Jenkins)
69
+ * [`c680387`](https://github.com/eslint/eslint/commit/c680387ba61f6dccf0390d24a85d871fa83e9fea) Sponsors: Sync README with website (ESLint Jenkins)
70
+ * [`bf3939b`](https://github.com/eslint/eslint/commit/bf3939bbd9a33d0eb96cebe6a53bf61c855f9ba6) Sponsors: Sync README with website (ESLint Jenkins)
71
+ * [`7baf02e`](https://github.com/eslint/eslint/commit/7baf02e983af909800261263f125cca901a5bd0f) Sponsors: Sync README with website (ESLint Jenkins)
72
+ * [`5c4c3fd`](https://github.com/eslint/eslint/commit/5c4c3fdfbda18a13223ad36f44283adbfee8c496) Sponsors: Sync README with website (ESLint Jenkins)
73
+ * [`53912aa`](https://github.com/eslint/eslint/commit/53912aab1856327b399cca26cbb2ba81fd01bfa2) Sponsors: Sync README with website (ESLint Jenkins)
74
+ * [`51e42ec`](https://github.com/eslint/eslint/commit/51e42eca3e87d8259815d736ffe81e604f184057) Update: Add option "ignoreGlobals" to camelcase rule (fixes #11716) (#12782) (David Gasperoni)
75
+ * [`0655f66`](https://github.com/eslint/eslint/commit/0655f66525d167ca1288167b79a77087cfc8fcf6) Update: improve report location in arrow-body-style (refs #12334) (#13424) (YeonJuan)
76
+ * [`d53d69a`](https://github.com/eslint/eslint/commit/d53d69af08cfe55f42e0a0ca725b1014dabccc21) Update: prefer-regex-literal detect regex literals (fixes #12840) (#12842) (Mathias Schreck)
77
+ * [`004adae`](https://github.com/eslint/eslint/commit/004adae3f959414f56e44e5884f6221e9dcda142) Update: rename id-blacklist to id-denylist (fixes #13407) (#13408) (Kai Cataldo)
78
+
1
79
  v7.3.1 - June 22, 2020
2
80
 
3
81
  * [`de77c11`](https://github.com/eslint/eslint/commit/de77c11e7515f2097ff355ddc0d7b6db9c83c892) Fix: Replace Infinity with Number.MAX_SAFE_INTEGER (fixes #13427) (#13435) (Nicholas C. Zakas)
82
+
4
83
  v7.3.0 - June 19, 2020
5
84
 
6
85
  * [`638a6d6`](https://github.com/eslint/eslint/commit/638a6d6be18b4a37cfdc7223e1f5acd3718694be) Update: add missing `additionalProperties: false` to some rules' schema (#13198) (Milos Djermanovic)
@@ -25,6 +104,7 @@ v7.3.0 - June 19, 2020
25
104
  * [`0f1f5ed`](https://github.com/eslint/eslint/commit/0f1f5ed2a20b8fb575d4360316861cf4c2b9b7bc) Docs: Add security policy link to README (#13403) (Nicholas C. Zakas)
26
105
  * [`9e9ba89`](https://github.com/eslint/eslint/commit/9e9ba897c566601cfe90522099c635ea316b235f) Sponsors: Sync README with website (ESLint Jenkins)
27
106
  * [`ca59fb9`](https://github.com/eslint/eslint/commit/ca59fb95a395c0a02ed23768a70e086480ab1f6d) Sponsors: Sync README with website (ESLint Jenkins)
107
+
28
108
  v7.2.0 - June 5, 2020
29
109
 
30
110
  * [`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 2019. 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).
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.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>
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>
258
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></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>
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://nettikasinolista.com"><img src="https://images.opencollective.com/nettikasinolista/fd361ee/logo.png" alt="Nettikasinolista.com" 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="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://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>
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)
@@ -697,38 +697,6 @@ 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
-
732
700
  // Flatten `extends`.
733
701
  for (const extendName of extendList.filter(Boolean)) {
734
702
  yield* this._loadExtends(extendName, ctx);
@@ -763,7 +731,7 @@ class ConfigArrayFactory {
763
731
  processor,
764
732
  reportUnusedDisableDirectives,
765
733
  root,
766
- rules: clonedRulesConfig,
734
+ rules,
767
735
  settings
768
736
  };
769
737
 
@@ -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}`) : ""}" />`
@@ -244,6 +244,19 @@ function preprocess(analyzer, node) {
244
244
  const parent = node.parent;
245
245
 
246
246
  switch (parent.type) {
247
+
248
+ // The `arguments.length == 0` case is in `postprocess` function.
249
+ case "CallExpression":
250
+ if (parent.optional === true && parent.arguments.length >= 1 && parent.arguments[0] === node) {
251
+ state.makeOptionalRight();
252
+ }
253
+ break;
254
+ case "MemberExpression":
255
+ if (parent.optional === true && parent.property === node) {
256
+ state.makeOptionalRight();
257
+ }
258
+ break;
259
+
247
260
  case "LogicalExpression":
248
261
  if (
249
262
  parent.right === node &&
@@ -377,6 +390,20 @@ function processCodePathToEnter(analyzer, node) {
377
390
  analyzer.emitter.emit("onCodePathStart", codePath, node);
378
391
  break;
379
392
 
393
+ case "ChainExpression":
394
+ state.pushChainContext();
395
+ break;
396
+ case "CallExpression":
397
+ if (node.optional === true) {
398
+ state.makeOptionalNode();
399
+ }
400
+ break;
401
+ case "MemberExpression":
402
+ if (node.optional === true) {
403
+ state.makeOptionalNode();
404
+ }
405
+ break;
406
+
380
407
  case "LogicalExpression":
381
408
  if (isHandledLogicalOperator(node.operator)) {
382
409
  state.pushChoiceContext(
@@ -449,6 +476,10 @@ function processCodePathToExit(analyzer, node) {
449
476
  let dontForward = false;
450
477
 
451
478
  switch (node.type) {
479
+ case "ChainExpression":
480
+ state.popChainContext();
481
+ break;
482
+
452
483
  case "IfStatement":
453
484
  case "ConditionalExpression":
454
485
  state.popChoiceContext();
@@ -583,6 +614,13 @@ function postprocess(analyzer, node) {
583
614
  break;
584
615
  }
585
616
 
617
+ // The `arguments.length >= 1` case is in `preprocess` function.
618
+ case "CallExpression":
619
+ if (node.optional === true && node.arguments.length === 0) {
620
+ CodePath.getState(analyzer.codePath).makeOptionalRight();
621
+ }
622
+ break;
623
+
586
624
  default:
587
625
  break;
588
626
  }
@@ -92,7 +92,6 @@ class CodePathSegment {
92
92
  /* istanbul ignore if */
93
93
  if (debug.enabled) {
94
94
  this.internal.nodes = [];
95
- this.internal.exitNodes = [];
96
95
  }
97
96
  }
98
97
 
@@ -234,6 +234,7 @@ class CodePathState {
234
234
  this.tryContext = null;
235
235
  this.loopContext = null;
236
236
  this.breakContext = null;
237
+ this.chainContext = null;
237
238
 
238
239
  this.currentSegments = [];
239
240
  this.initialSegment = this.forkContext.head[0];
@@ -555,6 +556,64 @@ class CodePathState {
555
556
  );
556
557
  }
557
558
 
559
+ //--------------------------------------------------------------------------
560
+ // ChainExpression
561
+ //--------------------------------------------------------------------------
562
+
563
+ /**
564
+ * Push a new `ChainExpression` context to the stack.
565
+ * This method is called on entering to each `ChainExpression` node.
566
+ * This context is used to count forking in the optional chain then merge them on the exiting from the `ChainExpression` node.
567
+ * @returns {void}
568
+ */
569
+ pushChainContext() {
570
+ this.chainContext = {
571
+ upper: this.chainContext,
572
+ countChoiceContexts: 0
573
+ };
574
+ }
575
+
576
+ /**
577
+ * Pop a `ChainExpression` context from the stack.
578
+ * This method is called on exiting from each `ChainExpression` node.
579
+ * This merges all forks of the last optional chaining.
580
+ * @returns {void}
581
+ */
582
+ popChainContext() {
583
+ const context = this.chainContext;
584
+
585
+ this.chainContext = context.upper;
586
+
587
+ // pop all choice contexts of this.
588
+ for (let i = context.countChoiceContexts; i > 0; --i) {
589
+ this.popChoiceContext();
590
+ }
591
+ }
592
+
593
+ /**
594
+ * Create a choice context for optional access.
595
+ * This method is called on entering to each `(Call|Member)Expression[optional=true]` node.
596
+ * This creates a choice context as similar to `LogicalExpression[operator="??"]` node.
597
+ * @returns {void}
598
+ */
599
+ makeOptionalNode() {
600
+ if (this.chainContext) {
601
+ this.chainContext.countChoiceContexts += 1;
602
+ this.pushChoiceContext("??", false);
603
+ }
604
+ }
605
+
606
+ /**
607
+ * Create a fork.
608
+ * This method is called on entering to the `arguments|property` property of each `(Call|Member)Expression` node.
609
+ * @returns {void}
610
+ */
611
+ makeOptionalRight() {
612
+ if (this.chainContext) {
613
+ this.makeLogicalRight();
614
+ }
615
+ }
616
+
558
617
  //--------------------------------------------------------------------------
559
618
  // SwitchStatement
560
619
  //--------------------------------------------------------------------------
@@ -25,6 +25,22 @@ function getId(segment) { // eslint-disable-line jsdoc/require-jsdoc
25
25
  return segment.id + (segment.reachable ? "" : "!");
26
26
  }
27
27
 
28
+ /**
29
+ * Get string for the given node and operation.
30
+ * @param {ASTNode} node The node to convert.
31
+ * @param {"enter" | "exit" | undefined} label The operation label.
32
+ * @returns {string} The string representation.
33
+ */
34
+ function nodeToString(node, label) {
35
+ const suffix = label ? `:${label}` : "";
36
+
37
+ switch (node.type) {
38
+ case "Identifier": return `${node.type}${suffix} (${node.name})`;
39
+ case "Literal": return `${node.type}${suffix} (${node.value})`;
40
+ default: return `${node.type}${suffix}`;
41
+ }
42
+ }
43
+
28
44
  //------------------------------------------------------------------------------
29
45
  // Public Interface
30
46
  //------------------------------------------------------------------------------
@@ -56,9 +72,15 @@ module.exports = {
56
72
  const segInternal = state.currentSegments[i].internal;
57
73
 
58
74
  if (leaving) {
59
- segInternal.exitNodes.push(node);
75
+ const last = segInternal.nodes.length - 1;
76
+
77
+ if (last >= 0 && segInternal.nodes[last] === nodeToString(node, "enter")) {
78
+ segInternal.nodes[last] = nodeToString(node, void 0);
79
+ } else {
80
+ segInternal.nodes.push(nodeToString(node, "exit"));
81
+ }
60
82
  } else {
61
- segInternal.nodes.push(node);
83
+ segInternal.nodes.push(nodeToString(node, "enter"));
62
84
  }
63
85
  }
64
86
 
@@ -104,23 +126,8 @@ module.exports = {
104
126
  text += "style=\"rounded,dashed,filled\",fillcolor=\"#FF9800\",label=\"<<unreachable>>\\n";
105
127
  }
106
128
 
107
- if (segment.internal.nodes.length > 0 || segment.internal.exitNodes.length > 0) {
108
- text += [].concat(
109
- segment.internal.nodes.map(node => {
110
- switch (node.type) {
111
- case "Identifier": return `${node.type} (${node.name})`;
112
- case "Literal": return `${node.type} (${node.value})`;
113
- default: return node.type;
114
- }
115
- }),
116
- segment.internal.exitNodes.map(node => {
117
- switch (node.type) {
118
- case "Identifier": return `${node.type}:exit (${node.name})`;
119
- case "Literal": return `${node.type}:exit (${node.value})`;
120
- default: return `${node.type}:exit`;
121
- }
122
- })
123
- ).join("\\n");
129
+ if (segment.internal.nodes.length > 0) {
130
+ text += segment.internal.nodes.join("\\n");
124
131
  } else {
125
132
  text += "????";
126
133
  }
@@ -861,6 +861,16 @@ class RuleTester {
861
861
  );
862
862
  }
863
863
 
864
+ // Rules that produce fixes must have `meta.fixable` property.
865
+ if (result.output !== item.code) {
866
+ assert.ok(
867
+ hasOwnProperty(rule, "meta"),
868
+ "Fixable rules should export a `meta.fixable` property."
869
+ );
870
+
871
+ // Linter throws if a rule that produced a fix has `meta` but doesn't have `meta.fixable`.
872
+ }
873
+
864
874
  assertASTDidntChange(result.beforeAST, result.afterAST);
865
875
  }
866
876
 
@@ -86,16 +86,6 @@ function isAccessorKind(node) {
86
86
  return node.kind === "get" || node.kind === "set";
87
87
  }
88
88
 
89
- /**
90
- * Checks whether or not a given node is an `Identifier` node which was named a given name.
91
- * @param {ASTNode} node A node to check.
92
- * @param {string} name An expected name of the node.
93
- * @returns {boolean} `true` if the node is an `Identifier` node which was named as expected.
94
- */
95
- function isIdentifier(node, name) {
96
- return node.type === "Identifier" && node.name === name;
97
- }
98
-
99
89
  /**
100
90
  * Checks whether or not a given node is an argument of a specified method call.
101
91
  * @param {ASTNode} node A node to check.
@@ -109,10 +99,7 @@ function isArgumentOfMethodCall(node, index, object, property) {
109
99
 
110
100
  return (
111
101
  parent.type === "CallExpression" &&
112
- parent.callee.type === "MemberExpression" &&
113
- parent.callee.computed === false &&
114
- isIdentifier(parent.callee.object, object) &&
115
- isIdentifier(parent.callee.property, property) &&
102
+ astUtils.isSpecificMemberAccess(parent.callee, object, property) &&
116
103
  parent.arguments[index] === node
117
104
  );
118
105
  }