eslint-plugin-svelte 2.23.0 → 2.24.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/README.md
CHANGED
|
@@ -184,6 +184,17 @@ module.exports = {
|
|
|
184
184
|
|
|
185
185
|
See also <https://github.com/ota-meshi/svelte-eslint-parser#readme>.
|
|
186
186
|
|
|
187
|
+
::: warning ❗ Attention
|
|
188
|
+
|
|
189
|
+
The TypeScript parser uses a singleton internally and it will only use the
|
|
190
|
+
options given to it when it was first initialized. If trying to change the
|
|
191
|
+
options for a different file or override, the parser will simply ignore the new
|
|
192
|
+
options (which may result in an error). See
|
|
193
|
+
[typescript-eslint/typescript-eslint#6778](https://github.com/typescript-eslint/typescript-eslint/issues/6778)
|
|
194
|
+
for some context.
|
|
195
|
+
|
|
196
|
+
:::
|
|
197
|
+
|
|
187
198
|
#### settings.svelte
|
|
188
199
|
|
|
189
200
|
You can change the behavior of this plugin with some settings.
|
|
@@ -327,17 +327,17 @@ function processIgnore(warnings, kind, stripStyleElements, ignoreComments, conte
|
|
|
327
327
|
if (!warning.code) {
|
|
328
328
|
continue;
|
|
329
329
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
break;
|
|
330
|
+
let node = getWarningNode(warning);
|
|
331
|
+
while (node) {
|
|
332
|
+
for (const comment of (0, extract_leading_comments_1.extractLeadingComments)(context, node).reverse()) {
|
|
333
|
+
const ignoreItem = ignoreComments.find((item) => item.token === comment && item.code === warning.code);
|
|
334
|
+
if (ignoreItem) {
|
|
335
|
+
unusedIgnores.delete(ignoreItem);
|
|
336
|
+
remainingWarning.delete(warning);
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
340
339
|
}
|
|
340
|
+
node = getIgnoreParent(node);
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
for (const node of stripStyleElements) {
|
|
@@ -353,6 +353,31 @@ function processIgnore(warnings, kind, stripStyleElements, ignoreComments, conte
|
|
|
353
353
|
warnings: [...remainingWarning],
|
|
354
354
|
unusedIgnores: [...unusedIgnores],
|
|
355
355
|
};
|
|
356
|
+
function getIgnoreParent(node) {
|
|
357
|
+
if (node.type !== "SvelteElement" &&
|
|
358
|
+
node.type !== "SvelteIfBlock" &&
|
|
359
|
+
node.type !== "SvelteKeyBlock" &&
|
|
360
|
+
node.type !== "SvelteEachBlock" &&
|
|
361
|
+
node.type !== "SvelteAwaitBlock") {
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
const parent = node.parent;
|
|
365
|
+
if (parent.type === "SvelteElseBlock") {
|
|
366
|
+
return parent.parent;
|
|
367
|
+
}
|
|
368
|
+
if (parent.type === "SvelteAwaitPendingBlock" ||
|
|
369
|
+
parent.type === "SvelteAwaitThenBlock" ||
|
|
370
|
+
parent.type === "SvelteAwaitCatchBlock") {
|
|
371
|
+
return parent.parent;
|
|
372
|
+
}
|
|
373
|
+
if (parent.type !== "SvelteElement" &&
|
|
374
|
+
parent.type !== "SvelteIfBlock" &&
|
|
375
|
+
parent.type !== "SvelteKeyBlock" &&
|
|
376
|
+
parent.type !== "SvelteEachBlock") {
|
|
377
|
+
return null;
|
|
378
|
+
}
|
|
379
|
+
return parent;
|
|
380
|
+
}
|
|
356
381
|
function getWarningNode(warning) {
|
|
357
382
|
const indexes = getWarningIndexes(warning);
|
|
358
383
|
if (indexes.start != null) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-svelte",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.0",
|
|
4
4
|
"description": "ESLint plugin for Svelte using AST",
|
|
5
5
|
"repository": "git+https://github.com/ota-meshi/eslint-plugin-svelte.git",
|
|
6
6
|
"homepage": "https://ota-meshi.github.io/eslint-plugin-svelte",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"postcss": "^8.4.5",
|
|
74
74
|
"postcss-load-config": "^3.1.4",
|
|
75
75
|
"postcss-safe-parser": "^6.0.0",
|
|
76
|
-
"svelte-eslint-parser": "^0.
|
|
76
|
+
"svelte-eslint-parser": "^0.25.0"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@1stg/browserslist-config": "^1.2.3",
|