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

Top-level <script> tag formatted incorrectly #344

Closed
g-plane opened this issue Feb 5, 2023 · 1 comment · Fixed by #345
Closed

Top-level <script> tag formatted incorrectly #344

g-plane opened this issue Feb 5, 2023 · 1 comment · Fixed by #345
Labels
bug Something isn't working

Comments

@g-plane
Copy link

g-plane commented Feb 5, 2023

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 added a commit to Rolaka/prettier-plugin-svelte that referenced this issue Feb 5, 2023
Fix attributeRegex that correctly match attributes that are not enclosed in quotes.
fix sveltejs#344
Rolaka added a commit to Rolaka/prettier-plugin-svelte that referenced this issue Feb 5, 2023
Fix attributeRegex that correctly match attributes that are not enclosed in quotes.
fix sveltejs#344
Rolaka added a commit to Rolaka/prettier-plugin-svelte that referenced this issue Feb 5, 2023
Fix attributeRegex that correctly match attributes that are not enclosed in quotes.
fix sveltejs#344
Rolaka added a commit to Rolaka/prettier-plugin-svelte that referenced this issue Feb 5, 2023
Fix attributeRegex that correctly match attributes that are not enclosed in quotes.
fix sveltejs#344
Rolaka added a commit to Rolaka/prettier-plugin-svelte that referenced this issue Feb 5, 2023
Fix attributeRegex that correctly match attributes that are not enclosed in quotes.
fix sveltejs#344
@Rolaka
Copy link
Contributor

Rolaka commented Feb 5, 2023

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']

@dummdidumm dummdidumm added the bug Something isn't working label Mar 14, 2023
dummdidumm added a commit that referenced this issue Mar 22, 2023
Fix attributeRegex so that it correctly matches attributes that are not enclosed in quotes.
fix #344

---------

Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants