eslint-plugin-svelte 2.45.1 → 2.46.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/README.md +1 -39
- package/lib/index.js +17 -7
- package/lib/meta.d.ts +1 -1
- package/lib/meta.js +1 -1
- package/lib/processor/index.js +17 -7
- package/lib/rules/indent-helpers/index.js +17 -7
- package/lib/rules/no-inner-declarations.js +1 -0
- package/lib/shared/svelte-compile-warns/index.js +17 -7
- package/lib/utils/ast-utils.js +17 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`eslint-plugin-svelte` is the official [ESLint] plugin for [Svelte].
|
|
4
4
|
It provides many unique check rules by using the template AST.
|
|
5
|
-
You can check on the [Online DEMO](https://
|
|
5
|
+
You can check on the [Online DEMO](https://sveltejs.github.io/eslint-plugin-svelte/playground/).
|
|
6
6
|
|
|
7
7
|
**_We are working on experimental support for Svelte v5, but may break with new versions of Svelte v5._**
|
|
8
8
|
|
|
@@ -229,36 +229,6 @@ for some context.
|
|
|
229
229
|
|
|
230
230
|
:::
|
|
231
231
|
|
|
232
|
-
#### Specify `svelte.config.js`
|
|
233
|
-
|
|
234
|
-
If you are using `eslint.config.js`, we recommend that you import and specify `svelte.config.js`.
|
|
235
|
-
By specifying it, some rules of `eslint-plugin-svelte` will read it and try to behave well for you by default.
|
|
236
|
-
Some Svelte configurations will be statically loaded from `svelte.config.js` even if you don't specify it, but you need to specify it to make it work better.
|
|
237
|
-
|
|
238
|
-
Example **eslint.config.js**:
|
|
239
|
-
|
|
240
|
-
```js
|
|
241
|
-
import eslintPluginSvelte from 'eslint-plugin-svelte';
|
|
242
|
-
import svelteConfig from './svelte.config.js';
|
|
243
|
-
export default [
|
|
244
|
-
...eslintPluginSvelte.configs['flat/recommended'],
|
|
245
|
-
{
|
|
246
|
-
files: [
|
|
247
|
-
'**/*.svelte',
|
|
248
|
-
'*.svelte'
|
|
249
|
-
// Add more files if you need.
|
|
250
|
-
// '**/*.svelte.ts', '*.svelte.ts', '**/*.svelte.js', '*.svelte.js',
|
|
251
|
-
],
|
|
252
|
-
languageOptions: {
|
|
253
|
-
parserOptions: {
|
|
254
|
-
// Specify the `svelte.config.js`.
|
|
255
|
-
svelteConfig
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
];
|
|
260
|
-
```
|
|
261
|
-
|
|
262
232
|
#### settings.svelte
|
|
263
233
|
|
|
264
234
|
You can change the behavior of this plugin with some settings.
|
|
@@ -304,12 +274,6 @@ Specifies options for Svelte compile. Effects rules that use Svelte compile. The
|
|
|
304
274
|
|
|
305
275
|
#### settings.svelte.kit
|
|
306
276
|
|
|
307
|
-
::: warning
|
|
308
|
-
|
|
309
|
-
Even if you don't specify `settings.svelte.kit`, the rules will try to load information from `svelte.config.js`, so specify `settings.svelte.kit` if the default doesn't work.
|
|
310
|
-
|
|
311
|
-
:::
|
|
312
|
-
|
|
313
277
|
If you use SvelteKit with not default configuration, you need to set below configurations.
|
|
314
278
|
The schema is subset of SvelteKit's configuration.
|
|
315
279
|
Therefore please check [SvelteKit docs](https://kit.svelte.dev/docs/configuration) for more details.
|
|
@@ -419,7 +383,6 @@ These rules relate to better ways of doing things to help you avoid problems:
|
|
|
419
383
|
| [svelte/no-ignored-unsubscribe](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-ignored-unsubscribe/) | disallow ignoring the unsubscribe method returned by the `subscribe()` on Svelte stores. | |
|
|
420
384
|
| [svelte/no-immutable-reactive-statements](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-immutable-reactive-statements/) | disallow reactive statements that don't reference reactive values. | |
|
|
421
385
|
| [svelte/no-inline-styles](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-inline-styles/) | disallow attributes and directives that produce inline styles | |
|
|
422
|
-
| [svelte/no-inspect](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-inspect/) | Warns against the use of `$inspect` directive | |
|
|
423
386
|
| [svelte/no-reactive-functions](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-functions/) | it's not necessary to define functions in reactive statements | :bulb: |
|
|
424
387
|
| [svelte/no-reactive-literals](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-reactive-literals/) | don't assign literal values in reactive statements | :bulb: |
|
|
425
388
|
| [svelte/no-svelte-internal](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-svelte-internal/) | svelte/internal will be removed in Svelte 6. | |
|
|
@@ -441,7 +404,6 @@ These rules relate to style guidelines, and are therefore quite subjective:
|
|
|
441
404
|
|:--------|:------------|:---|
|
|
442
405
|
| [svelte/derived-has-same-inputs-outputs](https://sveltejs.github.io/eslint-plugin-svelte/rules/derived-has-same-inputs-outputs/) | derived store should use same variable names between values and callback | |
|
|
443
406
|
| [svelte/first-attribute-linebreak](https://sveltejs.github.io/eslint-plugin-svelte/rules/first-attribute-linebreak/) | enforce the location of first attribute | :wrench: |
|
|
444
|
-
| [svelte/html-closing-bracket-new-line](https://sveltejs.github.io/eslint-plugin-svelte/rules/html-closing-bracket-new-line/) | Require or disallow a line break before tag's closing brackets | :wrench: |
|
|
445
407
|
| [svelte/html-closing-bracket-spacing](https://sveltejs.github.io/eslint-plugin-svelte/rules/html-closing-bracket-spacing/) | require or disallow a space before tag's closing brackets | :wrench: |
|
|
446
408
|
| [svelte/html-quotes](https://sveltejs.github.io/eslint-plugin-svelte/rules/html-quotes/) | enforce quotes style of HTML attributes | :wrench: |
|
|
447
409
|
| [svelte/html-self-closing](https://sveltejs.github.io/eslint-plugin-svelte/rules/html-self-closing/) | enforce self-closing style | :wrench: |
|
package/lib/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/lib/meta.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "eslint-plugin-svelte";
|
|
2
|
-
export declare const version = "2.
|
|
2
|
+
export declare const version = "2.46.1";
|
package/lib/meta.js
CHANGED
package/lib/processor/index.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.supportsAutofix = exports.meta = void 0;
|
|
27
37
|
exports.preprocess = preprocess;
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.defineVisitor = defineVisitor;
|
|
27
37
|
const SV = __importStar(require("./svelte"));
|
|
@@ -5,6 +5,7 @@ const eslint_core_1 = require("../utils/eslint-core");
|
|
|
5
5
|
const coreRule = (0, eslint_core_1.getCoreRule)('no-inner-declarations');
|
|
6
6
|
exports.default = (0, utils_1.createRule)('no-inner-declarations', {
|
|
7
7
|
meta: {
|
|
8
|
+
...coreRule.meta,
|
|
8
9
|
docs: {
|
|
9
10
|
description: 'disallow variable or `function` declarations in nested blocks',
|
|
10
11
|
category: 'Extension Rules',
|
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
37
|
};
|
package/lib/utils/ast-utils.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.equalTokens = equalTokens;
|
|
27
37
|
exports.getStringIfConstant = getStringIfConstant;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-svelte",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.46.1",
|
|
4
4
|
"description": "ESLint plugin for Svelte using AST",
|
|
5
5
|
"repository": "git+https://github.com/sveltejs/eslint-plugin-svelte.git",
|
|
6
6
|
"homepage": "https://sveltejs.github.io/eslint-plugin-svelte",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
],
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"eslint": "^7.0.0 || ^8.0.0-0 || ^9.0.0-0",
|
|
27
|
-
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0
|
|
27
|
+
"svelte": "^3.37.0 || ^4.0.0 || ^5.0.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependenciesMeta": {
|
|
30
30
|
"svelte": {
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
"@jridgewell/sourcemap-codec": "^1.4.15",
|
|
37
37
|
"eslint-compat-utils": "^0.5.1",
|
|
38
38
|
"esutils": "^2.0.3",
|
|
39
|
-
"known-css-properties": "^0.
|
|
39
|
+
"known-css-properties": "^0.35.0",
|
|
40
40
|
"postcss": "^8.4.38",
|
|
41
41
|
"postcss-load-config": "^3.1.4",
|
|
42
42
|
"postcss-safe-parser": "^6.0.0",
|
|
43
43
|
"postcss-selector-parser": "^6.1.0",
|
|
44
44
|
"semver": "^7.6.2",
|
|
45
|
-
"svelte-eslint-parser": "^0.
|
|
45
|
+
"svelte-eslint-parser": "^0.43.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@babel/core": "^7.25.8",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
"postcss-nested": "^6.2.0",
|
|
74
74
|
"sass": "^1.79.5",
|
|
75
75
|
"source-map-js": "^1.2.1",
|
|
76
|
-
"stylus": "^0.
|
|
77
|
-
"svelte": "^5.0.0
|
|
76
|
+
"stylus": "^0.64.0",
|
|
77
|
+
"svelte": "^5.0.0",
|
|
78
78
|
"svelte-i18n": "^4.0.0",
|
|
79
79
|
"type-coverage": "^2.29.7",
|
|
80
80
|
"yaml": "^2.6.0"
|