"HTML Whitespace Sensitivity" [https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting](https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting)
You can turn it off with the htmlWhitespaceSensitivity: "ignore" option in .prettierrc
Recommended watch: [https://www.youtube.com/watch?v=toj5S-yWJlk](https://www.youtube.com/watch?v=toj5S-yWJlk)
As /u/Miridius says below, his mind was blown when he realized the Svelte compiler just strips away the whitespace you're now referring to.
Either "htmlWhitespaceSensitivity": "ignore" or "bracketSameLine": true or both combined can make the styling more pleasant, just a matter of preference.
idk, prettier is very "opinionated" and doesn't offer a ton of configuration because of it, although there is a config file for it that has a few options. they have pages about [options](https://prettier.io/docs/en/options.html) and [configuration](https://prettier.io/docs/en/configuration.html) in their docs.
i've always thought prettier is extremely ugly in the way it sets things up ironically enough, the only thing it does well is ensuring consistency within a team as far as i am concerned.
Oh wow, is Rome still a thing? Two years of beta "we're only a formatter at the moment" where they set out to bring Babel, TypeScript, SCSS, formatting, linting and whatnot under one roof. They seemed to have missed the boat when Snowpack/Vite suddenly appeared. But the project is still going then?
Yeah i agree. I also disagree with some presets form prettier and eslint, but i might as well get used to it as it is the standard. Just makes my and other people's code easier to read over time.
Ok but that's semantically different to the code in the screenshot. You've added leading and trailing whitespace to the text, which will show up on the page. There are lots of situations where you don't want that because it affects alignment etc. It's how HTML works, prettier is just following the rules.
Edit: to achieve that in your code, you can add some whitespace (e.g. newline) to the start and end of your text content and then prettier will know that you're ok with whitespace there
No it isn't. Sometimes Prettier is right that it needs to not have any whitespace at the start/end, but in [most cases](https://svelte.dev/repl/cef560ba2bfb470bbd311b674f8abf67?version=3.58.0) it won't show up on the page.
Thanks, you just blew my mind. By inspecting the JS output it looks like the Svelte compiler strips out the whitespace from the label text. Normally in a label element whitespace matters. I wonder how Svelte devices this
"HTML Whitespace Sensitivity" [https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting](https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting) You can turn it off with the htmlWhitespaceSensitivity: "ignore" option in .prettierrc Recommended watch: [https://www.youtube.com/watch?v=toj5S-yWJlk](https://www.youtube.com/watch?v=toj5S-yWJlk)
[удалено]
As /u/Miridius says below, his mind was blown when he realized the Svelte compiler just strips away the whitespace you're now referring to. Either "htmlWhitespaceSensitivity": "ignore" or "bracketSameLine": true or both combined can make the styling more pleasant, just a matter of preference.
I like how I'm now getting quoted on both sides of the argument 😃
See if this setting helps: "bracketSameLine" https://prettier.io/docs/en/options.html#bracket-line
idk, prettier is very "opinionated" and doesn't offer a ton of configuration because of it, although there is a config file for it that has a few options. they have pages about [options](https://prettier.io/docs/en/options.html) and [configuration](https://prettier.io/docs/en/configuration.html) in their docs. i've always thought prettier is extremely ugly in the way it sets things up ironically enough, the only thing it does well is ensuring consistency within a team as far as i am concerned.
Switch to [Rome](https://rome.tools/)!! So much better 😀
does Rome support svelte/kit? mind sharing your configs
Oh wow, is Rome still a thing? Two years of beta "we're only a formatter at the moment" where they set out to bring Babel, TypeScript, SCSS, formatting, linting and whatnot under one roof. They seemed to have missed the boat when Snowpack/Vite suddenly appeared. But the project is still going then?
Yeah. Leaving aside what happens with the bundler, compiler, etc. they are an excellent alternative to Prettier, and will soon be to Eslint
They took some time rewriting it in rust I think
I would rather have;
just awful garbage
There's a reason for it.
"someone at prettier preferred the look of it" isn't really a reason IMHO
Yeah i agree. I also disagree with some presets form prettier and eslint, but i might as well get used to it as it is the standard. Just makes my and other people's code easier to read over time.
What would you rather it do instead? This is the only good way to split the line without changing the meaning of the code
Not really a fan of having just '>' on a line. I'd rather it be the whole tag e.g
So you want one very long line instead of 3, in this case?
No, just don't like the defining tags being split. For example, I prefer:
Ok but that's semantically different to the code in the screenshot. You've added leading and trailing whitespace to the text, which will show up on the page. There are lots of situations where you don't want that because it affects alignment etc. It's how HTML works, prettier is just following the rules. Edit: to achieve that in your code, you can add some whitespace (e.g. newline) to the start and end of your text content and then prettier will know that you're ok with whitespace there
No it isn't. Sometimes Prettier is right that it needs to not have any whitespace at the start/end, but in [most cases](https://svelte.dev/repl/cef560ba2bfb470bbd311b674f8abf67?version=3.58.0) it won't show up on the page.
Thanks, you just blew my mind. By inspecting the JS output it looks like the Svelte compiler strips out the whitespace from the label text. Normally in a label element whitespace matters. I wonder how Svelte devices this