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 3.4.2 prettier-plugin-svelte 3.3.3
// .prettierrc { "plugins": ["prettier-plugin-svelte"], "overrides": [ { "files": "*.svelte", "options": { "parser": "svelte" } } ] }
Input:
<script lang="ts"> const modes = { a: "mode 1", b: "mode 2", c: "mode 3" } as const; type Mode = keyof typeof modes; let currentMode: Mode = $state("a"); </script> {#each (Object.entries(modes) as [Mode, string][]) as [id, name]} <button onclick={() => (currentMode = id)}>{name}</button> {/each}
Output:
<script lang="ts"> const modes = { a: "mode 1", b: "mode 2", c: "mode 3" } as const; type Mode = keyof typeof modes; let currentMode: Mode = $state("a"); </script> {#each Object.entries(modes) as [Mode, string][] as [id, name]} <button onclick={() => (currentMode = id)}>{name}</button> {/each}
Expected output: (same as input)
Why?
Formatter is removing parentheses from the each block types, which leads to a syntax error when the code is formatted.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Prettier 3.4.2
prettier-plugin-svelte 3.3.3
Input:
Output:
Expected output: (same as input)
Why?
Formatter is removing parentheses from the each block types, which leads to a syntax error when the code is formatted.
The text was updated successfully, but these errors were encountered: