eslint 6.2.2 → 6.5.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 +91 -0
- package/README.md +9 -8
- package/bin/eslint.js +38 -12
- package/conf/config-schema.js +1 -0
- package/conf/default-cli-options.js +1 -1
- package/lib/cli-engine/cli-engine.js +2 -4
- package/lib/cli-engine/config-array/config-array.js +6 -0
- package/lib/cli-engine/config-array/extracted-config.js +6 -0
- package/lib/cli-engine/config-array/override-tester.js +2 -2
- package/lib/cli-engine/config-array-factory.js +2 -0
- package/lib/cli-engine/formatters/stylish.js +2 -1
- package/lib/cli-engine/ignored-paths.js +3 -3
- package/lib/cli-engine/lint-result-cache.js +0 -1
- package/lib/cli.js +13 -12
- package/lib/init/config-initializer.js +29 -0
- package/lib/init/config-rule.js +2 -2
- package/lib/init/npm-utils.js +9 -9
- package/lib/linter/apply-disable-directives.js +17 -9
- package/lib/linter/code-path-analysis/debug-helpers.js +1 -1
- package/lib/linter/linter.js +23 -4
- package/lib/options.js +7 -1
- package/lib/rule-tester/rule-tester.js +1 -2
- package/lib/rules/accessor-pairs.js +51 -11
- package/lib/rules/capitalized-comments.js +2 -2
- package/lib/rules/computed-property-spacing.js +18 -1
- package/lib/rules/default-param-last.js +61 -0
- package/lib/rules/eqeqeq.js +7 -19
- package/lib/rules/func-name-matching.js +1 -0
- package/lib/rules/function-paren-newline.js +2 -2
- package/lib/rules/indent-legacy.js +1 -1
- package/lib/rules/indent.js +44 -6
- package/lib/rules/index.js +3 -0
- package/lib/rules/new-parens.js +5 -1
- package/lib/rules/no-extra-bind.js +7 -1
- package/lib/rules/no-extra-boolean-cast.js +12 -2
- package/lib/rules/no-extra-label.js +9 -1
- package/lib/rules/no-extra-parens.js +23 -3
- package/lib/rules/no-import-assign.js +238 -0
- package/lib/rules/no-lone-blocks.js +6 -1
- package/lib/rules/no-obj-calls.js +29 -9
- package/lib/rules/no-octal-escape.js +14 -8
- package/lib/rules/no-regex-spaces.js +106 -45
- package/lib/rules/no-self-assign.js +17 -6
- package/lib/rules/no-sequences.js +2 -2
- package/lib/rules/no-undef-init.js +7 -1
- package/lib/rules/no-unsafe-negation.js +2 -10
- package/lib/rules/no-useless-rename.js +25 -13
- package/lib/rules/no-useless-return.js +3 -2
- package/lib/rules/object-curly-spacing.js +1 -1
- package/lib/rules/object-shorthand.js +35 -9
- package/lib/rules/prefer-named-capture-group.js +3 -15
- package/lib/rules/prefer-numeric-literals.js +4 -0
- package/lib/rules/prefer-regex-literals.js +125 -0
- package/lib/rules/quotes.js +6 -0
- package/lib/rules/space-before-function-paren.js +12 -1
- package/lib/rules/space-in-parens.js +77 -71
- package/lib/rules/use-isnan.js +67 -6
- package/lib/rules/yoda.js +11 -2
- package/lib/shared/logging.js +2 -0
- package/lib/shared/runtime-info.js +163 -0
- package/lib/shared/types.js +2 -0
- package/lib/source-code/source-code.js +3 -4
- package/package.json +3 -1
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,94 @@
|
|
1
|
+
v6.5.1 - September 30, 2019
|
2
|
+
|
3
|
+
* [`0d3d7d9`](https://github.com/eslint/eslint/commit/0d3d7d9cdd83a7f0e035c95f716a91b9ecc4868b) Docs: fix typo in no-magic-numbers (#12345) (Josiah Rooney)
|
4
|
+
* [`447ac87`](https://github.com/eslint/eslint/commit/447ac877e8ca2858d61b1e983f72d39e3e2ca74d) Fix: no-useless-rename handles ExperimentalRestProperty (fixes #12335) (#12339) (Kai Cataldo)
|
5
|
+
* [`b6ff73c`](https://github.com/eslint/eslint/commit/b6ff73cad13282fbfc91186cf4bc2f20278a8936) Sponsors: Sync README with website (ESLint Jenkins)
|
6
|
+
|
7
|
+
v6.5.0 - September 29, 2019
|
8
|
+
|
9
|
+
* [`73596cb`](https://github.com/eslint/eslint/commit/73596cbdf0a12e2878b2994783f9b969b0c5fbeb) Update: Add enforceForSwitchCase option to use-isnan (#12106) (Milos Djermanovic)
|
10
|
+
* [`d592a24`](https://github.com/eslint/eslint/commit/d592a248d67920f7200925c003f10853d29f1f8d) Fix: exclude `\u000d` so new line won't convert to text (fixes #12027) (#12031) (zamboney)
|
11
|
+
* [`e85d27a`](https://github.com/eslint/eslint/commit/e85d27af427d6185ac553a0d801b5103153426d4) Fix: no-regex-spaces false positives and invalid autofix (fixes #12226) (#12231) (Milos Djermanovic)
|
12
|
+
* [`b349bf7`](https://github.com/eslint/eslint/commit/b349bf79ad56dded826bc99cb52c3551af34fa63) Fix: prefer-named-capture-group incorrect locations (fixes #12233) (#12247) (Milos Djermanovic)
|
13
|
+
* [`7dc1ea9`](https://github.com/eslint/eslint/commit/7dc1ea9a1b9a21daaffcf712ba9c0e91af81b906) Fix: no-useless-return autofix removes comments (#12292) (Milos Djermanovic)
|
14
|
+
* [`0e68677`](https://github.com/eslint/eslint/commit/0e68677ec0aaf060a071ecf71e4af954dddb6af0) Fix: no-extra-bind autofix removes comments (#12293) (Milos Djermanovic)
|
15
|
+
* [`6ad7e86`](https://github.com/eslint/eslint/commit/6ad7e864303e56a39c89569d50c6caf80752ee21) Fix: no-extra-label autofix removes comments (#12298) (Milos Djermanovic)
|
16
|
+
* [`acec201`](https://github.com/eslint/eslint/commit/acec201f06df780791179ad92cfc484f9b6d23d4) Fix: no-undef-init autofix removes comments (#12299) (Milos Djermanovic)
|
17
|
+
* [`d89390b`](https://github.com/eslint/eslint/commit/d89390b75e3e9993f347387a49b0ac5550f45c7f) Fix: use async reading of stdin in bin/eslint.js (fixes #12212) (#12230) (Barrie Treloar)
|
18
|
+
* [`334ca7c`](https://github.com/eslint/eslint/commit/334ca7c8b9c18ac097849c1cefaa43097a4e51dc) Update: no-useless-rename also reports default values (fixes #12301) (#12322) (Kai Cataldo)
|
19
|
+
* [`41bfe91`](https://github.com/eslint/eslint/commit/41bfe919c06932b7e58cd9ead20157e06656160a) Update: Fix handling of chained new expressions in new-parens (#12303) (Milos Djermanovic)
|
20
|
+
* [`160b7c4`](https://github.com/eslint/eslint/commit/160b7c46b556ccb6023eb411a8be8801a4bda6df) Chore: add autofix npm script (#12330) (Kai Cataldo)
|
21
|
+
* [`04b6adb`](https://github.com/eslint/eslint/commit/04b6adb7f1bcb2b6cb3fa377b1ca4cecd810630e) Chore: enable eslint-plugin-jsdoc (refs #11146) (#12332) (Kai Cataldo)
|
22
|
+
* [`9b86167`](https://github.com/eslint/eslint/commit/9b86167e6f053e4a72bf68ebc79db53903f7f8c3) Docs: Add new ES environments to Configuring ESLint (#12289) (Milos Djermanovic)
|
23
|
+
* [`c9aeab2`](https://github.com/eslint/eslint/commit/c9aeab21a71c6743f51163b7a8fdf4f0cbfcdbde) Docs: Add supported ECMAScript version to README (#12290) (Milos Djermanovic)
|
24
|
+
* [`8316e7b`](https://github.com/eslint/eslint/commit/8316e7be5a9429513d7ecf2ee2afc40ab4415b8f) Fix: no-useless-rename autofix removes comments (#12300) (Milos Djermanovic)
|
25
|
+
* [`29c12f1`](https://github.com/eslint/eslint/commit/29c12f18726a3afb21fc89ab1bdacc6972d49e68) Chore: cache results in runtime-info (#12320) (Kai Cataldo)
|
26
|
+
* [`f5537b2`](https://github.com/eslint/eslint/commit/f5537b2ed0b0b5e51a34c22cdd4ebfd024eaea3d) Fix: prefer-numeric-literals autofix removes comments (#12313) (Milos Djermanovic)
|
27
|
+
* [`11ae6fc`](https://github.com/eslint/eslint/commit/11ae6fcb5d5503e5dea41c02780369efe51f0bb9) Update: Fix call, new and member expressions in no-extra-parens (#12302) (Milos Djermanovic)
|
28
|
+
* [`a7894eb`](https://github.com/eslint/eslint/commit/a7894ebb43523152d36720efa770bb1fe8b58c07) New: add --env-info flag to CLI (#12270) (Kai Cataldo)
|
29
|
+
* [`61392ff`](https://github.com/eslint/eslint/commit/61392ff5ec660bfc01ac2ff0e9660d259cf88fd6) Sponsors: Sync README with website (ESLint Jenkins)
|
30
|
+
* [`2c6bf8e`](https://github.com/eslint/eslint/commit/2c6bf8ea9c8a8f94746f980bd5bea0a8c5c4d6b7) Docs: English fix (#12306) (Daniel Nixon)
|
31
|
+
* [`6f11877`](https://github.com/eslint/eslint/commit/6f118778366613fc53036cb6a7537e1b4c6e7af8) Sponsors: Sync README with website (ESLint Jenkins)
|
32
|
+
* [`2e202ca`](https://github.com/eslint/eslint/commit/2e202ca2228846e6226aa8dd99c614d572fb86a8) Docs: fix links in array-callback-return (#12288) (Milos Djermanovic)
|
33
|
+
* [`e39c631`](https://github.com/eslint/eslint/commit/e39c6318af0fd27edd5fd2aaf2b24a3e204005dd) Docs: add example for CLIEngine#executeOnText 3rd arg (#12286) (Kai Cataldo)
|
34
|
+
* [`d4f9a16`](https://github.com/eslint/eslint/commit/d4f9a16af7e00021e2ed63823d9c2f149bc985d6) Update: add support for JSXFragments in indent rule (fixes #12208) (#12210) (Kai Cataldo)
|
35
|
+
* [`c6af95f`](https://github.com/eslint/eslint/commit/c6af95f5bf1ef10f08545d54fd52b98e85fdf7f7) Sponsors: Sync README with website (ESLint Jenkins)
|
36
|
+
* [`8cadd52`](https://github.com/eslint/eslint/commit/8cadd5229b7372aed0d4785dcae15532a399bf55) Sponsors: Sync README with website (ESLint Jenkins)
|
37
|
+
* [`f9fc695`](https://github.com/eslint/eslint/commit/f9fc695d77c19cd5ecb3f0e97e1ea124c8543409) Chore: enable default-param-last (#12244) (薛定谔的猫)
|
38
|
+
* [`9984c3e`](https://github.com/eslint/eslint/commit/9984c3e27c92de76b8c05a58525dbcea12b10b83) Docs: Update README team and sponsors (ESLint Jenkins)
|
39
|
+
|
40
|
+
v6.4.0 - September 13, 2019
|
41
|
+
|
42
|
+
* [`e915fff`](https://github.com/eslint/eslint/commit/e915fffb6089a23ff1cae926cc607f9b87dc1819) Docs: Improve examples and clarify default option (#12067) (Yuping Zuo)
|
43
|
+
* [`540296f`](https://github.com/eslint/eslint/commit/540296fcecd232a09dc873a5a22f5839b59b7842) Update: enforceForClassMembers option to accessor-pairs (fixes #12063) (#12192) (Milos Djermanovic)
|
44
|
+
* [`d3c2334`](https://github.com/eslint/eslint/commit/d3c2334646eae9287d5be9e457d041e445efb512) Update: flag nested block with declaration as error (#12193) (David Waller)
|
45
|
+
* [`b2498d2`](https://github.com/eslint/eslint/commit/b2498d284b9c30ed1543429c2f45d9014e12fe22) Update: Fix handling of property names in no-self-assign (#12105) (Milos Djermanovic)
|
46
|
+
* [`1ee61b0`](https://github.com/eslint/eslint/commit/1ee61b06715fcc750be2c923034a1e59ba663287) Update: enforceForClassMembers computed-property-spacing (fixes #12049) (#12214) (Milos Djermanovic)
|
47
|
+
* [`520c922`](https://github.com/eslint/eslint/commit/520c92270eed6e90c1a796e8af275980f01705e0) Docs: Added naming convention details to plugin usage (#12202) (Henrique Barcelos)
|
48
|
+
* [`f826eab`](https://github.com/eslint/eslint/commit/f826eabbeecddb047f58f4e7308a14c18148d369) Fix: Allow line comment exception in object-curly-spacing (fixes #11902) (#12216) (Milos Djermanovic)
|
49
|
+
* [`db2a29b`](https://github.com/eslint/eslint/commit/db2a29beb0fa28183f65bf9e659c66c03a8918b5) Update: indentation of comment followed by semicolon (fixes #12232) (#12243) (Kai Cataldo)
|
50
|
+
* [`ae17d1c`](https://github.com/eslint/eslint/commit/ae17d1ca59dd466aa64da0680ec2453c2dc3b80d) Fix: no-sequences is reporting incorrect locations (#12241) (Milos Djermanovic)
|
51
|
+
* [`365331a`](https://github.com/eslint/eslint/commit/365331a42e22af5a77ac9cfa9673d6a8f653eb5a) Fix: object-shorthand providing invalid fixes for typescript (#12260) (Brad Zacher)
|
52
|
+
* [`1c921c6`](https://github.com/eslint/eslint/commit/1c921c6dfd7ddfb0308c8103e53d32c1241475f0) New: add no-import-assign (fixes #12237) (#12252) (Toru Nagashima)
|
53
|
+
* [`3be04fd`](https://github.com/eslint/eslint/commit/3be04fd6a4e7b3f5a5ecb845a29cf29b71fe2dfb) New: Add prefer-regex-literals rule (fixes #12238) (#12254) (Milos Djermanovic)
|
54
|
+
* [`37c0fde`](https://github.com/eslint/eslint/commit/37c0fdeb87b92a0b779b125adf45535b79b65757) Update: Report global Atomics calls in no-obj-calls (fixes #12234) (#12258) (Milos Djermanovic)
|
55
|
+
* [`985c9e5`](https://github.com/eslint/eslint/commit/985c9e5eba351965a8a1491a41dbdcc78154b8f4) Fix: space-before-function-paren autofix removes comments (fixes #12259) (#12264) (Milos Djermanovic)
|
56
|
+
* [`01da7d0`](https://github.com/eslint/eslint/commit/01da7d04c4e5a7376cf241ec02db7971726a1bf9) Fix: eqeqeq rule reports incorrect locations (#12265) (Milos Djermanovic)
|
57
|
+
* [`319e4d8`](https://github.com/eslint/eslint/commit/319e4d8386ea846928f0f906c251b46043a53491) Docs: adding finally example (#12256) (Jens Melgaard)
|
58
|
+
* [`d52328f`](https://github.com/eslint/eslint/commit/d52328f012f3704c7d1ce39427e63f80531c7979) Docs: fix no-sequences `with` examples (#12239) (Milos Djermanovic)
|
59
|
+
* [`a41fdc0`](https://github.com/eslint/eslint/commit/a41fdc07404a7675d14183fab245fb8f49dcb858) Fix: Remove autofixer for no-unsafe-negation (#12157) (Milos Djermanovic)
|
60
|
+
* [`e38f5fd`](https://github.com/eslint/eslint/commit/e38f5fdfc786363a3eae642f1a69a8725600aa61) Update: fix no-octal-escape false negatives after \0 (#12079) (Milos Djermanovic)
|
61
|
+
* [`9418fbe`](https://github.com/eslint/eslint/commit/9418fbe0eb31cace3debe27b620709628df2fad7) Sponsors: Sync README with website (ESLint Jenkins)
|
62
|
+
* [`acc5ec5`](https://github.com/eslint/eslint/commit/acc5ec5082aed466a29899f651e6767b39155aec) Sponsors: Sync README with website (ESLint Jenkins)
|
63
|
+
* [`460c5ad`](https://github.com/eslint/eslint/commit/460c5ad176eaf39ff579cd96b3bcbe0539093f8f) Sponsors: Sync README with website (ESLint Jenkins)
|
64
|
+
* [`0313441`](https://github.com/eslint/eslint/commit/0313441d016c8aa0674c135f9da67a676e766ec5) New: add rule default-param-last (fixes #11361) (#12188) (Chiawen Chen)
|
65
|
+
* [`7621f5d`](https://github.com/eslint/eslint/commit/7621f5d2aa7d87e798b75ca47d6889c280597e99) Update: add more specific linting messages to space-in-parens (#11121) (Che Fisher)
|
66
|
+
* [`21eb904`](https://github.com/eslint/eslint/commit/21eb9044135c01b6c12188517bba840614483fc6) Fix: basePath of OverrideTester (fixes #12032) (#12205) (Toru Nagashima)
|
67
|
+
* [`86e5e65`](https://github.com/eslint/eslint/commit/86e5e657ea3fbf12b10524abcbc197afd215a060) Sponsors: Sync README with website (ESLint Jenkins)
|
68
|
+
* [`2b1a13f`](https://github.com/eslint/eslint/commit/2b1a13fa0de8360586857f3ced8da514c971297d) Fix: no-extra-boolean-cast reports wrong negation node (fixes #11324) (#12197) (Milos Djermanovic)
|
69
|
+
* [`ba8c2aa`](https://github.com/eslint/eslint/commit/ba8c2aa0154561fbeca33db0343cb39a7fbd9b4f) Sponsors: Sync README with website (ESLint Jenkins)
|
70
|
+
* [`a0a9746`](https://github.com/eslint/eslint/commit/a0a9746724ccd22c721ddc1b25c566aa9acea154) Docs: Fix link in no-irregular-whitespace.md (#12196) (Timo Tijhof)
|
71
|
+
* [`e10eeba`](https://github.com/eslint/eslint/commit/e10eebab4abd193dee697c4de7fb2d95bbab2d8c) Fix: quotes autofix produces syntax error with octal escape sequences (#12118) (Milos Djermanovic)
|
72
|
+
|
73
|
+
v6.3.0 - August 30, 2019
|
74
|
+
|
75
|
+
* [`0acdefb`](https://github.com/eslint/eslint/commit/0acdefb97f35bb09db2910540c70dc377a01ad62) Chore: refactor code (#12113) (James George)
|
76
|
+
* [`52e2cf5`](https://github.com/eslint/eslint/commit/52e2cf50b35d57fb8466e0bcd0581eff1590fb4c) New: reportUnusedDisableDirectives in config (refs eslint/rfcs#22) (#12151) (Toru Nagashima)
|
77
|
+
* [`020f952`](https://github.com/eslint/eslint/commit/020f9526b618a191566acea3e17e20815d484c58) Update: enforceForSequenceExpressions to no-extra-parens (fixes #11916) (#12142) (Milos Djermanovic)
|
78
|
+
* [`aab1b84`](https://github.com/eslint/eslint/commit/aab1b840f9cffb2a76a5c9fe1852961be71dc184) Fix: reset to the default color (#12174) (Ricardo Gobbo de Souza)
|
79
|
+
* [`4009d39`](https://github.com/eslint/eslint/commit/4009d39aa59451510aa24911e758d664f216289a) Fix: yoda rule produces invalid autofix with preceding yield (#12166) (Milos Djermanovic)
|
80
|
+
* [`febb660`](https://github.com/eslint/eslint/commit/febb6605d350c936d64cb73e694482cfbb20b29c) Fix: no-extra-boolean-cast invalid autofix with yield before negation (#12164) (Milos Djermanovic)
|
81
|
+
* [`4c0b70b`](https://github.com/eslint/eslint/commit/4c0b70b869c16647f7af6de9d5c5479fc19f49db) New: support TypeScript at config initializer (fixes #11789) (#12172) (Pig Fang)
|
82
|
+
* [`94e39d9`](https://github.com/eslint/eslint/commit/94e39d9f782f45db86a079e07508d63040118ef1) Chore: use GitHub Actions (#12144) (Toru Nagashima)
|
83
|
+
* [`e88f305`](https://github.com/eslint/eslint/commit/e88f305df9d454868624c559fd93b981a680c215) Chore: support es2020 in fuzz (#12180) (薛定谔的猫)
|
84
|
+
* [`00d2c5b`](https://github.com/eslint/eslint/commit/00d2c5be9a89efd90135c4368a9589f33df3f7ba) Docs: corrected class extension example (#12176) (Marius M)
|
85
|
+
* [`31e5428`](https://github.com/eslint/eslint/commit/31e542819967b2aa1191e1abaa1c4a49fddbe3cf) Chore: Fix wrong error object keys in test files (#12162) (Milos Djermanovic)
|
86
|
+
* [`197f443`](https://github.com/eslint/eslint/commit/197f4432fca70a574028e5568c48afad12213224) Fix: func-name-matching crash on descriptor-like arguments (#12100) (Milos Djermanovic)
|
87
|
+
* [`644ce33`](https://github.com/eslint/eslint/commit/644ce3306748a33b74fc6a94be0267c2c9f19348) Fix: no-self-assign false positive with rest and spread in array (#12099) (Milos Djermanovic)
|
88
|
+
* [`a81d263`](https://github.com/eslint/eslint/commit/a81d2636ce41fb34d6826c2e9857814e11cb9c30) Fix: fix message of function-paren-newline (#12136) (Pig Fang)
|
89
|
+
* [`77f8ed1`](https://github.com/eslint/eslint/commit/77f8ed1ad9656c526217ce54a6717fa232d522c8) Chore: update blogpost template (#12154) (Toru Nagashima)
|
90
|
+
* [`6abc7b7`](https://github.com/eslint/eslint/commit/6abc7b72dfb824a372379708ca39340b2c7abc03) Docs: Document the exception in no-unsafe-negation (#12161) (Milos Djermanovic)
|
91
|
+
|
1
92
|
v6.2.2 - August 23, 2019
|
2
93
|
|
3
94
|
* [`0e0b784`](https://github.com/eslint/eslint/commit/0e0b784b922051c2a1d39dd8160382114b645800) Upgrade: espree@^6.1.1 (#12158) (Kevin Partington)
|
package/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
[![NPM version][npm-image]][npm-url]
|
2
2
|
[](https://dev.azure.com/eslint/eslint/_build/latest?definitionId=1&branchName=master)
|
3
|
+
[](https://github.com/eslint/eslint/actions)
|
3
4
|
[![Downloads][downloads-image]][downloads-url]
|
4
5
|
[](https://www.bountysource.com/trackers/282608-eslint?utm_source=282608&utm_medium=shield&utm_campaign=TRACKER_BADGE)
|
5
6
|
[](https://gitter.im/eslint/eslint?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
@@ -119,7 +120,7 @@ Yes, ESLint natively supports parsing JSX syntax (this must be enabled in [confi
|
|
119
120
|
|
120
121
|
### What ECMAScript versions does ESLint support?
|
121
122
|
|
122
|
-
ESLint has full support for ECMAScript 3, 5 (default), 2015, 2016, 2017, and
|
123
|
+
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).
|
123
124
|
|
124
125
|
### What about experimental features?
|
125
126
|
|
@@ -209,11 +210,6 @@ Toru Nagashima
|
|
209
210
|
Gyandeep Singh
|
210
211
|
</a>
|
211
212
|
</td><td align="center" valign="top" width="11%">
|
212
|
-
<a href="https://github.com/kaicataldo">
|
213
|
-
<img src="https://github.com/kaicataldo.png?s=75" width="75" height="75"><br />
|
214
|
-
Kai Cataldo
|
215
|
-
</a>
|
216
|
-
</td><td align="center" valign="top" width="11%">
|
217
213
|
<a href="https://github.com/not-an-aardvark">
|
218
214
|
<img src="https://github.com/not-an-aardvark.png?s=75" width="75" height="75"><br />
|
219
215
|
Teddy Katz
|
@@ -240,6 +236,11 @@ The people who review and implement new features.
|
|
240
236
|
The people who review and fix bugs and help triage issues.
|
241
237
|
|
242
238
|
<table><tbody><tr><td align="center" valign="top" width="11%">
|
239
|
+
<a href="https://github.com/kaicataldo">
|
240
|
+
<img src="https://github.com/kaicataldo.png?s=75" width="75" height="75"><br />
|
241
|
+
Kai Cataldo
|
242
|
+
</a>
|
243
|
+
</td><td align="center" valign="top" width="11%">
|
243
244
|
<a href="https://github.com/g-plane">
|
244
245
|
<img src="https://github.com/g-plane.png?s=75" width="75" height="75"><br />
|
245
246
|
Pig Fang
|
@@ -261,9 +262,9 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
261
262
|
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
262
263
|
<!--sponsorsstart-->
|
263
264
|
<h3>Gold Sponsors</h3>
|
264
|
-
<p><a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/eeb91aa/logo.png" alt="Shopify" height="96"></a> <a href="http://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/
|
265
|
+
<p><a href="https://www.shopify.com"><img src="https://images.opencollective.com/shopify/eeb91aa/logo.png" alt="Shopify" height="96"></a> <a href="http://engineering.salesforce.com"><img src="https://images.opencollective.com/salesforce/ca8f997/logo.png" alt="Salesforce" height="96"></a> <a href="https://badoo.com/team?utm_source=eslint"><img src="https://images.opencollective.com/badoo/2826a3b/logo.png" alt="Badoo" height="96"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="96"></a> <a href="https://opensource.facebook.com"><img src="https://images.opencollective.com/fbopensource/fbb8a5b/logo.png" alt="Facebook Open Source" height="96"></a></p><h3>Silver Sponsors</h3>
|
265
266
|
<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>
|
266
|
-
<p><a href="https://
|
267
|
+
<p><a href="https://discordapp.com"><img src="https://images.opencollective.com/discordapp/7e3d9a9/logo.png" alt="Discord" 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://icons8.com"><img src="https://images.opencollective.com/icons8/0b37d14/logo.png" alt="Free Icons by Icons8" height="32"></a> <a href="https://uxplanet.org/top-ui-ux-design-agencies-user-experience-firms-8c54697e290"><img src="https://images.opencollective.com/ui-ux-design-agencies/cae5dfe/logo.png" alt="UI UX Design Agencies" height="32"></a> <a href="https://clay.global"><img src="https://images.opencollective.com/clayglobal/2468f34/logo.png" alt="clay" 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://themeisle.com"><img src="https://images.opencollective.com/themeisle/logo.png" alt="ThemeIsle" height="32"></a> <a href="https://tekhattan.com"><img src="https://images.opencollective.com/tekhattan/bc73c28/logo.png" alt="TekHattan" height="32"></a> <a href="https://www.marfeel.com/"><img src="https://images.opencollective.com/marfeel/4b88e30/logo.png" alt="Marfeel" height="32"></a> <a href="http://www.firesticktricks.com"><img src="https://images.opencollective.com/fire-stick-tricks/b8fbe2c/logo.png" alt="Fire Stick Tricks" height="32"></a> <a href="https://jsheroes.io/"><img src="https://images.opencollective.com/jsheroes1/9fedf0b/logo.png" alt="JSHeroes " height="32"></a></p>
|
267
268
|
<!--sponsorsend-->
|
268
269
|
|
269
270
|
## <a name="technology-sponsors"></a>Technology Sponsors
|
package/bin/eslint.js
CHANGED
@@ -16,9 +16,9 @@ require("v8-compile-cache");
|
|
16
16
|
// Helpers
|
17
17
|
//------------------------------------------------------------------------------
|
18
18
|
|
19
|
-
const useStdIn =
|
20
|
-
init =
|
21
|
-
debug =
|
19
|
+
const useStdIn = process.argv.includes("--stdin"),
|
20
|
+
init = process.argv.includes("--init"),
|
21
|
+
debug = process.argv.includes("--debug");
|
22
22
|
|
23
23
|
// must do this initialization *before* other requires in order to work
|
24
24
|
if (debug) {
|
@@ -30,9 +30,9 @@ if (debug) {
|
|
30
30
|
//------------------------------------------------------------------------------
|
31
31
|
|
32
32
|
// now we can safely include the other modules that use debug
|
33
|
-
const
|
34
|
-
|
35
|
-
|
33
|
+
const path = require("path"),
|
34
|
+
fs = require("fs"),
|
35
|
+
cli = require("../lib/cli");
|
36
36
|
|
37
37
|
//------------------------------------------------------------------------------
|
38
38
|
// Execution
|
@@ -50,7 +50,6 @@ process.once("uncaughtException", err => {
|
|
50
50
|
console.error("\nOops! Something went wrong! :(");
|
51
51
|
console.error(`\nESLint: ${pkg.version}.\n\n${template(err.messageData || {})}`);
|
52
52
|
} else {
|
53
|
-
|
54
53
|
console.error(err.stack);
|
55
54
|
}
|
56
55
|
|
@@ -60,13 +59,40 @@ process.once("uncaughtException", err => {
|
|
60
59
|
if (useStdIn) {
|
61
60
|
|
62
61
|
/*
|
63
|
-
* Note:
|
64
|
-
*
|
65
|
-
*
|
62
|
+
* Note: See
|
63
|
+
* - https://github.com/nodejs/node/blob/master/doc/api/process.md#processstdin
|
64
|
+
* - https://github.com/nodejs/node/blob/master/doc/api/process.md#a-note-on-process-io
|
65
|
+
* - https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-01/msg00419.html
|
66
|
+
* - https://github.com/nodejs/node/issues/7439 (historical)
|
67
|
+
*
|
68
|
+
* On Windows using `fs.readFileSync(STDIN_FILE_DESCRIPTOR, "utf8")` seems
|
69
|
+
* to read 4096 bytes before blocking and never drains to read further data.
|
70
|
+
*
|
71
|
+
* The investigation on the Emacs thread indicates:
|
72
|
+
*
|
73
|
+
* > Emacs on MS-Windows uses pipes to communicate with subprocesses; a
|
74
|
+
* > pipe on Windows has a 4K buffer. So as soon as Emacs writes more than
|
75
|
+
* > 4096 bytes to the pipe, the pipe becomes full, and Emacs then waits for
|
76
|
+
* > the subprocess to read its end of the pipe, at which time Emacs will
|
77
|
+
* > write the rest of the stuff.
|
78
|
+
*
|
79
|
+
* Using the nodejs code example for reading from stdin.
|
66
80
|
*/
|
67
|
-
|
81
|
+
let contents = "",
|
82
|
+
chunk = "";
|
83
|
+
|
84
|
+
process.stdin.setEncoding("utf8");
|
85
|
+
process.stdin.on("readable", () => {
|
68
86
|
|
69
|
-
|
87
|
+
// Use a loop to make sure we read all available data.
|
88
|
+
while ((chunk = process.stdin.read()) !== null) {
|
89
|
+
contents += chunk;
|
90
|
+
}
|
91
|
+
});
|
92
|
+
|
93
|
+
process.stdin.on("end", () => {
|
94
|
+
process.exitCode = cli.execute(process.argv, contents, "utf8");
|
95
|
+
});
|
70
96
|
} else if (init) {
|
71
97
|
const configInit = require("../lib/init/config-initializer");
|
72
98
|
|
package/conf/config-schema.js
CHANGED
@@ -21,6 +21,7 @@ const baseConfigProperties = {
|
|
21
21
|
rules: { type: "object" },
|
22
22
|
settings: { type: "object" },
|
23
23
|
noInlineConfig: { type: "boolean" },
|
24
|
+
reportUnusedDisableDirectives: { type: "boolean" },
|
24
25
|
|
25
26
|
ecmaFeatures: { type: "object" } // deprecated; logs a warning when used
|
26
27
|
};
|
@@ -85,8 +85,8 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]);
|
|
85
85
|
* @property {number} warningCount Number of warnings for the result.
|
86
86
|
* @property {number} fixableErrorCount Number of fixable errors for the result.
|
87
87
|
* @property {number} fixableWarningCount Number of fixable warnings for the result.
|
88
|
-
* @property {string
|
89
|
-
* @property {string
|
88
|
+
* @property {string} [source] The source code of the file that was linted.
|
89
|
+
* @property {string} [output] The source code of the file that was linted, with as many fixes applied as possible.
|
90
90
|
*/
|
91
91
|
|
92
92
|
/**
|
@@ -329,7 +329,6 @@ function getRule(ruleId, configArrays) {
|
|
329
329
|
/**
|
330
330
|
* Collect used deprecated rules.
|
331
331
|
* @param {ConfigArray[]} usedConfigArrays The config arrays which were used.
|
332
|
-
* @param {Map<string, Object>} ruleMap The rule definitions which were used (built-ins).
|
333
332
|
* @returns {IterableIterator<DeprecatedRuleInfo>} Used deprecated rules.
|
334
333
|
*/
|
335
334
|
function *iterateRuleDeprecationWarnings(usedConfigArrays) {
|
@@ -530,7 +529,6 @@ class CLIEngine {
|
|
530
529
|
/**
|
531
530
|
* Creates a new instance of the core CLI engine.
|
532
531
|
* @param {CLIEngineOptions} providedOptions The options for this instance.
|
533
|
-
* @constructor
|
534
532
|
*/
|
535
533
|
constructor(providedOptions) {
|
536
534
|
const options = Object.assign(
|
@@ -59,6 +59,7 @@ const { ExtractedConfig } = require("./extracted-config");
|
|
59
59
|
* @property {Object|undefined} parserOptions The parser options.
|
60
60
|
* @property {Record<string, DependentPlugin>|undefined} plugins The plugin loaders.
|
61
61
|
* @property {string|undefined} processor The processor name to refer plugin's processor.
|
62
|
+
* @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments.
|
62
63
|
* @property {boolean|undefined} root The flag to express root.
|
63
64
|
* @property {Record<string, RuleConf>|undefined} rules The rule settings
|
64
65
|
* @property {Object|undefined} settings The shared settings.
|
@@ -257,6 +258,11 @@ function createConfig(instance, indices) {
|
|
257
258
|
config.configNameOfNoInlineConfig = element.name;
|
258
259
|
}
|
259
260
|
|
261
|
+
// Adopt the reportUnusedDisableDirectives which was found at first.
|
262
|
+
if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) {
|
263
|
+
config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives;
|
264
|
+
}
|
265
|
+
|
260
266
|
// Merge others.
|
261
267
|
mergeWithoutOverwrite(config.env, element.env);
|
262
268
|
mergeWithoutOverwrite(config.globals, element.globals);
|
@@ -77,6 +77,12 @@ class ExtractedConfig {
|
|
77
77
|
*/
|
78
78
|
this.processor = null;
|
79
79
|
|
80
|
+
/**
|
81
|
+
* The flag that reports unused `eslint-disable` directive comments.
|
82
|
+
* @type {boolean|undefined}
|
83
|
+
*/
|
84
|
+
this.reportUnusedDisableDirectives = void 0;
|
85
|
+
|
80
86
|
/**
|
81
87
|
* Rule settings.
|
82
88
|
* @type {Record<string, [SeverityConf, ...any[]]>}
|
@@ -125,10 +125,10 @@ class OverrideTester {
|
|
125
125
|
*/
|
126
126
|
static and(a, b) {
|
127
127
|
if (!b) {
|
128
|
-
return a;
|
128
|
+
return a && new OverrideTester(a.patterns, a.basePath);
|
129
129
|
}
|
130
130
|
if (!a) {
|
131
|
-
return b;
|
131
|
+
return new OverrideTester(b.patterns, b.basePath);
|
132
132
|
}
|
133
133
|
|
134
134
|
assert.strictEqual(a.basePath, b.basePath);
|
@@ -531,6 +531,7 @@ class ConfigArrayFactory {
|
|
531
531
|
parserOptions,
|
532
532
|
plugins: pluginList,
|
533
533
|
processor,
|
534
|
+
reportUnusedDisableDirectives,
|
534
535
|
root,
|
535
536
|
rules,
|
536
537
|
settings,
|
@@ -573,6 +574,7 @@ class ConfigArrayFactory {
|
|
573
574
|
parserOptions,
|
574
575
|
plugins,
|
575
576
|
processor,
|
577
|
+
reportUnusedDisableDirectives,
|
576
578
|
root,
|
577
579
|
rules,
|
578
580
|
settings
|
@@ -78,7 +78,7 @@ function mergeDefaultOptions(options) {
|
|
78
78
|
return Object.assign({}, DEFAULT_OPTIONS, options);
|
79
79
|
}
|
80
80
|
|
81
|
-
/* eslint-disable
|
81
|
+
/* eslint-disable jsdoc/check-param-names, jsdoc/require-param */
|
82
82
|
/**
|
83
83
|
* Normalize the path separators in a given string.
|
84
84
|
* On Windows environment, this replaces `\` by `/`.
|
@@ -89,7 +89,7 @@ function mergeDefaultOptions(options) {
|
|
89
89
|
const normalizePathSeps = path.sep === "/"
|
90
90
|
? (str => str)
|
91
91
|
: ((seps, str) => str.replace(seps, "/")).bind(null, new RegExp(`\\${path.sep}`, "gu"));
|
92
|
-
/* eslint-enable
|
92
|
+
/* eslint-enable jsdoc/check-param-names, jsdoc/require-param */
|
93
93
|
|
94
94
|
/**
|
95
95
|
* Converts a glob pattern to a new glob pattern relative to a different directory
|
@@ -298,7 +298,7 @@ class IgnoredPaths {
|
|
298
298
|
|
299
299
|
/**
|
300
300
|
* read ignore filepath
|
301
|
-
* @param {string} filePath
|
301
|
+
* @param {string} filePath file to add to ig
|
302
302
|
* @returns {Array} raw ignore rules
|
303
303
|
*/
|
304
304
|
readIgnoreFile(filePath) {
|
package/lib/cli.js
CHANGED
@@ -20,7 +20,8 @@ const fs = require("fs"),
|
|
20
20
|
mkdirp = require("mkdirp"),
|
21
21
|
{ CLIEngine } = require("./cli-engine"),
|
22
22
|
options = require("./options"),
|
23
|
-
log = require("./shared/logging")
|
23
|
+
log = require("./shared/logging"),
|
24
|
+
RuntimeInfo = require("./shared/runtime-info");
|
24
25
|
|
25
26
|
const debug = require("debug")("eslint:cli");
|
26
27
|
|
@@ -159,13 +160,18 @@ const cli = {
|
|
159
160
|
}
|
160
161
|
|
161
162
|
const files = currentOptions._;
|
162
|
-
|
163
163
|
const useStdin = typeof text === "string";
|
164
164
|
|
165
|
-
if (currentOptions.version) {
|
166
|
-
|
167
|
-
|
168
|
-
|
165
|
+
if (currentOptions.version) {
|
166
|
+
log.info(RuntimeInfo.version());
|
167
|
+
} else if (currentOptions.envInfo) {
|
168
|
+
try {
|
169
|
+
log.info(RuntimeInfo.environment());
|
170
|
+
return 0;
|
171
|
+
} catch (err) {
|
172
|
+
log.error(err.message);
|
173
|
+
return 2;
|
174
|
+
}
|
169
175
|
} else if (currentOptions.printConfig) {
|
170
176
|
if (files.length) {
|
171
177
|
log.error("The --print-config option must be used with exactly one file name.");
|
@@ -177,17 +183,13 @@ const cli = {
|
|
177
183
|
}
|
178
184
|
|
179
185
|
const engine = new CLIEngine(translateOptions(currentOptions));
|
180
|
-
|
181
186
|
const fileConfig = engine.getConfigForFile(currentOptions.printConfig);
|
182
187
|
|
183
188
|
log.info(JSON.stringify(fileConfig, null, " "));
|
184
189
|
return 0;
|
185
190
|
} else if (currentOptions.help || (!files.length && !useStdin)) {
|
186
|
-
|
187
191
|
log.info(options.generateHelp());
|
188
|
-
|
189
192
|
} else {
|
190
|
-
|
191
193
|
debug(`Running on ${useStdin ? "text" : "files"}`);
|
192
194
|
|
193
195
|
if (currentOptions.fix && currentOptions.fixDryRun) {
|
@@ -227,9 +229,8 @@ const cli = {
|
|
227
229
|
|
228
230
|
return (report.errorCount || tooManyWarnings) ? 1 : 0;
|
229
231
|
}
|
230
|
-
return 2;
|
231
|
-
|
232
232
|
|
233
|
+
return 2;
|
233
234
|
}
|
234
235
|
|
235
236
|
return 0;
|
@@ -120,6 +120,12 @@ function getModulesList(config, installESLint) {
|
|
120
120
|
}
|
121
121
|
}
|
122
122
|
|
123
|
+
const parser = config.parser || (config.parserOptions && config.parserOptions.parser);
|
124
|
+
|
125
|
+
if (parser) {
|
126
|
+
modules[parser] = "latest";
|
127
|
+
}
|
128
|
+
|
123
129
|
if (installESLint === false) {
|
124
130
|
delete modules.eslint;
|
125
131
|
} else {
|
@@ -291,6 +297,20 @@ function processAnswers(answers) {
|
|
291
297
|
config.extends.push("plugin:vue/essential");
|
292
298
|
}
|
293
299
|
|
300
|
+
if (answers.typescript) {
|
301
|
+
if (answers.framework === "vue") {
|
302
|
+
config.parserOptions.parser = "@typescript-eslint/parser";
|
303
|
+
} else {
|
304
|
+
config.parser = "@typescript-eslint/parser";
|
305
|
+
}
|
306
|
+
|
307
|
+
if (Array.isArray(config.plugins)) {
|
308
|
+
config.plugins.push("@typescript-eslint");
|
309
|
+
} else {
|
310
|
+
config.plugins = ["@typescript-eslint"];
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
294
314
|
// setup rules based on problems/style enforcement preferences
|
295
315
|
if (answers.purpose === "problems") {
|
296
316
|
config.extends.unshift("eslint:recommended");
|
@@ -306,6 +326,9 @@ function processAnswers(answers) {
|
|
306
326
|
config = autoconfig.extendFromRecommended(config);
|
307
327
|
}
|
308
328
|
}
|
329
|
+
if (answers.typescript && config.extends.includes("eslint:recommended")) {
|
330
|
+
config.extends.push("plugin:@typescript-eslint/eslint-recommended");
|
331
|
+
}
|
309
332
|
|
310
333
|
// normalize extends
|
311
334
|
if (config.extends.length === 0) {
|
@@ -465,6 +488,12 @@ function promptUser() {
|
|
465
488
|
{ name: "None of these", value: "none" }
|
466
489
|
]
|
467
490
|
},
|
491
|
+
{
|
492
|
+
type: "confirm",
|
493
|
+
name: "typescript",
|
494
|
+
message: "Does your project use TypeScript?",
|
495
|
+
default: false
|
496
|
+
},
|
468
497
|
{
|
469
498
|
type: "checkbox",
|
470
499
|
name: "env",
|
package/lib/init/config-rule.js
CHANGED
@@ -99,7 +99,7 @@ function groupByProperty(objects) {
|
|
99
99
|
* Configs may also have one or more additional elements to specify rule
|
100
100
|
* configuration or options.
|
101
101
|
*
|
102
|
-
* @typedef {
|
102
|
+
* @typedef {Array|number} ruleConfig
|
103
103
|
* @param {number} 0 The rule's severity (0, 1, 2).
|
104
104
|
*/
|
105
105
|
|
@@ -185,7 +185,7 @@ class RuleConfigSet {
|
|
185
185
|
|
186
186
|
/**
|
187
187
|
* Stored valid rule configurations for this instance
|
188
|
-
* @type {
|
188
|
+
* @type {Array}
|
189
189
|
*/
|
190
190
|
this.ruleConfigs = configs || [];
|
191
191
|
}
|
package/lib/init/npm-utils.js
CHANGED
@@ -98,7 +98,7 @@ function fetchPeerDependencies(packageName) {
|
|
98
98
|
* and values are booleans indicating installation.
|
99
99
|
*/
|
100
100
|
function check(packages, opt) {
|
101
|
-
|
101
|
+
const deps = new Set();
|
102
102
|
const pkgJson = (opt) ? findPackageJson(opt.startDir) : findPackageJson();
|
103
103
|
let fileJson;
|
104
104
|
|
@@ -119,14 +119,14 @@ function check(packages, opt) {
|
|
119
119
|
throw error;
|
120
120
|
}
|
121
121
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
122
|
+
["dependencies", "devDependencies"].forEach(key => {
|
123
|
+
if (opt[key] && typeof fileJson[key] === "object") {
|
124
|
+
Object.keys(fileJson[key]).forEach(dep => deps.add(dep));
|
125
|
+
}
|
126
|
+
});
|
127
|
+
|
128
128
|
return packages.reduce((status, pkg) => {
|
129
|
-
status[pkg] = deps.
|
129
|
+
status[pkg] = deps.has(pkg);
|
130
130
|
return status;
|
131
131
|
}, {});
|
132
132
|
}
|
@@ -163,7 +163,7 @@ function checkDevDeps(packages) {
|
|
163
163
|
/**
|
164
164
|
* Check whether package.json is found in current path.
|
165
165
|
*
|
166
|
-
* @param {string
|
166
|
+
* @param {string} [startDir] Starting directory
|
167
167
|
* @returns {boolean} Whether a package.json is found in current path.
|
168
168
|
*/
|
169
169
|
function checkPackageJson(startDir) {
|