printWidth ignored
See original GitHub issuewhy is the svg path not break down into multiple lines?
<svg
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
aria-hidden="true"
focusable="false"
role="img"
class="animate-spin text-5xl dark:text-white"
width="1em"
height="1em"
preserveAspectRatio="xMidYMid meet"
viewBox="0 0 1024 1024"
style="transform: rotate(360deg)"
>
<path
d="M512 1024c-69.1 0-136.2-13.5-199.3-40.2C251.7 958 197 921 150 874c-47-47-84-101.7-109.8-162.7C13.5 648.2 0 581.1 0 512c0-19.9 16.1-36 36-36s36 16.1 36 36c0 59.4 11.6 117 34.6 171.3c22.2 52.4 53.9 99.5 94.3 139.9c40.4 40.4 87.5 72.2 139.9 94.3C395 940.4 452.6 952 512 952c59.4 0 117-11.6 171.3-34.6c52.4-22.2 99.5-53.9 139.9-94.3c40.4-40.4 72.2-87.5 94.3-139.9C940.4 629 952 571.4 952 512c0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9a437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.2C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7c26.7 63.1 40.2 130.2 40.2 199.3s-13.5 136.2-40.2 199.3C958 772.3 921 827 874 874c-47 47-101.8 83.9-162.7 109.7c-63.1 26.8-130.2 40.3-199.3 40.3z"
fill="currentColor"
/>
</svg>
# .prettierrc.yml
svelteSortOrder: options-scripts-markup-styles
svelteStrictMode: false
svelteAllowShorthand: true
svelteBracketNewLine: true
svelteIndentScriptAndStyle: true
printWidth: 80
endOfLine: "lf"
semi: false
useTabs: false
tabWidth: 2
//versions
"prettier": "^2.2.1",
"prettier-plugin-svelte": "^2.2.0",
//vscode setting
"[svelte]": {
"editor.defaultFormatter": "svelte.svelte-vscode"
},
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
printWidth ignored for object attributes · Issue #230 - GitHub
When attributes contain object that are longer than the printWidth, they should be split-up, this is what they do in normal React JSX/TSX ......
Read more >prettier printWidth setting is not formatting correctly on save
It's still not working for me. I even tried uninstalling/reinstalling prettier extension, but still nothing :(.
Read more >Prettier ignoring PrintWidth and forcing 80 columns? - Reddit
It's like it knows it's there, but is ignoring it. Any help to be able to set it to 120 would be appreciated....
Read more >Visual Studio Code and Prettier not respecting print width field
Visual Studio Code and Prettier not respecting print width field. Hi all, I have decided to swap from the dev console to visual...
Read more >Options - Prettier
Prettier's printWidth option does not work the same way. It is not the hard upper allowed line ... JSX quotes ignore this option...
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
This is unrelated to the OP’s request and sounds like a bug. The OP’s request is about a string-only attribute, you have an object with properties there. Please open another ticket with a reproducible and copy-pasteable code snippet.
@dummdidumm Here is a short video showing what I mean:
https://user-images.githubusercontent.com/1843672/119083353-d18c5000-b9cd-11eb-96e6-0e3548364cc5.mov
You’re right, string attributes are not formatted, but object attributes are reformatted onto a single line. Prettier handles this fine for React Prop Object attributes.
At the end of the clip I showed how I moved my css object from being “inline” to declared as a variable, so that I could read it better. This is what I meant by “reorganizing”.
Tbh, it’s kind of frustrating, I might start digging into the source soon to try and hack a workaround.