From 32ecdb0b0f4dfe6709045ea0efc56e98d95356d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20D=C4=9Bdi=C4=8D?= Date: Fri, 22 Nov 2024 16:23:08 +0100 Subject: [PATCH] feat: stabilized generics --- .changeset/orange-laws-tie.md | 5 +++++ README.md | 10 ---------- src/parser/converts/root.ts | 3 +-- src/parser/parser-options.ts | 3 --- tests/src/parser/test-utils.ts | 3 --- 5 files changed, 6 insertions(+), 18 deletions(-) create mode 100644 .changeset/orange-laws-tie.md diff --git a/.changeset/orange-laws-tie.md b/.changeset/orange-laws-tie.md new file mode 100644 index 00000000..810419f2 --- /dev/null +++ b/.changeset/orange-laws-tie.md @@ -0,0 +1,5 @@ +--- +"svelte-eslint-parser": minor +--- + +feat: stabilized generics diff --git a/README.md b/README.md index 628930aa..17310844 100644 --- a/README.md +++ b/README.md @@ -291,11 +291,6 @@ export default [ // If not configured this option, The parser will try to read the option from `compilerOptions.runes` from `svelte.config.js`. // If `parserOptions.svelteConfig` is not specified and the file cannot be parsed by static analysis, it will behave as `true`. runes: true, - /* -- Experimental Svelte Features -- */ - /* It may be changed or removed in minor versions without notice. */ - // Whether to parse the `generics` attribute. - // See https://github.com/sveltejs/rfcs/pull/38 - experimentalGenerics: false, }, }, }, @@ -317,11 +312,6 @@ For example in `.eslintrc.*`: // If not configured this option, The parser will try to read the option from `compilerOptions.runes` from `svelte.config.js`. // If `parserOptions.svelteConfig` is not specified and the file cannot be parsed by static analysis, it will behave as `true`. "runes": true, - /* -- Experimental Svelte Features -- */ - /* It may be changed or removed in minor versions without notice. */ - // Whether to parse the `generics` attribute. - // See https://github.com/sveltejs/rfcs/pull/38 - "experimentalGenerics": false, }, }, } diff --git a/src/parser/converts/root.ts b/src/parser/converts/root.ts index aa713bd8..54cbe964 100644 --- a/src/parser/converts/root.ts +++ b/src/parser/converts/root.ts @@ -173,8 +173,7 @@ export function convertSvelteRoot( body.push(style); } body.push(...convertChildren({ nodes: snippetChildren }, ast, ctx)); - if (script && ctx.parserOptions.svelteFeatures?.experimentalGenerics) - convertGenericsAttribute(script, ctx); + if (script) convertGenericsAttribute(script, ctx); // Set the scope of the Program node. ctx.scriptLet.addProgramRestore( diff --git a/src/parser/parser-options.ts b/src/parser/parser-options.ts index b8f15d1a..f8052939 100644 --- a/src/parser/parser-options.ts +++ b/src/parser/parser-options.ts @@ -26,9 +26,6 @@ export type NormalizedParserOptions = { // If not configured this option, The parser will try to read the option from `compilerOptions.runes` from `svelte.config.js`. // If `parserOptions.svelteConfig` is not specified and the file cannot be parsed by static analysis, it will behave as `true`. runes?: boolean; - // Whether to parse the `generics` attribute. - // See https://github.com/sveltejs/rfcs/pull/38 - experimentalGenerics?: boolean; }; loc: boolean; range: boolean; diff --git a/tests/src/parser/test-utils.ts b/tests/src/parser/test-utils.ts index ec68fec6..8d98c0e6 100644 --- a/tests/src/parser/test-utils.ts +++ b/tests/src/parser/test-utils.ts @@ -21,9 +21,6 @@ const BASIC_PARSER_OPTIONS: Linter.ParserOptions = { }, project: require.resolve("../../fixtures/tsconfig.test.json"), extraFileExtensions: [".svelte"], - svelteFeatures: { - experimentalGenerics: true, - }, }; const SVELTE5_SCOPE_VARIABLES_BASE = [