Skip to content

Commit 7102a4f

Browse files
committed
wip
1 parent 02e2950 commit 7102a4f

10 files changed

+38
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"svelteVersions": [3, 4]
3+
}

tests/utils/utils.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
88
import semver from 'semver';
99
import { writeAndFormat } from '../../tools/lib/write';
1010
import { Linter } from './eslint-compat';
11+
import { VERSION } from 'svelte/compiler';
1112

1213
const globals = {
1314
console: 'readonly',
@@ -111,7 +112,8 @@ export function loadTestCases(
111112

112113
const valid = listupInput(validFixtureRoot)
113114
.filter(filter)
114-
.map((inputFile) => getConfig(ruleName, inputFile));
115+
.map((inputFile) => getConfig(ruleName, inputFile))
116+
.filter(isTargetSvelteVersion);
115117

116118
const fixable = plugin.rules[ruleName].meta.fixable != null;
117119

@@ -152,7 +154,8 @@ export function loadTestCases(
152154
}
153155

154156
return config;
155-
});
157+
})
158+
.filter(isTargetSvelteVersion);
156159

157160
if (options?.additionals) {
158161
if (options.additionals.valid) {
@@ -179,6 +182,12 @@ export function loadTestCases(
179182
};
180183
}
181184

185+
function isTargetSvelteVersion(config: any) {
186+
return config.svelteVersions
187+
? config.svelteVersions.some((sv: string) => semver.satisfies(VERSION, sv))
188+
: true;
189+
}
190+
182191
function listupInput(rootDir: string) {
183192
return [...itrListupInput(rootDir)];
184193
}

0 commit comments

Comments
 (0)