eslint 7.8.0 → 7.11.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 +57 -0
- package/README.md +3 -3
- package/lib/cli-engine/config-array-factory.js +11 -5
- package/lib/rules/function-paren-newline.js +1 -1
- package/lib/rules/id-length.js +2 -7
- package/lib/rules/max-lines.js +8 -0
- package/lib/rules/no-extra-parens.js +16 -1
- package/lib/rules/no-inline-comments.js +25 -4
- package/lib/rules/prefer-destructuring.js +7 -0
- package/lib/rules/utils/ast-utils.js +3 -1
- package/messages/plugin-invalid.txt +8 -0
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,60 @@
|
|
1
|
+
v7.11.0 - October 9, 2020
|
2
|
+
|
3
|
+
* [`23e966f`](https://github.com/eslint/eslint/commit/23e966f6cf2a6c6b699dff5d6950ece3cc396498) Chore: Refactor CLIEngine tests (refs #13481) (#13709) (Nicholas C. Zakas)
|
4
|
+
* [`fa9429a`](https://github.com/eslint/eslint/commit/fa9429aac0ffed505f3f02e8fc75f646c69f5c61) Fix: don't count line after EOF in max-lines (#13735) (Milos Djermanovic)
|
5
|
+
* [`d973675`](https://github.com/eslint/eslint/commit/d973675a5c06a2bd4f8ce640c78b67842cfebfd4) Docs: Update anchor links to use existing linkrefs (refs #13715) (#13741) (Brandon Mills)
|
6
|
+
* [`2c6d774`](https://github.com/eslint/eslint/commit/2c6d774c89dcd14f386bd9d73d451fa2a892c3ef) Docs: Fix typos (#13730) (Frieder Bluemle)
|
7
|
+
* [`cc468c0`](https://github.com/eslint/eslint/commit/cc468c01021385a028de727eefcd442e7f34875c) Upgrade: eslint-visitor-keys@2.0.0 (#13732) (Milos Djermanovic)
|
8
|
+
* [`ab0ac6c`](https://github.com/eslint/eslint/commit/ab0ac6c532fb7b7d49779c8913146244d680743b) Docs: Fix anchor links (#13715) (Gary Moore)
|
9
|
+
* [`27f0de6`](https://github.com/eslint/eslint/commit/27f0de62e6281c28043be38ef051818c9edc15cd) Fix: account for linebreaks before postfix `++`/`--` in no-extra-parens (#13731) (Milos Djermanovic)
|
10
|
+
* [`da78fa1`](https://github.com/eslint/eslint/commit/da78fa11632a2908db4ac494012a16f5d5a88a64) Update: support async arrow fn in function-paren-newline (fixes #13728) (#13729) (Michal Dziekonski)
|
11
|
+
* [`fe301b8`](https://github.com/eslint/eslint/commit/fe301b8cc0762d7f4edd59603ca51ed0ec0c2a43) Docs: Add configuration comments in examples (#13738) (YeonJuan)
|
12
|
+
* [`504408c`](https://github.com/eslint/eslint/commit/504408cd65e9d8827b2b8bbeb8f589df90eee523) Sponsors: Sync README with website (ESLint Jenkins)
|
13
|
+
* [`3900659`](https://github.com/eslint/eslint/commit/390065985b2289ad4412a83598e3e833c382d27e) Sponsors: Sync README with website (ESLint Jenkins)
|
14
|
+
* [`c1974b3`](https://github.com/eslint/eslint/commit/c1974b3f7169a8e5fab7007df92d02d8c1a8d5a3) Sponsors: Sync README with website (ESLint Jenkins)
|
15
|
+
* [`6f4abe5`](https://github.com/eslint/eslint/commit/6f4abe5d5ade2711cc4c21bc8485af952763c2d3) Sponsors: Sync README with website (ESLint Jenkins)
|
16
|
+
|
17
|
+
v7.10.0 - September 26, 2020
|
18
|
+
|
19
|
+
* [`6919fbb`](https://github.com/eslint/eslint/commit/6919fbb83f86552b0f49ae749da866e4edc7c46a) Docs: Clarify that ignorePattern should be a string (refs #13029) (#13718) (Brandon Mills)
|
20
|
+
* [`07d9bea`](https://github.com/eslint/eslint/commit/07d9bea7c6f953e8f754afffc9752edcee799431) Update: Add ignorePattern to no-inline-comments (#13029) (Edie Lemoine)
|
21
|
+
* [`d79bbe9`](https://github.com/eslint/eslint/commit/d79bbe982930b53358d34ad91cc6e5eaac8ddede) Docs: fix typo (#13717) (Alexander Liu)
|
22
|
+
* [`9b8490e`](https://github.com/eslint/eslint/commit/9b8490ee6391c986b1314540a92b71d8c1e0efc4) Docs: grammatical error (#13687) (rajdeep)
|
23
|
+
* [`cb44e93`](https://github.com/eslint/eslint/commit/cb44e93f4780e925a75a68ce2f7f6d065b5f756c) Fix: prefer-destructuring invalid autofix with computed property access (#13704) (Milos Djermanovic)
|
24
|
+
* [`46c73b1`](https://github.com/eslint/eslint/commit/46c73b159a5ceed2f7f26f254fd97e459fb0e81a) Upgrade: eslint-scope@5.1.1 (#13716) (Milos Djermanovic)
|
25
|
+
* [`b7b12ba`](https://github.com/eslint/eslint/commit/b7b12ba0bd4e9c66883f11e97de8ed84b600cdaa) Chore: Move comment to make tests more organized (#13707) (Yusuke Tanaka)
|
26
|
+
* [`51674a4`](https://github.com/eslint/eslint/commit/51674a4113a1ca877094606bbf4938ab06cc1aad) Docs: Add missing quotes (#13714) (Lucio Paiva)
|
27
|
+
* [`7c34a98`](https://github.com/eslint/eslint/commit/7c34a982aaf93a02348f56c9ce887c7dcf51b5bd) Chore: remove mistakenly added file (#13710) (Milos Djermanovic)
|
28
|
+
* [`30b76c9`](https://github.com/eslint/eslint/commit/30b76c9a13fae3dff59f7db406d6c66f11152973) Docs: Clarify package.json requirement in Getting Started (refs #13549) (#13696) (Nicholas C. Zakas)
|
29
|
+
* [`044560d`](https://github.com/eslint/eslint/commit/044560dcc74db98b28e293da2e2f3b41ecbf5884) Sponsors: Sync README with website (ESLint Jenkins)
|
30
|
+
* [`54000d1`](https://github.com/eslint/eslint/commit/54000d13f27d5255851b5ac0606ad027e2b8d331) Sponsors: Sync README with website (ESLint Jenkins)
|
31
|
+
|
32
|
+
v7.9.0 - September 12, 2020
|
33
|
+
|
34
|
+
* [`3ca2700`](https://github.com/eslint/eslint/commit/3ca27004ece5016ba7aed775f01ad13bc9282296) Fix: Corrected notice for invalid (:) plugin names (#13473) (Josh Goldberg)
|
35
|
+
* [`fc5783d`](https://github.com/eslint/eslint/commit/fc5783d2ff9e3b0d7a1f9664928d49270b4a6c01) Docs: Fix leaky anchors in v4 migration page (#13635) (Timo Tijhof)
|
36
|
+
* [`f1d07f1`](https://github.com/eslint/eslint/commit/f1d07f112be96c64dfdaa154aa9ac81985b16238) Docs: Provide install commands for Yarn (#13661) (Nikita Baksalyar)
|
37
|
+
* [`29d1cdc`](https://github.com/eslint/eslint/commit/29d1cdceedd6c056a39149723cf9ff2fbb260cbf) Fix: prefer-destructuring removes comments (refs #13678) (#13682) (Milos Djermanovic)
|
38
|
+
* [`b4da0a7`](https://github.com/eslint/eslint/commit/b4da0a7ca7995435bdfc116fd374eb0649470131) Docs: fix typo in working with plugins docs (#13683) (啸生)
|
39
|
+
* [`6f87db7`](https://github.com/eslint/eslint/commit/6f87db7c318225e48ccbbf0bec8b3758ea839b82) Update: fix id-length false negatives on Object.prototype property names (#13670) (Milos Djermanovic)
|
40
|
+
* [`361ac4d`](https://github.com/eslint/eslint/commit/361ac4d895c15086fb4351d4dca1405b2fdc4bd5) Fix: NonOctalDecimalIntegerLiteral is decimal integer (fixes #13588) (#13664) (Milos Djermanovic)
|
41
|
+
* [`f260716`](https://github.com/eslint/eslint/commit/f260716695064e4b4193337107b60401bd4b3f20) Docs: update outdated link (#13677) (klkhan)
|
42
|
+
* [`5138c91`](https://github.com/eslint/eslint/commit/5138c913c256e4266ffb68278783af45bf70af84) Docs: add missing eslint directive comments in no-await-in-loop (#13673) (Milos Djermanovic)
|
43
|
+
* [`17b58b5`](https://github.com/eslint/eslint/commit/17b58b528df62bf96813d50c087cafdf83306810) Docs: clarify correct example in no-return-await (fixes #13656) (#13657) (Milos Djermanovic)
|
44
|
+
* [`9171f0a`](https://github.com/eslint/eslint/commit/9171f0a99bb4d7c53f109b1c2b215004a7c27713) Chore: fix typo (#13660) (Nitin Kumar)
|
45
|
+
* [`6d9f8fb`](https://github.com/eslint/eslint/commit/6d9f8fbb7ed4361b475fb50d04e6d25744d5b1a2) Sponsors: Sync README with website (ESLint Jenkins)
|
46
|
+
* [`97b0dd9`](https://github.com/eslint/eslint/commit/97b0dd9a1af1ae4ae3857adcfe6eeac7837101ed) Sponsors: Sync README with website (ESLint Jenkins)
|
47
|
+
* [`deab125`](https://github.com/eslint/eslint/commit/deab125fc9220dab43baeb32c6cf78942ad25a83) Sponsors: Sync README with website (ESLint Jenkins)
|
48
|
+
* [`bf2e367`](https://github.com/eslint/eslint/commit/bf2e367bf4f6fde9930af9de8b8d8bc3d8b5782f) Sponsors: Sync README with website (ESLint Jenkins)
|
49
|
+
* [`8929208`](https://github.com/eslint/eslint/commit/89292084bf91ba5ae5bf966c6c56fa3da139ce57) Sponsors: Sync README with website (ESLint Jenkins)
|
50
|
+
|
51
|
+
v7.8.1 - September 1, 2020
|
52
|
+
|
53
|
+
* [`f542b5d`](https://github.com/eslint/eslint/commit/f542b5d0679b73326ad249fc44a54c3f848bd3e6) Fix: Update broken @eslint/eslintrc version (fixes #13641) (#13647) (Nicholas C. Zakas)
|
54
|
+
* [`c1b5696`](https://github.com/eslint/eslint/commit/c1b56966c2354e12d16e8394443de49fa54f4290) Sponsors: Sync README with website (ESLint Jenkins)
|
55
|
+
* [`8ddeda0`](https://github.com/eslint/eslint/commit/8ddeda01afdb1e9656a43853b8e25c9c4582e6ad) Sponsors: Sync README with website (ESLint Jenkins)
|
56
|
+
* [`e02e2fe`](https://github.com/eslint/eslint/commit/e02e2fe019a1ed9a34a7b96e4c8961c35093b0ce) Sponsors: Sync README with website (ESLint Jenkins)
|
57
|
+
|
1
58
|
v7.8.0 - August 31, 2020
|
2
59
|
|
3
60
|
* [`58abd93`](https://github.com/eslint/eslint/commit/58abd9311900a8af5a3c0963daaf64675bdd8383) Update: support logical assignments in code path analysis (refs #13569) (#13612) (Milos Djermanovic)
|
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
[](https://www.npmjs.com/package/eslint)
|
2
2
|
[](https://www.npmjs.com/package/eslint)
|
3
3
|
[](https://github.com/eslint/eslint/actions)
|
4
4
|
[](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Feslint%2Feslint?ref=badge_shield)
|
@@ -265,8 +265,8 @@ The following companies, organizations, and individuals support ESLint's ongoing
|
|
265
265
|
<!--sponsorsstart-->
|
266
266
|
<h3>Gold Sponsors</h3>
|
267
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
|
269
|
-
<p><a href="https://
|
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>
|
269
|
+
<p><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.betacalendars.com/printable-calendar"><img src="https://images.opencollective.com/betacalendars/9334b33/logo.png" alt="2021 calendar" height="32"></a> <a href="https://buy.fineproxy.org/eng/"><img src="https://images.opencollective.com/buy-fineproxy-org/2002c40/logo.png" alt="Buy.Fineproxy.Org" 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://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://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://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/7fa1641/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>
|
270
270
|
<!--sponsorsend-->
|
271
271
|
|
272
272
|
## <a name="technology-sponsors"></a>Technology Sponsors
|
@@ -286,14 +286,15 @@ function loadESLintIgnoreFile(filePath) {
|
|
286
286
|
* Creates an error to notify about a missing config to extend from.
|
287
287
|
* @param {string} configName The name of the missing config.
|
288
288
|
* @param {string} importerName The name of the config that imported the missing config
|
289
|
+
* @param {string} messageTemplate The text template to source error strings from.
|
289
290
|
* @returns {Error} The error object to throw
|
290
291
|
* @private
|
291
292
|
*/
|
292
|
-
function
|
293
|
+
function configInvalidError(configName, importerName, messageTemplate) {
|
293
294
|
return Object.assign(
|
294
295
|
new Error(`Failed to load config "${configName}" to extend from.`),
|
295
296
|
{
|
296
|
-
messageTemplate
|
297
|
+
messageTemplate,
|
297
298
|
messageData: { configName, importerName }
|
298
299
|
}
|
299
300
|
);
|
@@ -802,7 +803,7 @@ class ConfigArrayFactory {
|
|
802
803
|
});
|
803
804
|
}
|
804
805
|
|
805
|
-
throw
|
806
|
+
throw configInvalidError(extendName, ctx.name, "extend-config-missing");
|
806
807
|
}
|
807
808
|
|
808
809
|
/**
|
@@ -814,6 +815,11 @@ class ConfigArrayFactory {
|
|
814
815
|
*/
|
815
816
|
_loadExtendedPluginConfig(extendName, ctx) {
|
816
817
|
const slashIndex = extendName.lastIndexOf("/");
|
818
|
+
|
819
|
+
if (slashIndex === -1) {
|
820
|
+
throw configInvalidError(extendName, ctx.filePath, "plugin-invalid");
|
821
|
+
}
|
822
|
+
|
817
823
|
const pluginName = extendName.slice("plugin:".length, slashIndex);
|
818
824
|
const configName = extendName.slice(slashIndex + 1);
|
819
825
|
|
@@ -834,7 +840,7 @@ class ConfigArrayFactory {
|
|
834
840
|
});
|
835
841
|
}
|
836
842
|
|
837
|
-
throw plugin.error ||
|
843
|
+
throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing");
|
838
844
|
}
|
839
845
|
|
840
846
|
/**
|
@@ -867,7 +873,7 @@ class ConfigArrayFactory {
|
|
867
873
|
} catch (error) {
|
868
874
|
/* istanbul ignore else */
|
869
875
|
if (error && error.code === "MODULE_NOT_FOUND") {
|
870
|
-
throw
|
876
|
+
throw configInvalidError(extendName, ctx.filePath, "extend-config-missing");
|
871
877
|
}
|
872
878
|
throw error;
|
873
879
|
}
|
@@ -218,7 +218,7 @@ module.exports = {
|
|
218
218
|
}
|
219
219
|
|
220
220
|
case "ArrowFunctionExpression": {
|
221
|
-
const firstToken = sourceCode.getFirstToken(node);
|
221
|
+
const firstToken = sourceCode.getFirstToken(node, { skip: (node.async ? 1 : 0) });
|
222
222
|
|
223
223
|
if (!astUtils.isOpeningParenToken(firstToken)) {
|
224
224
|
|
package/lib/rules/id-length.js
CHANGED
@@ -64,12 +64,7 @@ module.exports = {
|
|
64
64
|
const minLength = typeof options.min !== "undefined" ? options.min : 2;
|
65
65
|
const maxLength = typeof options.max !== "undefined" ? options.max : Infinity;
|
66
66
|
const properties = options.properties !== "never";
|
67
|
-
const exceptions = (options.exceptions
|
68
|
-
.reduce((obj, item) => {
|
69
|
-
obj[item] = true;
|
70
|
-
|
71
|
-
return obj;
|
72
|
-
}, {});
|
67
|
+
const exceptions = new Set(options.exceptions);
|
73
68
|
const exceptionPatterns = (options.exceptionPatterns || []).map(pattern => new RegExp(pattern, "u"));
|
74
69
|
const reportedNode = new Set();
|
75
70
|
|
@@ -130,7 +125,7 @@ module.exports = {
|
|
130
125
|
const isShort = name.length < minLength;
|
131
126
|
const isLong = name.length > maxLength;
|
132
127
|
|
133
|
-
if (!(isShort || isLong) || exceptions
|
128
|
+
if (!(isShort || isLong) || exceptions.has(name) || matchesExceptionPattern(name)) {
|
134
129
|
return; // Nothing to report
|
135
130
|
}
|
136
131
|
|
package/lib/rules/max-lines.js
CHANGED
@@ -131,6 +131,14 @@ module.exports = {
|
|
131
131
|
text
|
132
132
|
}));
|
133
133
|
|
134
|
+
/*
|
135
|
+
* If file ends with a linebreak, `sourceCode.lines` will have one extra empty line at the end.
|
136
|
+
* That isn't a real line, so we shouldn't count it.
|
137
|
+
*/
|
138
|
+
if (lines.length > 1 && lodash.last(lines).text === "") {
|
139
|
+
lines.pop();
|
140
|
+
}
|
141
|
+
|
134
142
|
if (skipBlankLines) {
|
135
143
|
lines = lines.filter(l => l.text.trim() !== "");
|
136
144
|
}
|
@@ -1109,7 +1109,22 @@ module.exports = {
|
|
1109
1109
|
},
|
1110
1110
|
|
1111
1111
|
UnaryExpression: checkArgumentWithPrecedence,
|
1112
|
-
UpdateExpression
|
1112
|
+
UpdateExpression(node) {
|
1113
|
+
if (node.prefix) {
|
1114
|
+
checkArgumentWithPrecedence(node);
|
1115
|
+
} else {
|
1116
|
+
const { argument } = node;
|
1117
|
+
const operatorToken = sourceCode.getLastToken(node);
|
1118
|
+
|
1119
|
+
if (argument.loc.end.line === operatorToken.loc.start.line) {
|
1120
|
+
checkArgumentWithPrecedence(node);
|
1121
|
+
} else {
|
1122
|
+
if (hasDoubleExcessParens(argument)) {
|
1123
|
+
report(argument);
|
1124
|
+
}
|
1125
|
+
}
|
1126
|
+
}
|
1127
|
+
},
|
1113
1128
|
AwaitExpression: checkArgumentWithPrecedence,
|
1114
1129
|
|
1115
1130
|
VariableDeclarator(node) {
|
@@ -21,7 +21,17 @@ module.exports = {
|
|
21
21
|
url: "https://eslint.org/docs/rules/no-inline-comments"
|
22
22
|
},
|
23
23
|
|
24
|
-
schema: [
|
24
|
+
schema: [
|
25
|
+
{
|
26
|
+
type: "object",
|
27
|
+
properties: {
|
28
|
+
ignorePattern: {
|
29
|
+
type: "string"
|
30
|
+
}
|
31
|
+
},
|
32
|
+
additionalProperties: false
|
33
|
+
}
|
34
|
+
],
|
25
35
|
|
26
36
|
messages: {
|
27
37
|
unexpectedInlineComment: "Unexpected comment inline with code."
|
@@ -30,6 +40,12 @@ module.exports = {
|
|
30
40
|
|
31
41
|
create(context) {
|
32
42
|
const sourceCode = context.getSourceCode();
|
43
|
+
const options = context.options[0];
|
44
|
+
let customIgnoreRegExp;
|
45
|
+
|
46
|
+
if (options && options.ignorePattern) {
|
47
|
+
customIgnoreRegExp = new RegExp(options.ignorePattern, "u");
|
48
|
+
}
|
33
49
|
|
34
50
|
/**
|
35
51
|
* Will check that comments are not on lines starting with or ending with code
|
@@ -51,6 +67,11 @@ module.exports = {
|
|
51
67
|
return;
|
52
68
|
}
|
53
69
|
|
70
|
+
// Matches the ignore pattern
|
71
|
+
if (customIgnoreRegExp && customIgnoreRegExp.test(node.value)) {
|
72
|
+
return;
|
73
|
+
}
|
74
|
+
|
54
75
|
// JSX Exception
|
55
76
|
if (
|
56
77
|
(isPreambleEmpty || preamble === "{") &&
|
@@ -80,9 +101,9 @@ module.exports = {
|
|
80
101
|
|
81
102
|
return {
|
82
103
|
Program() {
|
83
|
-
|
84
|
-
|
85
|
-
|
104
|
+
sourceCode.getAllComments()
|
105
|
+
.filter(token => token.type !== "Shebang")
|
106
|
+
.forEach(testCodeAroundComment);
|
86
107
|
}
|
87
108
|
};
|
88
109
|
}
|
@@ -163,6 +163,8 @@ module.exports = {
|
|
163
163
|
return node.type === "VariableDeclarator" &&
|
164
164
|
node.id.type === "Identifier" &&
|
165
165
|
node.init.type === "MemberExpression" &&
|
166
|
+
!node.init.computed &&
|
167
|
+
node.init.property.type === "Identifier" &&
|
166
168
|
node.id.name === node.init.property.name;
|
167
169
|
}
|
168
170
|
|
@@ -178,6 +180,11 @@ module.exports = {
|
|
178
180
|
const rightNode = node.init;
|
179
181
|
const sourceCode = context.getSourceCode();
|
180
182
|
|
183
|
+
// Don't fix if that would remove any comments. Only comments inside `rightNode.object` can be preserved.
|
184
|
+
if (sourceCode.getCommentsInside(node).length > sourceCode.getCommentsInside(rightNode.object).length) {
|
185
|
+
return null;
|
186
|
+
}
|
187
|
+
|
181
188
|
return fixer.replaceText(
|
182
189
|
node,
|
183
190
|
`{${rightNode.property.name}} = ${sourceCode.getText(rightNode.object)}`
|
@@ -37,7 +37,7 @@ const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]);
|
|
37
37
|
// A set of node types that can contain a list of statements
|
38
38
|
const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]);
|
39
39
|
|
40
|
-
const DECIMAL_INTEGER_PATTERN = /^(0|[1-9](?:_?\d)*)$/u;
|
40
|
+
const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u;
|
41
41
|
const OCTAL_ESCAPE_PATTERN = /^(?:[^\\]|\\[^0-7]|\\0(?![0-9]))*\\(?:[1-7]|0[0-9])/u;
|
42
42
|
|
43
43
|
const LOGICAL_ASSIGNMENT_OPERATORS = new Set(["&&=", "||=", "??="]);
|
@@ -1244,6 +1244,8 @@ module.exports = {
|
|
1244
1244
|
* 50 // true
|
1245
1245
|
* 5_000 // true
|
1246
1246
|
* 1_234_56 // true
|
1247
|
+
* 08 // true
|
1248
|
+
* 0192 // true
|
1247
1249
|
* 5. // false
|
1248
1250
|
* .5 // false
|
1249
1251
|
* 5.0 // false
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"<%- configName %>" is invalid syntax for a config specifier.
|
2
|
+
|
3
|
+
* If your intention is to extend from a configuration exported from the plugin, add the configuration name after a slash: e.g. "<%- configName %>/myConfig".
|
4
|
+
* If this is the name of a shareable config instead of a plugin, remove the "plugin:" prefix: i.e. "<%- configName.slice("plugin:".length) %>".
|
5
|
+
|
6
|
+
"<%- configName %>" was referenced from the config file in "<%- importerName %>".
|
7
|
+
|
8
|
+
If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "7.
|
3
|
+
"version": "7.11.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"bin": {
|
@@ -47,16 +47,16 @@
|
|
47
47
|
"bugs": "https://github.com/eslint/eslint/issues/",
|
48
48
|
"dependencies": {
|
49
49
|
"@babel/code-frame": "^7.0.0",
|
50
|
-
"@eslint/eslintrc": "^0.1.
|
50
|
+
"@eslint/eslintrc": "^0.1.3",
|
51
51
|
"ajv": "^6.10.0",
|
52
52
|
"chalk": "^4.0.0",
|
53
53
|
"cross-spawn": "^7.0.2",
|
54
54
|
"debug": "^4.0.1",
|
55
55
|
"doctrine": "^3.0.0",
|
56
56
|
"enquirer": "^2.3.5",
|
57
|
-
"eslint-scope": "^5.1.
|
57
|
+
"eslint-scope": "^5.1.1",
|
58
58
|
"eslint-utils": "^2.1.0",
|
59
|
-
"eslint-visitor-keys": "^
|
59
|
+
"eslint-visitor-keys": "^2.0.0",
|
60
60
|
"espree": "^7.3.0",
|
61
61
|
"esquery": "^1.2.0",
|
62
62
|
"esutils": "^2.0.2",
|
@@ -105,6 +105,7 @@
|
|
105
105
|
"eslint-release": "^2.0.0",
|
106
106
|
"eslump": "^2.0.0",
|
107
107
|
"esprima": "^4.0.1",
|
108
|
+
"fs-teardown": "^0.1.0",
|
108
109
|
"glob": "^7.1.6",
|
109
110
|
"jsdoc": "^3.5.5",
|
110
111
|
"karma": "^4.0.1",
|