File tree 3 files changed +26
-1
lines changed
3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -169,6 +169,24 @@ module.exports = {
169
169
}
170
170
```
171
171
172
+ ### parserOptions.svelteFeatures
173
+
174
+ You can use ` parserOptions.svelteFeatures ` property to specify how to parse related to Svelte features. For example:
175
+
176
+ ``` json
177
+ {
178
+ "parser" : " svelte-eslint-parser" ,
179
+ "parserOptions" : {
180
+ "svelteFeatures" : {
181
+ /* -- Experimental Svelte Features -- */
182
+ // Whether to parse the `generics` attribute.
183
+ // See https://github.com/sveltejs/rfcs/pull/38
184
+ "experimentalGenerics" : false
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
172
190
### Runes support
173
191
174
192
*** This is an experimental feature. It may be changed or removed in minor versions without notice.***
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ export function convertSvelteRoot(
52
52
...ctx . getConvertLocation ( instance ) ,
53
53
} ;
54
54
extractAttributes ( script , ctx ) ;
55
- convertGenericsAttribute ( script , ctx ) ;
55
+ if ( ctx . parserOptions . svelteFeatures ?. experimentalGenerics )
56
+ convertGenericsAttribute ( script , ctx ) ;
56
57
extractElementTags ( script , ctx , {
57
58
buildNameNode : ( openTokenRange ) => {
58
59
ctx . addToken ( "HTMLIdentifier" , openTokenRange ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ export type NormalizedParserOptions = {
19
19
experimentalObjectRestSpread ?: boolean | undefined ;
20
20
[ key : string ] : any ;
21
21
} ;
22
+ svelteFeatures ?: {
23
+ /* -- Experimental Svelte Features -- */
24
+ // Whether to parse the `generics` attribute.
25
+ // See https://github.com/sveltejs/rfcs/pull/38
26
+ experimentalGenerics ?: boolean ;
27
+ } ;
22
28
loc : boolean ;
23
29
range : boolean ;
24
30
raw : boolean ;
You can’t perform that action at this time.
0 commit comments