sveltejs / prettier-plugin-svelte

Format your svelte components using prettier.
MIT License
745 stars 97 forks source link

Top-level `<script>` tag formatted incorrectly #344

Closed g-plane closed 1 year ago

g-plane commented 1 year ago

Version

Prettier: v2.8.3 prettier-plugin-svelte: v2.9.0

Input

Attribute value without quotes.

<script lang=ts></script>

Actual Output

The = char is removed.

<script lang ts></script>

Expected Output

It should add quotes, not remove the =.

<script lang="ts"></script>

I can provide more detail if you need.

Rolaka commented 1 year ago

Tried to fix the regex, tested against some examples.

attr=value
['attr=value', 'attr', null, 'value']

attr="value"
['attr="value"', 'attr', '"', 'value']

attr='value'
["attr='value'", 'attr', "'", 'value']

attr
['attr', 'attr']