Skip to content
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

fmt(svelte): formatter error on dynamic style in svelte #82

Open
MohammadSu1 opened this issue Nov 24, 2024 · 2 comments
Open

fmt(svelte): formatter error on dynamic style in svelte #82

MohammadSu1 opened this issue Nov 24, 2024 · 2 comments
Labels
help wanted Extra attention is needed

Comments

@MohammadSu1
Copy link

Version Deno 2.1.1

<script lang="ts">
  const { color }: { color: string | null } = $props();
</script>

<div
  style="background-color: {color || 'blueviolet'};"
>
</div>
deno fmt --unstable-component
Error formatting: C:\temp\deno-init\test.svelte
   syntax error at line 6, col 28: expect token `<ident>`, but found `{`
Checked 4 files

Originally reported in denoland/deno#26999

@g-plane
Copy link
Owner

g-plane commented Nov 25, 2024

This is a known issue, but hard to fix at this moment.

@g-plane g-plane added the help wanted Extra attention is needed label Nov 25, 2024
@notramo
Copy link

notramo commented Dec 5, 2024

It's not quite idiomatic Svelte. It could be better written as:

<div style:background-color={color || 'blueviolet'}></div>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants