eslint 8.25.0 → 8.27.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/lib/cli-engine/formatters/html.js +76 -51
- package/lib/cli.js +29 -8
- package/lib/config/default-config.js +1 -1
- package/lib/eslint/eslint-helpers.js +397 -94
- package/lib/eslint/flat-eslint.js +56 -45
- package/lib/linter/linter.js +1 -0
- package/lib/rules/comma-dangle.js +2 -2
- package/lib/rules/func-name-matching.js +2 -2
- package/lib/rules/getter-return.js +14 -8
- package/lib/rules/index.js +2 -0
- package/lib/rules/no-empty-static-block.js +47 -0
- package/lib/rules/no-empty.js +19 -2
- package/lib/rules/no-implicit-globals.js +5 -0
- package/lib/rules/no-misleading-character-class.js +4 -4
- package/lib/rules/no-new-native-nonconstructor.js +64 -0
- package/lib/rules/prefer-regex-literals.js +4 -4
- package/package.json +5 -4
@@ -43,85 +43,110 @@ function pageTemplate(it) {
|
|
43
43
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PScwIDAgMjk0LjgyNSAyNTguOTgyJyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnPg0KPHBhdGggZmlsbD0nIzgwODBGMicgZD0nTTk3LjAyMSw5OS4wMTZsNDguNDMyLTI3Ljk2MmMxLjIxMi0wLjcsMi43MDYtMC43LDMuOTE4LDBsNDguNDMzLDI3Ljk2MiBjMS4yMTEsMC43LDEuOTU5LDEuOTkzLDEuOTU5LDMuMzkzdjU1LjkyNGMwLDEuMzk5LTAuNzQ4LDIuNjkzLTEuOTU5LDMuMzk0bC00OC40MzMsMjcuOTYyYy0xLjIxMiwwLjctMi43MDYsMC43LTMuOTE4LDAgbC00OC40MzItMjcuOTYyYy0xLjIxMi0wLjctMS45NTktMS45OTQtMS45NTktMy4zOTR2LTU1LjkyNEM5NS4wNjMsMTAxLjAwOSw5NS44MSw5OS43MTYsOTcuMDIxLDk5LjAxNicvPg0KPHBhdGggZmlsbD0nIzRCMzJDMycgZD0nTTI3My4zMzYsMTI0LjQ4OEwyMTUuNDY5LDIzLjgxNmMtMi4xMDItMy42NC01Ljk4NS02LjMyNS0xMC4xODgtNi4zMjVIODkuNTQ1IGMtNC4yMDQsMC04LjA4OCwyLjY4NS0xMC4xOSw2LjMyNWwtNTcuODY3LDEwMC40NWMtMi4xMDIsMy42NDEtMi4xMDIsOC4yMzYsMCwxMS44NzdsNTcuODY3LDk5Ljg0NyBjMi4xMDIsMy42NCw1Ljk4Niw1LjUwMSwxMC4xOSw1LjUwMWgxMTUuNzM1YzQuMjAzLDAsOC4wODctMS44MDUsMTAuMTg4LTUuNDQ2bDU3Ljg2Ny0xMDAuMDEgQzI3NS40MzksMTMyLjM5NiwyNzUuNDM5LDEyOC4xMjgsMjczLjMzNiwxMjQuNDg4IE0yMjUuNDE5LDE3Mi44OThjMCwxLjQ4LTAuODkxLDIuODQ5LTIuMTc0LDMuNTlsLTczLjcxLDQyLjUyNyBjLTEuMjgyLDAuNzQtMi44ODgsMC43NC00LjE3LDBsLTczLjc2Ny00Mi41MjdjLTEuMjgyLTAuNzQxLTIuMTc5LTIuMTA5LTIuMTc5LTMuNTlWODcuODQzYzAtMS40ODEsMC44ODQtMi44NDksMi4xNjctMy41OSBsNzMuNzA3LTQyLjUyN2MxLjI4Mi0wLjc0MSwyLjg4Ni0wLjc0MSw0LjE2OCwwbDczLjc3Miw0Mi41MjdjMS4yODMsMC43NDEsMi4xODYsMi4xMDksMi4xODYsMy41OVYxNzIuODk4eicvPg0KPC9zdmc+">
|
44
44
|
<style>
|
45
45
|
body {
|
46
|
-
font-family:Arial, "Helvetica Neue", Helvetica, sans-serif;
|
47
|
-
font-size:16px;
|
48
|
-
font-weight:normal;
|
49
|
-
margin:0;
|
50
|
-
padding:0;
|
51
|
-
color
|
46
|
+
font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
|
47
|
+
font-size: 16px;
|
48
|
+
font-weight: normal;
|
49
|
+
margin: 0;
|
50
|
+
padding: 0;
|
51
|
+
color: #333;
|
52
52
|
}
|
53
|
+
|
53
54
|
#overview {
|
54
|
-
padding:20px 30px
|
55
|
+
padding: 20px 30px;
|
55
56
|
}
|
56
|
-
|
57
|
-
|
57
|
+
|
58
|
+
td,
|
59
|
+
th {
|
60
|
+
padding: 5px 10px;
|
58
61
|
}
|
62
|
+
|
59
63
|
h1 {
|
60
|
-
margin:0
|
64
|
+
margin: 0;
|
61
65
|
}
|
66
|
+
|
62
67
|
table {
|
63
|
-
margin:30px;
|
64
|
-
width:calc(100% - 60px);
|
65
|
-
max-width:1000px;
|
66
|
-
border-radius:5px;
|
67
|
-
border:1px solid #ddd;
|
68
|
-
border-spacing:
|
68
|
+
margin: 30px;
|
69
|
+
width: calc(100% - 60px);
|
70
|
+
max-width: 1000px;
|
71
|
+
border-radius: 5px;
|
72
|
+
border: 1px solid #ddd;
|
73
|
+
border-spacing: 0;
|
69
74
|
}
|
75
|
+
|
70
76
|
th {
|
71
|
-
font-weight:400;
|
72
|
-
font-size:medium;
|
73
|
-
text-align:left;
|
74
|
-
cursor:pointer
|
77
|
+
font-weight: 400;
|
78
|
+
font-size: medium;
|
79
|
+
text-align: left;
|
80
|
+
cursor: pointer;
|
75
81
|
}
|
76
|
-
|
77
|
-
|
82
|
+
|
83
|
+
td.clr-1,
|
84
|
+
td.clr-2,
|
85
|
+
th span {
|
86
|
+
font-weight: 700;
|
78
87
|
}
|
88
|
+
|
79
89
|
th span {
|
80
|
-
float:right;
|
81
|
-
margin-left:20px
|
90
|
+
float: right;
|
91
|
+
margin-left: 20px;
|
82
92
|
}
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
93
|
+
|
94
|
+
th span::after {
|
95
|
+
content: "";
|
96
|
+
clear: both;
|
97
|
+
display: block;
|
87
98
|
}
|
99
|
+
|
88
100
|
tr:last-child td {
|
89
|
-
border-bottom:none
|
101
|
+
border-bottom: none;
|
90
102
|
}
|
91
|
-
|
92
|
-
|
103
|
+
|
104
|
+
tr td:first-child,
|
105
|
+
tr td:last-child {
|
106
|
+
color: #9da0a4;
|
93
107
|
}
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
108
|
+
|
109
|
+
#overview.bg-0,
|
110
|
+
tr.bg-0 th {
|
111
|
+
color: #468847;
|
112
|
+
background: #dff0d8;
|
113
|
+
border-bottom: 1px solid #d6e9c6;
|
98
114
|
}
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
115
|
+
|
116
|
+
#overview.bg-1,
|
117
|
+
tr.bg-1 th {
|
118
|
+
color: #f0ad4e;
|
119
|
+
background: #fcf8e3;
|
120
|
+
border-bottom: 1px solid #fbeed5;
|
103
121
|
}
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
122
|
+
|
123
|
+
#overview.bg-2,
|
124
|
+
tr.bg-2 th {
|
125
|
+
color: #b94a48;
|
126
|
+
background: #f2dede;
|
127
|
+
border-bottom: 1px solid #eed3d7;
|
108
128
|
}
|
129
|
+
|
109
130
|
td {
|
110
|
-
border-bottom:1px solid #ddd
|
131
|
+
border-bottom: 1px solid #ddd;
|
111
132
|
}
|
133
|
+
|
112
134
|
td.clr-1 {
|
113
|
-
color
|
135
|
+
color: #f0ad4e;
|
114
136
|
}
|
137
|
+
|
115
138
|
td.clr-2 {
|
116
|
-
color
|
139
|
+
color: #b94a48;
|
117
140
|
}
|
141
|
+
|
118
142
|
td a {
|
119
|
-
color
|
120
|
-
text-decoration:none
|
143
|
+
color: #3a33d1;
|
144
|
+
text-decoration: none;
|
121
145
|
}
|
146
|
+
|
122
147
|
td a:hover {
|
123
|
-
color
|
124
|
-
text-decoration:underline
|
148
|
+
color: #272296;
|
149
|
+
text-decoration: underline;
|
125
150
|
}
|
126
151
|
</style>
|
127
152
|
</head>
|
@@ -214,7 +239,7 @@ function messageTemplate(it) {
|
|
214
239
|
} = it;
|
215
240
|
|
216
241
|
return `
|
217
|
-
<tr style="display:none" class="f-${parentIndex}">
|
242
|
+
<tr style="display: none;" class="f-${parentIndex}">
|
218
243
|
<td>${lineNumber}:${columnNumber}</td>
|
219
244
|
<td class="clr-${severityNumber}">${severityName}</td>
|
220
245
|
<td>${encodeHTML(message)}</td>
|
package/lib/cli.js
CHANGED
@@ -143,12 +143,6 @@ async function translateOptions({
|
|
143
143
|
overrideConfig[0].plugins = plugins;
|
144
144
|
}
|
145
145
|
|
146
|
-
if (ignorePattern) {
|
147
|
-
overrideConfig.push({
|
148
|
-
ignores: ignorePattern
|
149
|
-
});
|
150
|
-
}
|
151
|
-
|
152
146
|
} else {
|
153
147
|
overrideConfigFile = config;
|
154
148
|
|
@@ -187,7 +181,9 @@ async function translateOptions({
|
|
187
181
|
reportUnusedDisableDirectives: reportUnusedDisableDirectives ? "error" : void 0
|
188
182
|
};
|
189
183
|
|
190
|
-
if (configType
|
184
|
+
if (configType === "flat") {
|
185
|
+
options.ignorePatterns = ignorePattern;
|
186
|
+
} else {
|
191
187
|
options.resolvePluginsRelativeTo = resolvePluginsRelativeTo;
|
192
188
|
options.rulePaths = rulesdir;
|
193
189
|
options.useEslintrc = eslintrc;
|
@@ -279,6 +275,31 @@ async function printResults(engine, results, format, outputFile, resultsMeta) {
|
|
279
275
|
return true;
|
280
276
|
}
|
281
277
|
|
278
|
+
/**
|
279
|
+
* Returns whether flat config should be used.
|
280
|
+
* @param {boolean} [allowFlatConfig] Whether or not to allow flat config.
|
281
|
+
* @returns {Promise<boolean>} Where flat config should be used.
|
282
|
+
*/
|
283
|
+
async function shouldUseFlatConfig(allowFlatConfig) {
|
284
|
+
if (!allowFlatConfig) {
|
285
|
+
return false;
|
286
|
+
}
|
287
|
+
|
288
|
+
switch (process.env.ESLINT_USE_FLAT_CONFIG) {
|
289
|
+
case "true":
|
290
|
+
return true;
|
291
|
+
case "false":
|
292
|
+
return false;
|
293
|
+
default:
|
294
|
+
|
295
|
+
/*
|
296
|
+
* If neither explicitly enabled nor disabled, then use the presence
|
297
|
+
* of a flat config file to determine enablement.
|
298
|
+
*/
|
299
|
+
return !!(await findFlatConfigFile(process.cwd()));
|
300
|
+
}
|
301
|
+
}
|
302
|
+
|
282
303
|
//------------------------------------------------------------------------------
|
283
304
|
// Public Interface
|
284
305
|
//------------------------------------------------------------------------------
|
@@ -308,7 +329,7 @@ const cli = {
|
|
308
329
|
* switch to flat config we can remove this logic.
|
309
330
|
*/
|
310
331
|
|
311
|
-
const usingFlatConfig =
|
332
|
+
const usingFlatConfig = await shouldUseFlatConfig(allowFlatConfig);
|
312
333
|
|
313
334
|
debug("Using flat config?", usingFlatConfig);
|
314
335
|
|