eslint-plugin-svelte 3.12.0 → 3.12.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/lib/main.d.ts +1 -1
- package/lib/meta.d.ts +1 -1
- package/lib/meta.js +1 -1
- package/lib/rules/experimental-require-slot-types.js +10 -1
- package/lib/rules/experimental-require-strict-events.js +6 -1
- package/lib/rules/no-extra-reactive-curlies.js +10 -1
- package/lib/rules/no-goto-without-base.js +7 -3
- package/lib/rules/no-immutable-reactive-statements.js +10 -1
- package/lib/rules/no-navigation-without-base.js +7 -2
- package/lib/rules/no-navigation-without-resolve.js +1 -1
- package/lib/rules/no-unused-props.js +3 -2
- package/package.json +1 -1
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.12.
|
|
17
|
+
version: "3.12.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.12.
|
|
2
|
+
export declare const version: "3.12.2";
|
package/lib/meta.js
CHANGED
|
@@ -12,7 +12,16 @@ export default createRule('experimental-require-slot-types', {
|
|
|
12
12
|
messages: {
|
|
13
13
|
missingSlotsInterface: `The component must define the $$Slots interface.`
|
|
14
14
|
},
|
|
15
|
-
type: 'suggestion'
|
|
15
|
+
type: 'suggestion',
|
|
16
|
+
conditions: [
|
|
17
|
+
{
|
|
18
|
+
svelteVersions: ['3/4']
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
svelteVersions: ['5'],
|
|
22
|
+
runes: [false, 'undetermined']
|
|
23
|
+
}
|
|
24
|
+
]
|
|
16
25
|
},
|
|
17
26
|
create(context) {
|
|
18
27
|
let isTs = false;
|
|
@@ -12,7 +12,12 @@ export default createRule('experimental-require-strict-events', {
|
|
|
12
12
|
messages: {
|
|
13
13
|
missingStrictEvents: `The component must have the strictEvents attribute on its <script> tag or it must define the $$Events interface.`
|
|
14
14
|
},
|
|
15
|
-
type: 'suggestion'
|
|
15
|
+
type: 'suggestion',
|
|
16
|
+
conditions: [
|
|
17
|
+
{
|
|
18
|
+
svelteVersions: ['3/4']
|
|
19
|
+
}
|
|
20
|
+
]
|
|
16
21
|
},
|
|
17
22
|
create(context) {
|
|
18
23
|
let isTs = false;
|
|
@@ -13,7 +13,16 @@ export default createRule('no-extra-reactive-curlies', {
|
|
|
13
13
|
extraCurlies: `Do not wrap reactive statements in curly braces unless necessary.`,
|
|
14
14
|
removeExtraCurlies: `Remove the unnecessary curly braces.`
|
|
15
15
|
},
|
|
16
|
-
type: 'suggestion'
|
|
16
|
+
type: 'suggestion',
|
|
17
|
+
conditions: [
|
|
18
|
+
{
|
|
19
|
+
svelteVersions: ['3/4']
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
svelteVersions: ['5'],
|
|
23
|
+
runes: [false, 'undetermined']
|
|
24
|
+
}
|
|
25
|
+
]
|
|
17
26
|
},
|
|
18
27
|
create(context) {
|
|
19
28
|
return {
|
|
@@ -14,7 +14,12 @@ export default createRule('no-goto-without-base', {
|
|
|
14
14
|
messages: {
|
|
15
15
|
isNotPrefixedWithBasePath: "Found a goto() call with a url that isn't prefixed with the base path."
|
|
16
16
|
},
|
|
17
|
-
type: 'suggestion'
|
|
17
|
+
type: 'suggestion',
|
|
18
|
+
conditions: [
|
|
19
|
+
{
|
|
20
|
+
svelteKitVersions: ['1.0.0-next', '1', '2']
|
|
21
|
+
}
|
|
22
|
+
]
|
|
18
23
|
},
|
|
19
24
|
create(context) {
|
|
20
25
|
return {
|
|
@@ -56,8 +61,7 @@ function checkTemplateLiteral(context, path, basePathNames) {
|
|
|
56
61
|
}
|
|
57
62
|
}
|
|
58
63
|
function checkLiteral(context, path) {
|
|
59
|
-
|
|
60
|
-
if (!absolutePathRegex.test(path.value?.toString() ?? '')) {
|
|
64
|
+
if (!/^[+a-z]*:/i.test(path.value?.toString() ?? '')) {
|
|
61
65
|
context.report({ loc: path.loc, messageId: 'isNotPrefixedWithBasePath' });
|
|
62
66
|
}
|
|
63
67
|
}
|
|
@@ -11,7 +11,16 @@ export default createRule('no-immutable-reactive-statements', {
|
|
|
11
11
|
messages: {
|
|
12
12
|
immutable: 'This statement is not reactive because all variables referenced in the reactive statement are immutable.'
|
|
13
13
|
},
|
|
14
|
-
type: 'suggestion'
|
|
14
|
+
type: 'suggestion',
|
|
15
|
+
conditions: [
|
|
16
|
+
{
|
|
17
|
+
svelteVersions: ['3/4']
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
svelteVersions: ['5'],
|
|
21
|
+
runes: [false, 'undetermined']
|
|
22
|
+
}
|
|
23
|
+
]
|
|
15
24
|
},
|
|
16
25
|
create(context) {
|
|
17
26
|
const scopeManager = context.sourceCode.scopeManager;
|
|
@@ -37,7 +37,12 @@ export default createRule('no-navigation-without-base', {
|
|
|
37
37
|
pushStateNotPrefixed: "Found a pushState() call with a url that isn't prefixed with the base path.",
|
|
38
38
|
replaceStateNotPrefixed: "Found a replaceState() call with a url that isn't prefixed with the base path."
|
|
39
39
|
},
|
|
40
|
-
type: 'suggestion'
|
|
40
|
+
type: 'suggestion',
|
|
41
|
+
conditions: [
|
|
42
|
+
{
|
|
43
|
+
svelteKitVersions: ['1.0.0-next', '1', '2']
|
|
44
|
+
}
|
|
45
|
+
]
|
|
41
46
|
},
|
|
42
47
|
create(context) {
|
|
43
48
|
let basePathNames = new Set();
|
|
@@ -199,7 +204,7 @@ function templateLiteralIsAbsolute(url) {
|
|
|
199
204
|
url.quasis.some((quasi) => urlValueIsAbsolute(quasi.value.raw)));
|
|
200
205
|
}
|
|
201
206
|
function urlValueIsAbsolute(url) {
|
|
202
|
-
return
|
|
207
|
+
return /^[+a-z]*:/i.test(url);
|
|
203
208
|
}
|
|
204
209
|
function expressionIsFragment(url) {
|
|
205
210
|
switch (url.type) {
|
|
@@ -213,7 +213,7 @@ function templateLiteralIsAbsolute(url) {
|
|
|
213
213
|
url.quasis.some((quasi) => urlValueIsAbsolute(quasi.value.raw)));
|
|
214
214
|
}
|
|
215
215
|
function urlValueIsAbsolute(url) {
|
|
216
|
-
return
|
|
216
|
+
return /^[+a-z]*:/i.test(url);
|
|
217
217
|
}
|
|
218
218
|
function expressionIsFragment(url) {
|
|
219
219
|
switch (url.type) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRule } from '../utils/index.js';
|
|
2
|
-
import { getTypeScriptTools } from '../utils/ts-utils/index.js';
|
|
2
|
+
import { getTypeScriptTools, isAnyType } from '../utils/ts-utils/index.js';
|
|
3
3
|
import { findVariable } from '../utils/ast-utils.js';
|
|
4
4
|
import { toRegExp } from '../utils/regexp.js';
|
|
5
5
|
let isRemovedWarningShown = false;
|
|
@@ -284,7 +284,8 @@ export default createRule('no-unused-props', {
|
|
|
284
284
|
if (parentPath.length === 0) {
|
|
285
285
|
const indexType = propsType.getStringIndexType();
|
|
286
286
|
const numberIndexType = propsType.getNumberIndexType();
|
|
287
|
-
const hasIndexSignature = Boolean(indexType
|
|
287
|
+
const hasIndexSignature = Boolean(indexType && !isAnyType(indexType, tools.ts)) ||
|
|
288
|
+
Boolean(numberIndexType && !isAnyType(numberIndexType, tools.ts));
|
|
288
289
|
if (hasIndexSignature && !hasRestElement(declaredPropertyNames)) {
|
|
289
290
|
context.report({
|
|
290
291
|
node: reportNode,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-plugin-svelte",
|
|
3
|
-
"version": "3.12.
|
|
3
|
+
"version": "3.12.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",
|