eslint-plugin-svelte 3.0.0 → 3.0.2
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 +5 -25
- package/lib/main.d.ts +1 -1
- package/lib/meta.d.ts +1 -1
- package/lib/meta.js +1 -1
- package/lib/rules/no-useless-mustaches.js +3 -0
- package/lib/rules/valid-prop-names-in-kit-pages.js +13 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,14 +78,7 @@ export default [
|
|
|
78
78
|
}
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
|
-
files: [
|
|
82
|
-
'*.svelte',
|
|
83
|
-
'**/*.svelte',
|
|
84
|
-
'*.svelte.ts',
|
|
85
|
-
'**/*.svelte.ts',
|
|
86
|
-
'*.svelte.js',
|
|
87
|
-
'**/*.svelte.js'
|
|
88
|
-
],
|
|
81
|
+
files: ['**/*.svelte', '**/*.svelte.js'],
|
|
89
82
|
languageOptions: {
|
|
90
83
|
parserOptions: {
|
|
91
84
|
// We recommend importing and specifying svelte.config.js.
|
|
@@ -132,33 +125,20 @@ export default ts.config(
|
|
|
132
125
|
}
|
|
133
126
|
},
|
|
134
127
|
{
|
|
135
|
-
files: ['
|
|
128
|
+
files: ['**/*.svelte', '**/*.svelte.ts', '**/*.svelte.js'],
|
|
136
129
|
// See more details at: https://typescript-eslint.io/packages/parser/
|
|
137
130
|
languageOptions: {
|
|
138
131
|
parserOptions: {
|
|
139
132
|
projectService: true,
|
|
140
133
|
extraFileExtensions: ['.svelte'], // Add support for additional file extensions, such as .svelte
|
|
141
|
-
parser: ts.parser
|
|
134
|
+
parser: ts.parser,
|
|
142
135
|
// Specify a parser for each language, if needed:
|
|
143
136
|
// parser: {
|
|
144
137
|
// ts: ts.parser,
|
|
145
138
|
// js: espree, // Use espree for .js files (add: import espree from 'espree')
|
|
146
139
|
// typescript: ts.parser
|
|
147
140
|
// },
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
{
|
|
152
|
-
files: [
|
|
153
|
-
'*.svelte',
|
|
154
|
-
'**/*.svelte',
|
|
155
|
-
'*.svelte.ts',
|
|
156
|
-
'**/*.svelte.ts',
|
|
157
|
-
'*.svelte.js',
|
|
158
|
-
'**/*.svelte.js'
|
|
159
|
-
],
|
|
160
|
-
languageOptions: {
|
|
161
|
-
parserOptions: {
|
|
141
|
+
|
|
162
142
|
// We recommend importing and specifying svelte.config.js.
|
|
163
143
|
// By doing so, some rules in eslint-plugin-svelte will automatically read the configuration and adjust their behavior accordingly.
|
|
164
144
|
// While certain Svelte settings may be statically loaded from svelte.config.js even if you don’t specify it,
|
|
@@ -258,7 +238,7 @@ If you’re migrating from `eslint-plugin-svelte` v1 or [`@ota-meshi/eslint-plug
|
|
|
258
238
|
|
|
259
239
|
## Versioning Policy
|
|
260
240
|
|
|
261
|
-
This project follows [Semantic Versioning](https://semver.org/). Unlike [ESLint’s versioning policy](https://github.com/eslint/eslint#semantic-versioning-policy), new rules may be added in minor releases. If these
|
|
241
|
+
This project follows [Semantic Versioning](https://semver.org/). Unlike [ESLint’s versioning policy](https://github.com/eslint/eslint#semantic-versioning-policy), new rules may be added to the recommended config in minor releases. If these rules cause unwanted warnings, you can disable them.
|
|
262
242
|
|
|
263
243
|
<!--DOCS_IGNORE_END-->
|
|
264
244
|
|
package/lib/main.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const configs: {
|
|
|
14
14
|
export declare const rules: Record<string, Rule.RuleModule>;
|
|
15
15
|
export declare const meta: {
|
|
16
16
|
name: "eslint-plugin-svelte";
|
|
17
|
-
version: "3.0.
|
|
17
|
+
version: "3.0.2";
|
|
18
18
|
};
|
|
19
19
|
export declare const processors: {
|
|
20
20
|
'.svelte': typeof processor;
|
package/lib/meta.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "eslint-plugin-svelte";
|
|
2
|
-
export declare const version = "3.0.
|
|
2
|
+
export declare const version = "3.0.2";
|
package/lib/meta.js
CHANGED
|
@@ -78,6 +78,9 @@ export default createRule('no-useless-mustaches', {
|
|
|
78
78
|
if (expression.type === 'TemplateLiteral' && /[\n\r]/.test(rawValue)) {
|
|
79
79
|
return;
|
|
80
80
|
}
|
|
81
|
+
if (rawValue.includes('{')) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
81
84
|
let hasEscape = false;
|
|
82
85
|
if (rawValue !== strValue) {
|
|
83
86
|
// check escapes
|
|
@@ -17,6 +17,18 @@ function checkProp(node, context, expectedPropNames) {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
function isModuleScript(node) {
|
|
21
|
+
// <script context="module">
|
|
22
|
+
if (node.key.name === 'context' &&
|
|
23
|
+
node.value.some((v) => v.type === 'SvelteLiteral' && v.value === 'module')) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
// <script module>
|
|
27
|
+
if (node.key.name === 'module' && node.value.length === 0) {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
20
32
|
export default createRule('valid-prop-names-in-kit-pages', {
|
|
21
33
|
meta: {
|
|
22
34
|
docs: {
|
|
@@ -43,9 +55,7 @@ export default createRule('valid-prop-names-in-kit-pages', {
|
|
|
43
55
|
// <script>
|
|
44
56
|
'Program > SvelteScriptElement > SvelteStartTag': (node) => {
|
|
45
57
|
// except for <script context="module">
|
|
46
|
-
isScript = !node.attributes.some((a) => a.type === 'SvelteAttribute' &&
|
|
47
|
-
a.key.name === 'context' &&
|
|
48
|
-
a.value.some((v) => v.type === 'SvelteLiteral' && v.value === 'module'));
|
|
58
|
+
isScript = !node.attributes.some((a) => a.type === 'SvelteAttribute' && isModuleScript(a));
|
|
49
59
|
},
|
|
50
60
|
// </script>
|
|
51
61
|
'Program > SvelteScriptElement:exit': () => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-svelte",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
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",
|