Enable just the quoting behavior from strict mode
#279svelteSelfCloseComponents
and svelteSelfCloseElements
to specify whether or not empty elements/components should self-close. svelteStrictMode
no longer has any effect on this behavior.
<div></div>
it stays as this, and if the user says <div />
that also stays like this. This is what Prettier currently does in both HTML and JSXsvelteAllowShorthand
now takes precedence over svelteStrictMode
, which no longer has any effect on that behaviorsvelteStrictMode
is deprecated as future Svelte versions might coerce numbers coming from mustache tags inside strings into stringscloses #348 closes #284 closes #279 closes #238 related to #377
<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
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?
In version 3, the shorthand setting will take precedence over strict mode.