eslint-plugin-svelte 2.36.0 → 2.37.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/configs/all.js +1 -0
- package/lib/configs/base.js +5 -1
- package/lib/configs/flat/all.js +1 -0
- package/lib/configs/flat/base.js +7 -1
- package/lib/configs/flat/prettier.js +4 -0
- package/lib/configs/flat/recommended.js +4 -0
- package/lib/configs/prettier.js +4 -0
- package/lib/configs/recommended.js +4 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/meta.d.ts +1 -1
- package/lib/meta.js +4 -1
- package/lib/processor/index.d.ts +2 -0
- package/lib/processor/index.js +3 -0
- package/lib/rule-types.d.ts +487 -0
- package/lib/rule-types.js +5 -0
- package/lib/rules/@typescript-eslint/no-unnecessary-condition.js +170 -4
- package/lib/rules/block-lang.js +4 -0
- package/lib/rules/button-has-type.js +13 -1
- package/lib/rules/comment-directive.js +21 -1
- package/lib/rules/derived-has-same-inputs-outputs.js +10 -0
- package/lib/rules/first-attribute-linebreak.js +3 -0
- package/lib/rules/html-closing-bracket-spacing.js +6 -0
- package/lib/rules/html-quotes.js +11 -1
- package/lib/rules/html-self-closing.js +13 -0
- package/lib/rules/indent-helpers/ast.d.ts +6 -0
- package/lib/rules/indent-helpers/ast.js +6 -0
- package/lib/rules/indent-helpers/commons.d.ts +11 -0
- package/lib/rules/indent-helpers/commons.js +15 -0
- package/lib/rules/indent-helpers/es.d.ts +6 -0
- package/lib/rules/indent-helpers/es.js +44 -1
- package/lib/rules/indent-helpers/index.d.ts +7 -0
- package/lib/rules/indent-helpers/index.js +30 -0
- package/lib/rules/indent-helpers/offset-context.d.ts +31 -0
- package/lib/rules/indent-helpers/offset-context.js +39 -7
- package/lib/rules/indent-helpers/svelte.d.ts +6 -0
- package/lib/rules/indent-helpers/svelte.js +53 -0
- package/lib/rules/indent-helpers/ts.d.ts +6 -0
- package/lib/rules/indent-helpers/ts.js +143 -3
- package/lib/rules/indent.js +1 -1
- package/lib/rules/infinite-reactive-loop.js +58 -1
- package/lib/rules/max-attributes-per-line.js +12 -0
- package/lib/rules/mustache-spacing.js +5 -0
- package/lib/rules/no-at-html-tags.js +1 -1
- package/lib/rules/no-dom-manipulating.js +28 -20
- package/lib/rules/no-dupe-else-if-blocks.js +33 -1
- package/lib/rules/no-dupe-style-properties.js +2 -0
- package/lib/rules/no-dynamic-slot-name.js +4 -0
- package/lib/rules/no-export-load-in-svelte-module-in-kit-pages.js +5 -0
- package/lib/rules/no-extra-reactive-curlies.js +3 -0
- package/lib/rules/no-goto-without-base.js +1 -0
- package/lib/rules/no-immutable-reactive-statements.js +20 -0
- package/lib/rules/no-not-function-handler.js +3 -1
- package/lib/rules/no-object-in-text-mustaches.js +2 -1
- package/lib/rules/no-reactive-functions.js +4 -1
- package/lib/rules/no-reactive-literals.js +7 -0
- package/lib/rules/no-reactive-reassign.js +21 -2
- package/lib/rules/no-shorthand-style-property-overrides.js +2 -0
- package/lib/rules/no-spaces-around-equal-signs-in-attribute.js +6 -0
- package/lib/rules/no-store-async.js +2 -0
- package/lib/rules/no-target-blank.js +4 -0
- package/lib/rules/no-trailing-spaces.js +6 -0
- package/lib/rules/no-unknown-style-directive-property.js +1 -0
- package/lib/rules/no-unused-class-name.js +9 -0
- package/lib/rules/no-useless-mustaches.js +14 -1
- package/lib/rules/prefer-class-directive.js +52 -0
- package/lib/rules/prefer-destructured-store-props.js +24 -3
- package/lib/rules/prefer-style-directive.js +14 -0
- package/lib/rules/reference-helpers/svelte-store.d.ts +4 -0
- package/lib/rules/reference-helpers/svelte-store.js +27 -0
- package/lib/rules/require-store-reactive-access.js +56 -0
- package/lib/rules/shorthand-attribute.js +1 -1
- package/lib/rules/shorthand-directive.js +9 -0
- package/lib/rules/sort-attributes.js +33 -0
- package/lib/rules/spaced-html-comment.js +1 -0
- package/lib/rules/system.js +1 -0
- package/lib/rules/valid-compile.js +5 -0
- package/lib/rules/valid-each-key.js +3 -0
- package/lib/rules/valid-prop-names-in-kit-pages.js +6 -0
- package/lib/shared/comment-directives.js +15 -1
- package/lib/shared/index.d.ts +3 -0
- package/lib/shared/index.js +3 -0
- package/lib/shared/svelte-compile-warns/extract-leading-comments.d.ts +1 -0
- package/lib/shared/svelte-compile-warns/extract-leading-comments.js +2 -0
- package/lib/shared/svelte-compile-warns/ignore-comment.d.ts +1 -0
- package/lib/shared/svelte-compile-warns/ignore-comment.js +4 -1
- package/lib/shared/svelte-compile-warns/index.d.ts +3 -0
- package/lib/shared/svelte-compile-warns/index.js +44 -5
- package/lib/shared/svelte-compile-warns/transform/babel.d.ts +4 -0
- package/lib/shared/svelte-compile-warns/transform/babel.js +7 -0
- package/lib/shared/svelte-compile-warns/transform/less.d.ts +3 -0
- package/lib/shared/svelte-compile-warns/transform/less.js +6 -0
- package/lib/shared/svelte-compile-warns/transform/postcss.d.ts +3 -0
- package/lib/shared/svelte-compile-warns/transform/postcss.js +4 -0
- package/lib/shared/svelte-compile-warns/transform/sass.d.ts +3 -0
- package/lib/shared/svelte-compile-warns/transform/sass.js +6 -0
- package/lib/shared/svelte-compile-warns/transform/stylus.d.ts +3 -0
- package/lib/shared/svelte-compile-warns/transform/stylus.js +6 -0
- package/lib/shared/svelte-compile-warns/transform/typescript.d.ts +4 -0
- package/lib/shared/svelte-compile-warns/transform/typescript.js +7 -0
- package/lib/types-for-node.js +7 -0
- package/lib/utils/ast-utils.d.ts +50 -0
- package/lib/utils/ast-utils.js +68 -2
- package/lib/utils/cache.d.ts +10 -0
- package/lib/utils/cache.js +21 -0
- package/lib/utils/compat.d.ts +17 -0
- package/lib/utils/compat.js +19 -0
- package/lib/utils/css-utils/style-attribute.d.ts +3 -0
- package/lib/utils/css-utils/style-attribute.js +16 -0
- package/lib/utils/css-utils/template-tokenize.d.ts +1 -0
- package/lib/utils/css-utils/template-tokenize.js +2 -0
- package/lib/utils/css-utils/utils.d.ts +9 -0
- package/lib/utils/css-utils/utils.js +9 -0
- package/lib/utils/eslint-core.d.ts +12 -0
- package/lib/utils/eslint-core.js +14 -0
- package/lib/utils/get-package-json.d.ts +10 -0
- package/lib/utils/get-package-json.js +20 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.js +5 -0
- package/lib/utils/lines-and-columns.js +3 -0
- package/lib/utils/load-module.d.ts +4 -0
- package/lib/utils/load-module.js +10 -0
- package/lib/utils/regexp.d.ts +13 -0
- package/lib/utils/regexp.js +13 -0
- package/lib/utils/svelte-kit.d.ts +8 -0
- package/lib/utils/svelte-kit.js +26 -0
- package/lib/utils/ts-utils/index.d.ts +79 -0
- package/lib/utils/ts-utils/index.js +97 -0
- package/package.json +4 -3
package/lib/configs/all.js
CHANGED
|
@@ -11,6 +11,7 @@ module.exports = {
|
|
|
11
11
|
rules: Object.fromEntries(rules_1.rules
|
|
12
12
|
.map((rule) => [`svelte/${rule.meta.docs.ruleName}`, 'error'])
|
|
13
13
|
.filter(([ruleName]) => ![
|
|
14
|
+
// Does not work without options.
|
|
14
15
|
'svelte/no-restricted-html-elements'
|
|
15
16
|
].includes(ruleName)))
|
|
16
17
|
};
|
package/lib/configs/base.js
CHANGED
|
@@ -6,8 +6,12 @@ module.exports = {
|
|
|
6
6
|
files: ['*.svelte'],
|
|
7
7
|
parser: require.resolve('svelte-eslint-parser'),
|
|
8
8
|
rules: {
|
|
9
|
-
|
|
9
|
+
// ESLint core rules known to cause problems with `.svelte`.
|
|
10
|
+
'no-inner-declarations': 'off', // The AST generated by svelte-eslint-parser will false positives in it rule because the root node of the script is not the `Program`.
|
|
11
|
+
// "no-irregular-whitespace": "off",
|
|
12
|
+
// Self assign is one of way to update reactive value in Svelte.
|
|
10
13
|
'no-self-assign': 'off',
|
|
14
|
+
// eslint-plugin-svelte rules
|
|
11
15
|
'svelte/comment-directive': 'error',
|
|
12
16
|
'svelte/system': 'error'
|
|
13
17
|
}
|
package/lib/configs/flat/all.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.default = [
|
|
|
11
11
|
rules: Object.fromEntries(rules_1.rules
|
|
12
12
|
.map((rule) => [`svelte/${rule.meta.docs.ruleName}`, 'error'])
|
|
13
13
|
.filter(([ruleName]) => ![
|
|
14
|
+
// Does not work without options.
|
|
14
15
|
'svelte/no-restricted-html-elements'
|
|
15
16
|
].includes(ruleName)))
|
|
16
17
|
}
|
package/lib/configs/flat/base.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.default = [
|
|
|
4
4
|
{
|
|
5
5
|
plugins: {
|
|
6
6
|
get svelte() {
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
|
|
7
8
|
return require('../../index');
|
|
8
9
|
}
|
|
9
10
|
}
|
|
@@ -11,11 +12,16 @@ exports.default = [
|
|
|
11
12
|
{
|
|
12
13
|
files: ['*.svelte', '**/*.svelte'],
|
|
13
14
|
languageOptions: {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports -- ignore
|
|
14
16
|
parser: require('svelte-eslint-parser')
|
|
15
17
|
},
|
|
16
18
|
rules: {
|
|
17
|
-
|
|
19
|
+
// ESLint core rules known to cause problems with `.svelte`.
|
|
20
|
+
'no-inner-declarations': 'off', // The AST generated by svelte-eslint-parser will false positives in it rule because the root node of the script is not the `Program`.
|
|
21
|
+
// "no-irregular-whitespace": "off",
|
|
22
|
+
// Self assign is one of way to update reactive value in Svelte.
|
|
18
23
|
'no-self-assign': 'off',
|
|
24
|
+
// eslint-plugin-svelte rules
|
|
19
25
|
'svelte/comment-directive': 'error',
|
|
20
26
|
'svelte/system': 'error'
|
|
21
27
|
},
|
|
@@ -3,11 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// IMPORTANT!
|
|
7
|
+
// This file has been automatically generated,
|
|
8
|
+
// in order to update its content execute "pnpm run update"
|
|
6
9
|
const base_1 = __importDefault(require("./base"));
|
|
7
10
|
exports.default = [
|
|
8
11
|
...base_1.default,
|
|
9
12
|
{
|
|
10
13
|
rules: {
|
|
14
|
+
// eslint-plugin-svelte rules
|
|
11
15
|
'svelte/first-attribute-linebreak': 'off',
|
|
12
16
|
'svelte/html-closing-bracket-spacing': 'off',
|
|
13
17
|
'svelte/html-quotes': 'off',
|
|
@@ -3,11 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
// IMPORTANT!
|
|
7
|
+
// This file has been automatically generated,
|
|
8
|
+
// in order to update its content execute "pnpm run update"
|
|
6
9
|
const base_1 = __importDefault(require("./base"));
|
|
7
10
|
exports.default = [
|
|
8
11
|
...base_1.default,
|
|
9
12
|
{
|
|
10
13
|
rules: {
|
|
14
|
+
// eslint-plugin-svelte rules
|
|
11
15
|
'svelte/comment-directive': 'error',
|
|
12
16
|
'svelte/no-at-debug-tags': 'warn',
|
|
13
17
|
'svelte/no-at-html-tags': 'error',
|
package/lib/configs/prettier.js
CHANGED
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
// IMPORTANT!
|
|
6
|
+
// This file has been automatically generated,
|
|
7
|
+
// in order to update its content execute "pnpm run update"
|
|
5
8
|
const path_1 = __importDefault(require("path"));
|
|
6
9
|
const base = require.resolve('./base');
|
|
7
10
|
const baseExtend = path_1.default.extname(`${base}`) === '.ts' ? 'plugin:svelte/base' : base;
|
|
8
11
|
module.exports = {
|
|
9
12
|
extends: [baseExtend],
|
|
10
13
|
rules: {
|
|
14
|
+
// eslint-plugin-svelte rules
|
|
11
15
|
'svelte/first-attribute-linebreak': 'off',
|
|
12
16
|
'svelte/html-closing-bracket-spacing': 'off',
|
|
13
17
|
'svelte/html-quotes': 'off',
|
|
@@ -2,12 +2,16 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
// IMPORTANT!
|
|
6
|
+
// This file has been automatically generated,
|
|
7
|
+
// in order to update its content execute "pnpm run update"
|
|
5
8
|
const path_1 = __importDefault(require("path"));
|
|
6
9
|
const base = require.resolve('./base');
|
|
7
10
|
const baseExtend = path_1.default.extname(`${base}`) === '.ts' ? 'plugin:svelte/base' : base;
|
|
8
11
|
module.exports = {
|
|
9
12
|
extends: [baseExtend],
|
|
10
13
|
rules: {
|
|
14
|
+
// eslint-plugin-svelte rules
|
|
11
15
|
'svelte/comment-directive': 'error',
|
|
12
16
|
'svelte/no-at-debug-tags': 'warn',
|
|
13
17
|
'svelte/no-at-html-tags': 'error',
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -25,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
|
+
require("./rule-types");
|
|
28
29
|
const rules_1 = require("./utils/rules");
|
|
29
30
|
const base_1 = __importDefault(require("./configs/base"));
|
|
30
31
|
const recommended_1 = __importDefault(require("./configs/recommended"));
|
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.37.0";
|
package/lib/meta.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.version = exports.name = void 0;
|
|
4
|
+
// IMPORTANT!
|
|
5
|
+
// This file has been automatically generated,
|
|
6
|
+
// in order to update its content execute "pnpm run update"
|
|
4
7
|
exports.name = 'eslint-plugin-svelte';
|
|
5
|
-
exports.version = '2.
|
|
8
|
+
exports.version = '2.37.0';
|
package/lib/processor/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Linter } from 'eslint';
|
|
2
2
|
export * as meta from '../meta';
|
|
3
|
+
/** preprocess */
|
|
3
4
|
export declare function preprocess(code: string, filename: string): string[];
|
|
5
|
+
/** postprocess */
|
|
4
6
|
export declare function postprocess([messages]: Linter.LintMessage[][], filename: string): Linter.LintMessage[];
|
|
5
7
|
export declare const supportsAutofix = true;
|
package/lib/processor/index.js
CHANGED
|
@@ -26,6 +26,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.supportsAutofix = exports.postprocess = exports.preprocess = exports.meta = void 0;
|
|
27
27
|
const shared_1 = require("../shared");
|
|
28
28
|
exports.meta = __importStar(require("../meta"));
|
|
29
|
+
/** preprocess */
|
|
29
30
|
function preprocess(code, filename) {
|
|
30
31
|
if (filename) {
|
|
31
32
|
(0, shared_1.beginShared)(filename);
|
|
@@ -33,6 +34,7 @@ function preprocess(code, filename) {
|
|
|
33
34
|
return [code];
|
|
34
35
|
}
|
|
35
36
|
exports.preprocess = preprocess;
|
|
37
|
+
/** postprocess */
|
|
36
38
|
function postprocess([messages], filename) {
|
|
37
39
|
const shared = (0, shared_1.terminateShared)(filename);
|
|
38
40
|
if (shared) {
|
|
@@ -42,6 +44,7 @@ function postprocess([messages], filename) {
|
|
|
42
44
|
}
|
|
43
45
|
exports.postprocess = postprocess;
|
|
44
46
|
exports.supportsAutofix = true;
|
|
47
|
+
/** Filter */
|
|
45
48
|
function filter(messages, shared) {
|
|
46
49
|
if (shared.commentDirectives.length === 0) {
|
|
47
50
|
return messages;
|