@@ -8,6 +8,7 @@ import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
8
8
import semver from 'semver' ;
9
9
import { writeAndFormat } from '../../tools/lib/write' ;
10
10
import { Linter } from './eslint-compat' ;
11
+ import { VERSION } from 'svelte/compiler' ;
11
12
12
13
const globals = {
13
14
console : 'readonly' ,
@@ -111,7 +112,8 @@ export function loadTestCases(
111
112
112
113
const valid = listupInput ( validFixtureRoot )
113
114
. filter ( filter )
114
- . map ( ( inputFile ) => getConfig ( ruleName , inputFile ) ) ;
115
+ . map ( ( inputFile ) => getConfig ( ruleName , inputFile ) )
116
+ . filter ( isTargetSvelteVersion ) ;
115
117
116
118
const fixable = plugin . rules [ ruleName ] . meta . fixable != null ;
117
119
@@ -152,7 +154,8 @@ export function loadTestCases(
152
154
}
153
155
154
156
return config ;
155
- } ) ;
157
+ } )
158
+ . filter ( isTargetSvelteVersion ) ;
156
159
157
160
if ( options ?. additionals ) {
158
161
if ( options . additionals . valid ) {
@@ -179,6 +182,12 @@ export function loadTestCases(
179
182
} ;
180
183
}
181
184
185
+ function isTargetSvelteVersion ( config : any ) {
186
+ return config . svelteVersions
187
+ ? config . svelteVersions . some ( ( sv : string ) => semver . satisfies ( VERSION , sv ) )
188
+ : true ;
189
+ }
190
+
182
191
function listupInput ( rootDir : string ) {
183
192
return [ ...itrListupInput ( rootDir ) ] ;
184
193
}
0 commit comments