breaking: new options, deprecate svelteStrictMode
#380I tried both of these options to stop that behaviour :
"svelte.plugin.svelte.format.config.svelteStrictMode": true,
"svelte.plugin.html.completions.enable": false
With "svelte.plugin.svelte.format.config.svelteStrictMode": true
, <div></div>
does not become <div />
when saving.
But <Container></Container>
will still become <Container />
I tried to disable other html formatting but couldn't find any option that prevents self-closing of Svelte components
Given the following example:
<input {value} on:input="{(ev) => console.log(ev.currentTarget.value)}" />
Formatting with strict mode turned off will result in the following output:
<input {value} on:input={(ev) => console.log(ev.currentTarget.value)} />
While having it on will result in the following output:
<input value="{value}" on:input="{(ev) => console.log(ev.currentTarget.value)}" />
Now my editor plugin that handles svelte syntax highlighting (emacs web-mode) is an ungodly mess of spaghetti code and regexes and doesn't like unquoted curly braces so I'd like to enforce quotes around them, while still using shorthand attributes and self-closing tags where strict mode wouldn't allow them. Can an option be added that enables just the quoting behavior from strict mode?
Hello,
I think when the html tag is empty, it should use self-closing on format.
When I'm writing code, sometimes I write just boilerplate of HTML tags before I implement any styles and it's kinda annoying that it's closing empty elements, and to be honest it doesn't really make sense...
If the tag is not empty and contains any attribute so I believe self-closing will be the right way to go for e.g.
<div class="a" /> ✅
<div /> ❌
<div></div> ✅
Thanks!
Write any HTML tag and save the file I use Prettier for formatting, and auto-format on save
No response
System:
OS: macOS 10.15.5
CPU: (12) x64 Intel(R) Xeon(R) CPU X5690 @ 3.47GHz
Memory: 2.86 GB / 48.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 16.13.2 - ~/.nvm/versions/node/v16.13.2/bin/node
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.2/bin/npm
Browsers:
Chrome: 100.0.4896.75
Firefox: 98.0.2
Firefox Developer Edition: 98.0
Safari: 13.1.1
npmPackages:
svelte: ^3.44.0 => 3.46.6
annoyance
<div />
or <Component />
that stays as is, and so does <div></div>
/<Component></Component>
. svelteStrictMode
only has effect on elements (not allowing self-closing non-void-ones)svelteAllowShorthand
now takes precedence over svelteStrictMode
, which no longer has any effect on that behaviorcloses #284 closes #279 closes #238 related to #348 related to #377 superseeds / closes #379 as less options = better
refactor: Remove deprecated concat
Remove Concat node checks
Updates the code base to using prettier v3. This required a refactoring of embeds since the call timing is now different
Co-authored-by: Simon H 5968653+dummdidumm@users.noreply.github.com Co-authored-by: Rolaka hyperion.neil@gmail.com Co-authored-by: Simon Holthausen simon.holthausen@vercel.com
<div />
or <Component />
that stays as is, and so does <div></div>
/<Component></Component>
. svelteStrictMode
no longer has any effect on this behavior - svelteAllowShorthand
now takes precedence over svelteStrictMode
, which no longer has any effect on that behavior - svelteStrictMode
is deprecated as future Svelte versions might coerce numbers coming from mustache tags inside strings into strings closes #348 closes #284 closes #279 closes #238 related to #377 superseeds / closes #379 as less options = better