Skip to content

Commit f54c91f

Browse files
authored
feat: stabilize generics (#589)
1 parent 6836b8d commit f54c91f

File tree

5 files changed

+6
-18
lines changed

5 files changed

+6
-18
lines changed

.changeset/orange-laws-tie.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"svelte-eslint-parser": minor
3+
---
4+
5+
feat: stabilized generics

README.md

-10
Original file line numberDiff line numberDiff line change
@@ -291,11 +291,6 @@ export default [
291291
// If not configured this option, The parser will try to read the option from `compilerOptions.runes` from `svelte.config.js`.
292292
// If `parserOptions.svelteConfig` is not specified and the file cannot be parsed by static analysis, it will behave as `true`.
293293
runes: true,
294-
/* -- Experimental Svelte Features -- */
295-
/* It may be changed or removed in minor versions without notice. */
296-
// Whether to parse the `generics` attribute.
297-
// See https://github.com/sveltejs/rfcs/pull/38
298-
experimentalGenerics: false,
299294
},
300295
},
301296
},
@@ -317,11 +312,6 @@ For example in `.eslintrc.*`:
317312
// If not configured this option, The parser will try to read the option from `compilerOptions.runes` from `svelte.config.js`.
318313
// If `parserOptions.svelteConfig` is not specified and the file cannot be parsed by static analysis, it will behave as `true`.
319314
"runes": true,
320-
/* -- Experimental Svelte Features -- */
321-
/* It may be changed or removed in minor versions without notice. */
322-
// Whether to parse the `generics` attribute.
323-
// See https://github.com/sveltejs/rfcs/pull/38
324-
"experimentalGenerics": false,
325315
},
326316
},
327317
}

src/parser/converts/root.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,7 @@ export function convertSvelteRoot(
173173
body.push(style);
174174
}
175175
body.push(...convertChildren({ nodes: snippetChildren }, ast, ctx));
176-
if (script && ctx.parserOptions.svelteFeatures?.experimentalGenerics)
177-
convertGenericsAttribute(script, ctx);
176+
if (script) convertGenericsAttribute(script, ctx);
178177

179178
// Set the scope of the Program node.
180179
ctx.scriptLet.addProgramRestore(

src/parser/parser-options.ts

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ export type NormalizedParserOptions = {
2626
// If not configured this option, The parser will try to read the option from `compilerOptions.runes` from `svelte.config.js`.
2727
// If `parserOptions.svelteConfig` is not specified and the file cannot be parsed by static analysis, it will behave as `true`.
2828
runes?: boolean;
29-
// Whether to parse the `generics` attribute.
30-
// See https://github.com/sveltejs/rfcs/pull/38
31-
experimentalGenerics?: boolean;
3229
};
3330
loc: boolean;
3431
range: boolean;

tests/src/parser/test-utils.ts

-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ const BASIC_PARSER_OPTIONS: Linter.ParserOptions = {
2121
},
2222
project: require.resolve("../../fixtures/tsconfig.test.json"),
2323
extraFileExtensions: [".svelte"],
24-
svelteFeatures: {
25-
experimentalGenerics: true,
26-
},
2724
};
2825

2926
const SVELTE5_SCOPE_VARIABLES_BASE = [

0 commit comments

Comments
 (0)