We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
prettier-plugin-svelte delete part of snippet types, resulting in broken code
<script lang="ts"> const arr: string[] = [] const obj: { key: string } = {} </script> {#snippet test1(arg: typeof arr[number])} {/snippet} {#snippet test2(arg: typeof obj["key"])} {/snippet}
will first format to
<script lang="ts"> const arr: string[] = [] const obj: { key: string } = {} </script> {#snippet test1(arg: (typeof arr)[number])} {/snippet} {#snippet test2(arg: (typeof obj)["key"])} {/snippet}
then finally format to this broken svelte code
<script lang="ts"> const arr: string[] = [] const obj: { key: string } = {} </script> {#snippet test1(arg: (typeof arr)} {/snippet} {#snippet test2(arg: (typeof obj)} {/snippet}
System: OS: Linux 6.5 KDE neon 6.0 6.0 CPU: (8) x64 11th Gen Intel(R) Core(TM) i5-1135G7 @ 2.40GHz Memory: 5.88 GB / 15.40 GB Container: Yes Shell: 5.1.16 - /bin/bash Binaries: Node: 22.5.1 - ~/.local/share/nvm/v22.5.1/bin/node Yarn: 1.22.22 - ~/.local/share/nvm/v22.5.1/bin/yarn npm: 10.8.2 - ~/.local/share/nvm/v22.5.1/bin/npm pnpm: 9.4.0 - ~/.local/share/nvm/v22.5.1/bin/pnpm bun: 1.1.16 - ~/.bun/bin/bun Browsers: Brave Browser: 127.1.68.134 npmPackages: svelte: ^5.0.0-next.206 => 5.0.0-next.206
annoyance
The text was updated successfully, but these errors were encountered:
Similarly
{#snippet foo({ onselect }: { onselect: (value: string) => void})} <p>...</p> {/snippet}
Gets formatted to
{#snippet foo({ onselect }: { onselect: (value: string)} <p>...</p> {/snippet}
Sorry, something went wrong.
a1a3f92
I am facing this problem with this snippet:
{#snippet variableIcon(type: (typeof variableTypes)[number])} ... {/snippet}
It gets formatted as {#snippet variableIcon(type: (typeof variableTypes)}
{#snippet variableIcon(type: (typeof variableTypes)}
Changing to this fixed it:
<script> ... type IconTypes = (typeof variableTypes)[number]; </script>
{#snippet variableIcon(type: IconTypes)} ... {/snippet}
Apologies for the delay, this was fixed a while ago but only published just now.
No branches or pull requests
Describe the bug
prettier-plugin-svelte delete part of snippet types, resulting in broken code
Reproduction
will first format to
then finally format to this broken svelte code
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: