eslint-plugin-svelte 2.36.0-next.8 → 2.36.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
@@ -4,6 +4,8 @@
4
4
  It provides many unique check rules by using the template AST.
5
5
  You can check on the [Online DEMO](https://sveltejs.github.io/eslint-plugin-svelte/playground/).
6
6
 
7
+ **_We are working on experimental support for Svelte v5, but may break with new versions of Svelte v5._**
8
+
7
9
  [![NPM license](https://img.shields.io/npm/l/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte)
8
10
  [![NPM version](https://img.shields.io/npm/v/eslint-plugin-svelte.svg)](https://www.npmjs.com/package/eslint-plugin-svelte)
9
11
  [![NPM downloads](https://img.shields.io/badge/dynamic/json.svg?label=downloads&colorB=green&suffix=/day&query=$.downloads&uri=https://api.npmjs.org//downloads/point/last-day/eslint-plugin-svelte&maxAge=3600)](http://www.npmtrends.com/eslint-plugin-svelte)
@@ -66,6 +68,38 @@ npm install --save-dev eslint eslint-plugin-svelte svelte
66
68
 
67
69
  ### Configuration
68
70
 
71
+ #### New Config (`eslint.config.js`)
72
+
73
+ Use `eslint.config.js` file to configure rules. See also: <https://eslint.org/docs/latest/use/configure/configuration-files-new>.
74
+
75
+ Example **eslint.config.js**:
76
+
77
+ ```mjs
78
+ import eslintPluginSvelte from 'eslint-plugin-svelte';
79
+ export default [
80
+ // add more generic rule sets here, such as:
81
+ // js.configs.recommended,
82
+ ...eslintPluginSvelte.configs['flat/recommended'],
83
+ {
84
+ rules: {
85
+ // override/add rules settings here, such as:
86
+ // 'svelte/rule-name': 'error'
87
+ }
88
+ }
89
+ ];
90
+ ```
91
+
92
+ This plugin provides configs:
93
+
94
+ - `eslintPluginSvelte.configs['flat/base']` ... Configuration to enable correct Svelte parsing.
95
+ - `eslintPluginSvelte.configs['flat/recommended']` ... Above, plus rules to prevent errors or unintended behavior.
96
+ - `eslintPluginSvelte.configs['flat/prettier']` ... Turns off rules that may conflict with [Prettier](https://prettier.io/) (You still need to configure prettier to work with svelte yourself, for example by using [prettier-plugin-svelte](https://github.com/sveltejs/prettier-plugin-svelte).).
97
+ - `eslintPluginSvelte.configs['flat/all']` ... All rules. This configuration is not recommended for production use because it changes with every minor and major version of `eslint-plugin-svelte`. Use it at your own risk.
98
+
99
+ See [the rule list](https://sveltejs.github.io/eslint-plugin-svelte/rules/) to get the `rules` that this plugin provides.
100
+
101
+ #### Legacy Config (`.eslintrc`)
102
+
69
103
  Use `.eslintrc.*` file to configure rules. See also: <https://eslint.org/docs/user-guide/configuring>.
70
104
 
71
105
  Example **.eslintrc.js**:
@@ -394,6 +428,14 @@ These rules extend the rules provided by ESLint itself, or other plugins to work
394
428
  | [svelte/no-inner-declarations](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-inner-declarations/) | disallow variable or `function` declarations in nested blocks | :star: |
395
429
  | [svelte/no-trailing-spaces](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-trailing-spaces/) | disallow trailing whitespace at the end of lines | :wrench: |
396
430
 
431
+ ## SvelteKit
432
+
433
+ These rules relate to SvelteKit and its best Practices.
434
+
435
+ | Rule ID | Description | |
436
+ |:--------|:------------|:---|
437
+ | [svelte/no-goto-without-base](https://sveltejs.github.io/eslint-plugin-svelte/rules/no-goto-without-base/) | disallow using goto() without the base path | |
438
+
397
439
  ## Experimental
398
440
 
399
441
  :warning: These rules are considered experimental and may change or be removed in the future:
@@ -0,0 +1,25 @@
1
+ declare const _default: ({
2
+ plugins: {
3
+ readonly svelte: import("eslint").ESLint.Plugin;
4
+ };
5
+ files?: undefined;
6
+ languageOptions?: undefined;
7
+ rules?: undefined;
8
+ processor?: undefined;
9
+ } | {
10
+ files: string[];
11
+ languageOptions: {
12
+ parser: any;
13
+ };
14
+ rules: {
15
+ 'no-inner-declarations': string;
16
+ 'no-self-assign': string;
17
+ 'svelte/comment-directive': string;
18
+ 'svelte/system': string;
19
+ };
20
+ processor: string;
21
+ plugins?: undefined;
22
+ } | {
23
+ rules: any;
24
+ })[];
25
+ export default _default;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const rules_1 = require("../../utils/rules");
7
+ const base_1 = __importDefault(require("./base"));
8
+ exports.default = [
9
+ ...base_1.default,
10
+ {
11
+ rules: Object.fromEntries(rules_1.rules
12
+ .map((rule) => [`svelte/${rule.meta.docs.ruleName}`, 'error'])
13
+ .filter(([ruleName]) => ![
14
+ 'svelte/no-restricted-html-elements'
15
+ ].includes(ruleName)))
16
+ }
17
+ ];
@@ -0,0 +1,24 @@
1
+ import type { ESLint } from 'eslint';
2
+ declare const _default: ({
3
+ plugins: {
4
+ readonly svelte: ESLint.Plugin;
5
+ };
6
+ files?: undefined;
7
+ languageOptions?: undefined;
8
+ rules?: undefined;
9
+ processor?: undefined;
10
+ } | {
11
+ files: string[];
12
+ languageOptions: {
13
+ parser: any;
14
+ };
15
+ rules: {
16
+ 'no-inner-declarations': string;
17
+ 'no-self-assign': string;
18
+ 'svelte/comment-directive': string;
19
+ 'svelte/system': string;
20
+ };
21
+ processor: string;
22
+ plugins?: undefined;
23
+ })[];
24
+ export default _default;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = [
4
+ {
5
+ plugins: {
6
+ get svelte() {
7
+ return require('../../index');
8
+ }
9
+ }
10
+ },
11
+ {
12
+ files: ['*.svelte', '**/*.svelte'],
13
+ languageOptions: {
14
+ parser: require('svelte-eslint-parser')
15
+ },
16
+ rules: {
17
+ 'no-inner-declarations': 'off',
18
+ 'no-self-assign': 'off',
19
+ 'svelte/comment-directive': 'error',
20
+ 'svelte/system': 'error'
21
+ },
22
+ processor: 'svelte/svelte'
23
+ }
24
+ ];
@@ -0,0 +1,37 @@
1
+ declare const _default: ({
2
+ plugins: {
3
+ readonly svelte: import("eslint").ESLint.Plugin;
4
+ };
5
+ files?: undefined;
6
+ languageOptions?: undefined;
7
+ rules?: undefined;
8
+ processor?: undefined;
9
+ } | {
10
+ files: string[];
11
+ languageOptions: {
12
+ parser: any;
13
+ };
14
+ rules: {
15
+ 'no-inner-declarations': string;
16
+ 'no-self-assign': string;
17
+ 'svelte/comment-directive': string;
18
+ 'svelte/system': string;
19
+ };
20
+ processor: string;
21
+ plugins?: undefined;
22
+ } | {
23
+ rules: {
24
+ 'svelte/first-attribute-linebreak': string;
25
+ 'svelte/html-closing-bracket-spacing': string;
26
+ 'svelte/html-quotes': string;
27
+ 'svelte/html-self-closing': string;
28
+ 'svelte/indent': string;
29
+ 'svelte/max-attributes-per-line': string;
30
+ 'svelte/mustache-spacing': string;
31
+ 'svelte/no-spaces-around-equal-signs-in-attribute': string;
32
+ 'svelte/no-trailing-spaces': string;
33
+ 'svelte/shorthand-attribute': string;
34
+ 'svelte/shorthand-directive': string;
35
+ };
36
+ })[];
37
+ export default _default;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const base_1 = __importDefault(require("./base"));
7
+ exports.default = [
8
+ ...base_1.default,
9
+ {
10
+ rules: {
11
+ 'svelte/first-attribute-linebreak': 'off',
12
+ 'svelte/html-closing-bracket-spacing': 'off',
13
+ 'svelte/html-quotes': 'off',
14
+ 'svelte/html-self-closing': 'off',
15
+ 'svelte/indent': 'off',
16
+ 'svelte/max-attributes-per-line': 'off',
17
+ 'svelte/mustache-spacing': 'off',
18
+ 'svelte/no-spaces-around-equal-signs-in-attribute': 'off',
19
+ 'svelte/no-trailing-spaces': 'off',
20
+ 'svelte/shorthand-attribute': 'off',
21
+ 'svelte/shorthand-directive': 'off'
22
+ }
23
+ }
24
+ ];
@@ -0,0 +1,40 @@
1
+ declare const _default: ({
2
+ plugins: {
3
+ readonly svelte: import("eslint").ESLint.Plugin;
4
+ };
5
+ files?: undefined;
6
+ languageOptions?: undefined;
7
+ rules?: undefined;
8
+ processor?: undefined;
9
+ } | {
10
+ files: string[];
11
+ languageOptions: {
12
+ parser: any;
13
+ };
14
+ rules: {
15
+ 'no-inner-declarations': string;
16
+ 'no-self-assign': string;
17
+ 'svelte/comment-directive': string;
18
+ 'svelte/system': string;
19
+ };
20
+ processor: string;
21
+ plugins?: undefined;
22
+ } | {
23
+ rules: {
24
+ 'svelte/comment-directive': string;
25
+ 'svelte/no-at-debug-tags': string;
26
+ 'svelte/no-at-html-tags': string;
27
+ 'svelte/no-dupe-else-if-blocks': string;
28
+ 'svelte/no-dupe-style-properties': string;
29
+ 'svelte/no-dynamic-slot-name': string;
30
+ 'svelte/no-inner-declarations': string;
31
+ 'svelte/no-not-function-handler': string;
32
+ 'svelte/no-object-in-text-mustaches': string;
33
+ 'svelte/no-shorthand-style-property-overrides': string;
34
+ 'svelte/no-unknown-style-directive-property': string;
35
+ 'svelte/no-unused-svelte-ignore': string;
36
+ 'svelte/system': string;
37
+ 'svelte/valid-compile': string;
38
+ };
39
+ })[];
40
+ export default _default;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const base_1 = __importDefault(require("./base"));
7
+ exports.default = [
8
+ ...base_1.default,
9
+ {
10
+ rules: {
11
+ 'svelte/comment-directive': 'error',
12
+ 'svelte/no-at-debug-tags': 'warn',
13
+ 'svelte/no-at-html-tags': 'error',
14
+ 'svelte/no-dupe-else-if-blocks': 'error',
15
+ 'svelte/no-dupe-style-properties': 'error',
16
+ 'svelte/no-dynamic-slot-name': 'error',
17
+ 'svelte/no-inner-declarations': 'error',
18
+ 'svelte/no-not-function-handler': 'error',
19
+ 'svelte/no-object-in-text-mustaches': 'error',
20
+ 'svelte/no-shorthand-style-property-overrides': 'error',
21
+ 'svelte/no-unknown-style-directive-property': 'error',
22
+ 'svelte/no-unused-svelte-ignore': 'error',
23
+ 'svelte/system': 'error',
24
+ 'svelte/valid-compile': 'error'
25
+ }
26
+ }
27
+ ];
package/lib/index.d.ts CHANGED
@@ -55,6 +55,127 @@ declare const _default: {
55
55
  extends: string[];
56
56
  rules: any;
57
57
  };
58
+ 'flat/base': ({
59
+ plugins: {
60
+ readonly svelte: import("eslint").ESLint.Plugin;
61
+ };
62
+ files?: undefined;
63
+ languageOptions?: undefined;
64
+ rules?: undefined;
65
+ processor?: undefined;
66
+ } | {
67
+ files: string[];
68
+ languageOptions: {
69
+ parser: any;
70
+ };
71
+ rules: {
72
+ 'no-inner-declarations': string;
73
+ 'no-self-assign': string;
74
+ 'svelte/comment-directive': string;
75
+ 'svelte/system': string;
76
+ };
77
+ processor: string;
78
+ plugins?: undefined;
79
+ })[];
80
+ 'flat/recommended': ({
81
+ plugins: {
82
+ readonly svelte: import("eslint").ESLint.Plugin;
83
+ };
84
+ files?: undefined;
85
+ languageOptions?: undefined;
86
+ rules?: undefined;
87
+ processor?: undefined;
88
+ } | {
89
+ files: string[];
90
+ languageOptions: {
91
+ parser: any;
92
+ };
93
+ rules: {
94
+ 'no-inner-declarations': string;
95
+ 'no-self-assign': string;
96
+ 'svelte/comment-directive': string;
97
+ 'svelte/system': string;
98
+ };
99
+ processor: string;
100
+ plugins?: undefined;
101
+ } | {
102
+ rules: {
103
+ 'svelte/comment-directive': string;
104
+ 'svelte/no-at-debug-tags': string;
105
+ 'svelte/no-at-html-tags': string;
106
+ 'svelte/no-dupe-else-if-blocks': string;
107
+ 'svelte/no-dupe-style-properties': string;
108
+ 'svelte/no-dynamic-slot-name': string;
109
+ 'svelte/no-inner-declarations': string;
110
+ 'svelte/no-not-function-handler': string;
111
+ 'svelte/no-object-in-text-mustaches': string;
112
+ 'svelte/no-shorthand-style-property-overrides': string;
113
+ 'svelte/no-unknown-style-directive-property': string;
114
+ 'svelte/no-unused-svelte-ignore': string;
115
+ 'svelte/system': string;
116
+ 'svelte/valid-compile': string;
117
+ };
118
+ })[];
119
+ 'flat/prettier': ({
120
+ plugins: {
121
+ readonly svelte: import("eslint").ESLint.Plugin;
122
+ };
123
+ files?: undefined;
124
+ languageOptions?: undefined;
125
+ rules?: undefined;
126
+ processor?: undefined;
127
+ } | {
128
+ files: string[];
129
+ languageOptions: {
130
+ parser: any;
131
+ };
132
+ rules: {
133
+ 'no-inner-declarations': string;
134
+ 'no-self-assign': string;
135
+ 'svelte/comment-directive': string;
136
+ 'svelte/system': string;
137
+ };
138
+ processor: string;
139
+ plugins?: undefined;
140
+ } | {
141
+ rules: {
142
+ 'svelte/first-attribute-linebreak': string;
143
+ 'svelte/html-closing-bracket-spacing': string;
144
+ 'svelte/html-quotes': string;
145
+ 'svelte/html-self-closing': string;
146
+ 'svelte/indent': string;
147
+ 'svelte/max-attributes-per-line': string;
148
+ 'svelte/mustache-spacing': string;
149
+ 'svelte/no-spaces-around-equal-signs-in-attribute': string;
150
+ 'svelte/no-trailing-spaces': string;
151
+ 'svelte/shorthand-attribute': string;
152
+ 'svelte/shorthand-directive': string;
153
+ };
154
+ })[];
155
+ 'flat/all': ({
156
+ plugins: {
157
+ readonly svelte: import("eslint").ESLint.Plugin;
158
+ };
159
+ files?: undefined;
160
+ languageOptions?: undefined;
161
+ rules?: undefined;
162
+ processor?: undefined;
163
+ } | {
164
+ files: string[];
165
+ languageOptions: {
166
+ parser: any;
167
+ };
168
+ rules: {
169
+ 'no-inner-declarations': string;
170
+ 'no-self-assign': string;
171
+ 'svelte/comment-directive': string;
172
+ 'svelte/system': string;
173
+ };
174
+ processor: string;
175
+ plugins?: undefined;
176
+ } | {
177
+ rules: any;
178
+ })[];
58
179
  };
59
180
  rules: {
60
181
  [key: string]: RuleModule;
package/lib/index.js CHANGED
@@ -30,13 +30,21 @@ const base_1 = __importDefault(require("./configs/base"));
30
30
  const recommended_1 = __importDefault(require("./configs/recommended"));
31
31
  const prettier_1 = __importDefault(require("./configs/prettier"));
32
32
  const all_1 = __importDefault(require("./configs/all"));
33
+ const base_2 = __importDefault(require("./configs/flat/base"));
34
+ const recommended_2 = __importDefault(require("./configs/flat/recommended"));
35
+ const prettier_2 = __importDefault(require("./configs/flat/prettier"));
36
+ const all_2 = __importDefault(require("./configs/flat/all"));
33
37
  const processor = __importStar(require("./processor"));
34
38
  const meta = __importStar(require("./meta"));
35
39
  const configs = {
36
40
  base: base_1.default,
37
41
  recommended: recommended_1.default,
38
42
  prettier: prettier_1.default,
39
- all: all_1.default
43
+ all: all_1.default,
44
+ 'flat/base': base_2.default,
45
+ 'flat/recommended': recommended_2.default,
46
+ 'flat/prettier': prettier_2.default,
47
+ 'flat/all': all_2.default
40
48
  };
41
49
  const rules = rules_1.rules.reduce((obj, r) => {
42
50
  obj[r.meta.docs.ruleName] = r;
package/lib/meta.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const name: "eslint-plugin-svelte";
2
- export declare const version: "2.36.0-next.8";
1
+ export declare const name = "eslint-plugin-svelte";
2
+ export declare const version = "2.36.0";
package/lib/meta.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = 'eslint-plugin-svelte';
5
- exports.version = '2.36.0-next.8';
5
+ exports.version = '2.36.0';
@@ -0,0 +1,2 @@
1
+ declare const _default: import("../types").RuleModule;
2
+ export default _default;
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const utils_1 = require("../utils");
4
+ const eslint_utils_1 = require("@eslint-community/eslint-utils");
5
+ const compat_1 = require("../utils/compat");
6
+ const ast_utils_1 = require("../utils/ast-utils");
7
+ exports.default = (0, utils_1.createRule)('no-goto-without-base', {
8
+ meta: {
9
+ docs: {
10
+ description: 'disallow using goto() without the base path',
11
+ category: 'SvelteKit',
12
+ recommended: false
13
+ },
14
+ schema: [],
15
+ messages: {
16
+ isNotPrefixedWithBasePath: "Found a goto() call with a url that isn't prefixed with the base path."
17
+ },
18
+ type: 'suggestion'
19
+ },
20
+ create(context) {
21
+ return {
22
+ Program() {
23
+ const referenceTracker = new eslint_utils_1.ReferenceTracker((0, compat_1.getSourceCode)(context).scopeManager.globalScope);
24
+ const basePathNames = extractBasePathReferences(referenceTracker, context);
25
+ for (const gotoCall of extractGotoReferences(referenceTracker)) {
26
+ if (gotoCall.arguments.length < 1) {
27
+ continue;
28
+ }
29
+ const path = gotoCall.arguments[0];
30
+ switch (path.type) {
31
+ case 'BinaryExpression':
32
+ checkBinaryExpression(context, path, basePathNames);
33
+ break;
34
+ case 'Literal':
35
+ checkLiteral(context, path);
36
+ break;
37
+ case 'TemplateLiteral':
38
+ checkTemplateLiteral(context, path, basePathNames);
39
+ break;
40
+ default:
41
+ context.report({ loc: path.loc, messageId: 'isNotPrefixedWithBasePath' });
42
+ }
43
+ }
44
+ }
45
+ };
46
+ }
47
+ });
48
+ function checkBinaryExpression(context, path, basePathNames) {
49
+ if (path.left.type !== 'Identifier' || !basePathNames.has(path.left)) {
50
+ context.report({ loc: path.loc, messageId: 'isNotPrefixedWithBasePath' });
51
+ }
52
+ }
53
+ function checkTemplateLiteral(context, path, basePathNames) {
54
+ const startingIdentifier = extractStartingIdentifier(path);
55
+ if (startingIdentifier === undefined || !basePathNames.has(startingIdentifier)) {
56
+ context.report({ loc: path.loc, messageId: 'isNotPrefixedWithBasePath' });
57
+ }
58
+ }
59
+ function checkLiteral(context, path) {
60
+ const absolutePathRegex = /^(?:[+a-z]+:)?\/\//i;
61
+ if (!absolutePathRegex.test(path.value?.toString() ?? '')) {
62
+ context.report({ loc: path.loc, messageId: 'isNotPrefixedWithBasePath' });
63
+ }
64
+ }
65
+ function extractStartingIdentifier(templateLiteral) {
66
+ const literalParts = [...templateLiteral.expressions, ...templateLiteral.quasis].sort((a, b) => a.range[0] < b.range[0] ? -1 : 1);
67
+ for (const part of literalParts) {
68
+ if (part.type === 'TemplateElement' && part.value.raw === '') {
69
+ continue;
70
+ }
71
+ if (part.type === 'Identifier') {
72
+ return part;
73
+ }
74
+ return undefined;
75
+ }
76
+ return undefined;
77
+ }
78
+ function extractGotoReferences(referenceTracker) {
79
+ return Array.from(referenceTracker.iterateEsmReferences({
80
+ '$app/navigation': {
81
+ [eslint_utils_1.ReferenceTracker.ESM]: true,
82
+ goto: {
83
+ [eslint_utils_1.ReferenceTracker.CALL]: true
84
+ }
85
+ }
86
+ }), ({ node }) => node);
87
+ }
88
+ function extractBasePathReferences(referenceTracker, context) {
89
+ const set = new Set();
90
+ for (const { node } of referenceTracker.iterateEsmReferences({
91
+ '$app/paths': {
92
+ [eslint_utils_1.ReferenceTracker.ESM]: true,
93
+ base: {
94
+ [eslint_utils_1.ReferenceTracker.READ]: true
95
+ }
96
+ }
97
+ })) {
98
+ const variable = (0, ast_utils_1.findVariable)(context, node.local);
99
+ if (!variable)
100
+ continue;
101
+ for (const reference of variable.references) {
102
+ if (reference.identifier.type === 'Identifier')
103
+ set.add(reference.identifier);
104
+ }
105
+ }
106
+ return set;
107
+ }
@@ -203,6 +203,7 @@ export type ASTNodeListener = {
203
203
  SvelteDirective?: (node: AST.SvelteDirective & ASTNodeWithParent) => void;
204
204
  SvelteStyleDirective?: (node: AST.SvelteStyleDirective & ASTNodeWithParent) => void;
205
205
  SvelteSpecialDirective?: (node: AST.SvelteSpecialDirective & ASTNodeWithParent) => void;
206
+ SvelteGenericsDirective?: (node: AST.SvelteGenericsDirective & ASTNodeWithParent) => void;
206
207
  SvelteDirectiveKey?: (node: AST.SvelteDirectiveKey & ASTNodeWithParent) => void;
207
208
  SvelteSpecialDirectiveKey?: (node: AST.SvelteSpecialDirectiveKey & ASTNodeWithParent) => void;
208
209
  SvelteText?: (node: AST.SvelteText & ASTNodeWithParent) => void;
@@ -396,6 +397,7 @@ export type SvelteNodeListener = {
396
397
  SvelteDirective?: (node: AST.SvelteDirective & ASTNodeWithParent) => void;
397
398
  SvelteStyleDirective?: (node: AST.SvelteStyleDirective & ASTNodeWithParent) => void;
398
399
  SvelteSpecialDirective?: (node: AST.SvelteSpecialDirective & ASTNodeWithParent) => void;
400
+ SvelteGenericsDirective?: (node: AST.SvelteGenericsDirective & ASTNodeWithParent) => void;
399
401
  SvelteDirectiveKey?: (node: AST.SvelteDirectiveKey & ASTNodeWithParent) => void;
400
402
  SvelteSpecialDirectiveKey?: (node: AST.SvelteSpecialDirectiveKey & ASTNodeWithParent) => void;
401
403
  SvelteText?: (node: AST.SvelteText & ASTNodeWithParent) => void;
package/lib/types.d.ts CHANGED
@@ -17,7 +17,7 @@ export interface RuleModule {
17
17
  meta: RuleMetaData;
18
18
  create: (context: RuleContext) => RuleListener;
19
19
  }
20
- export type RuleCategory = 'Possible Errors' | 'Security Vulnerability' | 'Best Practices' | 'Stylistic Issues' | 'Extension Rules' | 'Experimental' | 'System';
20
+ export type RuleCategory = 'Possible Errors' | 'Security Vulnerability' | 'Best Practices' | 'Stylistic Issues' | 'Extension Rules' | 'SvelteKit' | 'Experimental' | 'System';
21
21
  export interface RuleMetaData {
22
22
  docs: {
23
23
  description: string;
@@ -48,7 +48,7 @@ export declare function getMustacheTokens(node: SvAST.SvelteDirective | SvAST.Sv
48
48
  openToken: SvAST.Token;
49
49
  closeToken: SvAST.Token;
50
50
  } | null;
51
- export declare function getAttributeKeyText(node: SvAST.SvelteAttribute | SvAST.SvelteShorthandAttribute | SvAST.SvelteStyleDirective | SvAST.SvelteDirective | SvAST.SvelteSpecialDirective, context: RuleContext): string;
51
+ export declare function getAttributeKeyText(node: SvAST.SvelteAttribute | SvAST.SvelteShorthandAttribute | SvAST.SvelteStyleDirective | SvAST.SvelteDirective | SvAST.SvelteSpecialDirective | SvAST.SvelteGenericsDirective, context: RuleContext): string;
52
52
  export declare function getDirectiveName(node: SvAST.SvelteDirective): string;
53
53
  export declare function getNodeName(node: SvAST.SvelteElement): string;
54
54
  export declare function isVoidHtmlElement(node: SvAST.SvelteElement): boolean;
@@ -317,6 +317,7 @@ function getAttributeKeyText(node, context) {
317
317
  switch (node.type) {
318
318
  case 'SvelteAttribute':
319
319
  case 'SvelteShorthandAttribute':
320
+ case 'SvelteGenericsDirective':
320
321
  return node.key.name;
321
322
  case 'SvelteStyleDirective':
322
323
  return `style:${node.key.name.name}`;
@@ -29,6 +29,7 @@ const no_dupe_use_directives_1 = __importDefault(require("../rules/no-dupe-use-d
29
29
  const no_dynamic_slot_name_1 = __importDefault(require("../rules/no-dynamic-slot-name"));
30
30
  const no_export_load_in_svelte_module_in_kit_pages_1 = __importDefault(require("../rules/no-export-load-in-svelte-module-in-kit-pages"));
31
31
  const no_extra_reactive_curlies_1 = __importDefault(require("../rules/no-extra-reactive-curlies"));
32
+ const no_goto_without_base_1 = __importDefault(require("../rules/no-goto-without-base"));
32
33
  const no_ignored_unsubscribe_1 = __importDefault(require("../rules/no-ignored-unsubscribe"));
33
34
  const no_immutable_reactive_statements_1 = __importDefault(require("../rules/no-immutable-reactive-statements"));
34
35
  const no_inline_styles_1 = __importDefault(require("../rules/no-inline-styles"));
@@ -91,6 +92,7 @@ exports.rules = [
91
92
  no_dynamic_slot_name_1.default,
92
93
  no_export_load_in_svelte_module_in_kit_pages_1.default,
93
94
  no_extra_reactive_curlies_1.default,
95
+ no_goto_without_base_1.default,
94
96
  no_ignored_unsubscribe_1.default,
95
97
  no_immutable_reactive_statements_1.default,
96
98
  no_inline_styles_1.default,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-svelte",
3
- "version": "2.36.0-next.8",
3
+ "version": "2.36.0",
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",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "peerDependencies": {
30
30
  "eslint": "^7.0.0 || ^8.0.0-0 || ^9.0.0-0",
31
- "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.68"
31
+ "svelte": "^3.37.0 || ^4.0.0 || ^5.0.0-next.95"
32
32
  },
33
33
  "peerDependenciesMeta": {
34
34
  "svelte": {
@@ -39,87 +39,87 @@
39
39
  "@eslint-community/eslint-utils": "^4.4.0",
40
40
  "@jridgewell/sourcemap-codec": "^1.4.15",
41
41
  "debug": "^4.3.4",
42
- "eslint-compat-utils": "^0.4.1",
42
+ "eslint-compat-utils": "^0.5.0",
43
43
  "esutils": "^2.0.3",
44
- "known-css-properties": "^0.29.0",
45
- "postcss": "^8.4.35",
44
+ "known-css-properties": "^0.30.0",
45
+ "postcss": "^8.4.38",
46
46
  "postcss-load-config": "^3.1.4",
47
47
  "postcss-safe-parser": "^6.0.0",
48
- "postcss-selector-parser": "^6.0.15",
48
+ "postcss-selector-parser": "^6.0.16",
49
49
  "semver": "^7.6.0",
50
- "svelte-eslint-parser": ">=0.34.0-next.10 <1.0.0"
50
+ "svelte-eslint-parser": ">=0.34.0 <1.0.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@1stg/browserslist-config": "^2.0.0",
54
54
  "@1stg/stylelint-config": "^6.0.0",
55
- "@babel/core": "^7.24.0",
56
- "@babel/eslint-parser": "^7.23.10",
57
- "@babel/plugin-proposal-function-bind": "^7.23.3",
55
+ "@babel/core": "^7.24.4",
56
+ "@babel/eslint-parser": "^7.24.1",
57
+ "@babel/plugin-proposal-function-bind": "^7.24.1",
58
58
  "@babel/types": "^7.24.0",
59
59
  "@changesets/changelog-github": "^0.5.0",
60
60
  "@changesets/cli": "^2.27.1",
61
61
  "@changesets/get-release-plan": "^4.0.0",
62
- "@fontsource/fira-mono": "^5.0.8",
63
- "@ota-meshi/eslint-plugin": "^0.15.2",
62
+ "@fontsource/fira-mono": "^5.0.12",
63
+ "@ota-meshi/eslint-plugin": "^0.15.3",
64
64
  "@sindresorhus/slugify": "^2.2.1",
65
65
  "@sveltejs/adapter-static": "^3.0.1",
66
- "@sveltejs/kit": "^2.5.2",
66
+ "@sveltejs/kit": "^2.5.5",
67
67
  "@sveltejs/vite-plugin-svelte": "^3.0.2",
68
68
  "@types/babel__core": "^7.20.5",
69
69
  "@types/cross-spawn": "^6.0.6",
70
70
  "@types/escape-html": "^1.0.4",
71
- "@types/eslint": "^8.56.5",
71
+ "@types/eslint": "^8.56.7",
72
72
  "@types/eslint-scope": "^3.7.7",
73
73
  "@types/eslint-utils": "^3.0.5",
74
- "@types/eslint-visitor-keys": "^1.0.0",
74
+ "@types/eslint-visitor-keys": "^3.3.0",
75
75
  "@types/esutils": "^2.0.2",
76
76
  "@types/json-schema": "^7.0.15",
77
77
  "@types/less": "^3.0.6",
78
- "@types/markdown-it": "^13.0.7",
79
- "@types/markdown-it-container": "^2.0.9",
80
- "@types/markdown-it-emoji": "^2.0.4",
78
+ "@types/markdown-it": "^14.0.0",
79
+ "@types/markdown-it-container": "^2.0.10",
80
+ "@types/markdown-it-emoji": "^2.0.5",
81
81
  "@types/mocha": "^10.0.6",
82
- "@types/node": "^20.11.22",
82
+ "@types/node": "^20.12.5",
83
83
  "@types/postcss-safe-parser": "^5.0.4",
84
84
  "@types/prismjs": "^1.26.3",
85
85
  "@types/semver": "^7.5.8",
86
86
  "@types/stylus": "^0.48.42",
87
- "@typescript-eslint/eslint-plugin": "^7.1.0",
88
- "@typescript-eslint/parser": "^7.1.0",
87
+ "@typescript-eslint/eslint-plugin": "^7.5.0",
88
+ "@typescript-eslint/parser": "^7.5.0",
89
89
  "@typescript/vfs": "^1.5.0",
90
90
  "acorn": "^8.11.3",
91
91
  "assert": "^2.1.0",
92
92
  "cross-spawn": "^7.0.3",
93
93
  "env-cmd": "^10.1.0",
94
- "esbuild": "^0.20.1",
94
+ "esbuild": "^0.20.2",
95
95
  "esbuild-register": "^3.5.0",
96
96
  "escape-html": "^1.0.3",
97
97
  "eslint": "^8.57.0",
98
98
  "eslint-config-prettier": "^9.1.0",
99
99
  "eslint-formatter-friendly": "^7.0.0",
100
100
  "eslint-plugin-eslint-comments": "^3.2.0",
101
- "eslint-plugin-eslint-plugin": "^5.4.0",
102
- "eslint-plugin-json-schema-validator": "^4.8.3",
103
- "eslint-plugin-jsonc": "^2.13.0",
104
- "eslint-plugin-markdown": "^3.0.1",
101
+ "eslint-plugin-eslint-plugin": "^5.5.0",
102
+ "eslint-plugin-json-schema-validator": "^5.1.0",
103
+ "eslint-plugin-jsonc": "^2.15.0",
104
+ "eslint-plugin-markdown": "^4.0.1",
105
105
  "eslint-plugin-mdx": "^3.1.5",
106
106
  "eslint-plugin-n": "^16.6.2",
107
107
  "eslint-plugin-node-dependencies": "^0.11.2",
108
108
  "eslint-plugin-prettier": "^5.1.3",
109
- "eslint-plugin-regexp": "^2.2.0",
109
+ "eslint-plugin-regexp": "^2.4.0",
110
110
  "eslint-plugin-svelte": "^2.35.1",
111
- "eslint-plugin-yml": "^1.12.2",
112
- "eslint-scope": "^8.0.0",
111
+ "eslint-plugin-yml": "^1.14.0",
112
+ "eslint-scope": "^8.0.1",
113
113
  "eslint-visitor-keys": "^4.0.0",
114
114
  "espree": "^10.0.1",
115
115
  "estree-walker": "^3.0.3",
116
116
  "less": "^4.2.0",
117
117
  "locate-character": "^3.0.0",
118
- "magic-string": "^0.30.7",
118
+ "magic-string": "^0.30.9",
119
119
  "markdown-it-anchor": "^8.6.7",
120
120
  "markdown-it-container": "^4.0.0",
121
121
  "markdown-it-emoji": "^3.0.0",
122
- "mocha": "^10.3.0",
122
+ "mocha": "^10.4.0",
123
123
  "npm-run-all2": "^6.1.2",
124
124
  "nyc": "^15.1.0",
125
125
  "pako": "^2.1.0",
@@ -130,20 +130,20 @@
130
130
  "prism-svelte": "^0.5.0",
131
131
  "prismjs": "^1.29.0",
132
132
  "rimraf": "^5.0.5",
133
- "sass": "^1.71.1",
134
- "source-map-js": "^1.0.2",
135
- "stylelint": "^16.2.1",
133
+ "sass": "^1.74.1",
134
+ "source-map-js": "^1.2.0",
135
+ "stylelint": "~16.3.1",
136
136
  "stylelint-config-standard": "^36.0.0",
137
- "stylus": "^0.62.0",
138
- "svelte": "^5.0.0-next.69",
137
+ "stylus": "^0.63.0",
138
+ "svelte": "^5.0.0-next.95",
139
139
  "svelte-adapter-ghpages": "0.2.2",
140
140
  "svelte-i18n": "^4.0.0",
141
141
  "tslib": "^2.6.2",
142
- "type-coverage": "^2.27.1",
143
- "typescript": "~5.3.3",
144
- "vite": "^5.1.4",
142
+ "type-coverage": "^2.28.1",
143
+ "typescript": "~5.4.4",
144
+ "vite": "^5.2.8",
145
145
  "vite-plugin-svelte-md": "^0.1.7",
146
- "yaml": "^2.4.0"
146
+ "yaml": "^2.4.1"
147
147
  },
148
148
  "publishConfig": {
149
149
  "access": "public"