Prettier prints 1 attribute per line
See original GitHub issueInput:
<div class="main__image-list main-image-list--margin main__image-list-one"></div>
Output:
<div
class="main__image-list main-image-list--margin main__image-list-one"
></div>
Another example Input:
<link
rel="stylesheet"href="https://use.fontawesome.com/releases/v5.6.3/css/all.css" integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/" crossorigin="anonymous" />
Output:
<link
rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.6.3/css/all.css"
integrity="sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/"
crossorigin="anonymous"
/>
And more others tags (img…)
this is a bug or a trick? What do you think about ?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:28 (11 by maintainers)
Top Results From Across the Web
Prettier 2.6: new singleAttributePerLine option and new ...
This release includes a new singleAttributePerLine option. This is an option to print only one attribute per line in Vue SFC templates, ...
Read more >Prettier: Single Attribute Per Line : r/reactjs - Reddit
Prettier will only switch to one attribute per line if you approach the target print width. You can increase the print width to...
Read more >How do you stop Prettier in VS code splitting attributes onto ...
A quick fix is to go to Prettier Extension Settings (ctrl + shift + X) and in Prettier Extension Settings search for "Print...
Read more >Prettier on Twitter: "We just released Prettier 2.6, featuring new ...
This release includes a new `singleAttributePerLine` option. This is an option to print only one attribute per line in Vue SFC templates, HTML, ......
Read more >What Did Prettier Do to My HTML? - WalkingRiver.com
Prettier's decision of displaying one-attribute-per line means that each change affects exactly one line. Changes are easy to spot; they clearly ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Not sure if my case refers to this issue, but it seems kinda similar. I’ve set Prettier VSC extension
html.format.wrapLineLength
andprettier.printWidth
properties to the same value. Every time the line length is larger that defined, it causes not needed formatting - each property goes into the new line:I would like to have the line wrapped only to necessary number of lines, which means the next property which exceed the line length goes to next line etc.:
I’m not sure if this feature already exists, but it would be nice to have it.
+1, breaking 100 attribute to 100 line doesn’t make sense. the
printWidth
rule should be respected and when there is still room to fill in one line, why break things in a new line?here for a small text like
icon=something
&size="m"
spared one line each?