-
Notifications
You must be signed in to change notification settings - Fork 97
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
Extra whitespace in class attributes should be removed. #339
Comments
As far as I can tell, in prettier-plugin-svelte/src/lib/elements.ts Lines 61 to 65 in 3a353ab
Without any configuration, prettier turns this: <html>
<body>
<div class="some thing"></div>
</body>
</html> into this: <html>
<body>
<div class="some thing"></div>
</body>
</html> For that reason, I would advocate to stay consistent with prettier and turn on class formatting by simply adding "class" to |
ptrxyz
added a commit
to ptrxyz/prettier-plugin-svelte
that referenced
this issue
Mar 18, 2023
Closed
dummdidumm
added a commit
to dummdidumm/prettier-plugin-svelte
that referenced
this issue
Mar 22, 2023
dummdidumm
added a commit
that referenced
this issue
Mar 22, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following piece of HTML:
If this code is inside an
.svelte
file, prettier does not remove the extra whitespace in the class attribute, however if it's inside a.html
file, prettier will indeed remove them (in accordance to prettier's docs).To reproduce, follow this minimal example:
src/app.html
to contain the following line somewhere inside the<body>
tag:src/routes/+page.svelte
to contain the same line somewhere.pnpm run format
app.html
and find the class attribute value formatted, no extra whitespaces.src/routes/+page.svelte
and find the class attribute value NOT formatted. Extra whitespaces everywhere.I think the formatting should be consistent, no matter if the class attribute is inside a
.svelte
file or inside a.html
file.The text was updated successfully, but these errors were encountered: