Skip to content

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

@sylc

Description

@sylc
Contributor

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

Activity

added
bugSomething isn't working correctly
upstreamChanges in upstream are required to solve these issues
deno fmtRelated to the "deno fmt" subcommand or dprint
on Nov 22, 2024
janosh

janosh commented on Mar 6, 2025

@janosh
Contributor

also seeing this in janosh/svelte-bricks@a8f9484 (CI run). is there a workaround (besides avoiding dynamic styles)?

sylc

sylc commented on Mar 8, 2025

@sylc
ContributorAuthor

My current workaround is to disable the line with deno-fmt-ignore eg:

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

<!-- deno-fmt-ignore -->
<div
  class="circle"
  style="background-color: {color || 'blueviolet'}; display: inline-block"
>
</div>
added a commit that references this issue on Jun 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlydeno fmtRelated to the "deno fmt" subcommand or dprintupstreamChanges in upstream are required to solve these issues

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @sylc@bartlomieju@janosh

      Issue actions

        fmt(svelte): formatter error on dynamic style in svelte · Issue #26999 · denoland/deno