Skip to content

feat: stabilize generics #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/orange-laws-tie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"svelte-eslint-parser": minor
---

feat: stabilized generics
10 changes: 0 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
},
},
Expand All @@ -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,
},
},
}
Expand Down
3 changes: 1 addition & 2 deletions src/parser/converts/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
3 changes: 0 additions & 3 deletions src/parser/parser-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 0 additions & 3 deletions tests/src/parser/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down
Loading