-
Notifications
You must be signed in to change notification settings - Fork 97
Closed as not planned
Description
Problem
Single line per attribute is set to true in my project, but prettier only formats multi-attribute html lines when they are past the printWidth length. Prettier seems to work properly because I copied the exact same code into a normal HTML file and it worked as expected there.
Expected Behavior
When Single Line Per Attribute is true it should work exactly the same in svelte files as it does in normal html files.
Steps to Reproduce*
Copy this code into two files, one ending in .svelte and the other ending in .html
<div class="flex flex-col justify-center py-2 lg:h-[var(--hd)] lg:py-0">
<button on:click="{toggleMenu}" class="btn btn-primary text-lg normal-case">
Request a Quote
</button>
</div>
Copy this code into your .prettierrc file
{
"useTabs": false,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"proseWrap": "preserve",
"pluginSearchDirs": ["."],
"semi": false,
"singleAttributePerLine": true,
"plugins": ["prettier-plugin-tailwindcss"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte",
"svelteSortOrder": "options-scripts-styles-markup",
"singleAttributePerLine": true
}
}
]
}
Put this in your package.json
"format": "prettier --write ."
I use yarn, so I run yarn run format from the command line. I get different results in the html and svelte files.
Metadata
Metadata
Assignees
Labels
No labels