Adjust quoting behavior, adjust/remove strict option
#348svelteSelfCloseComponents
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
Description
Changes proposed in this pull request:
Related issue(s)
Resolves #2946
Remove the "always quote things" option because it's technically invalid: sveltejs/svelte#7925 This means we should likely deprecate the strict mode option altogether in favor of a more fine grained set of options around self closing tags, shorthand props etc.
We decided to keep strict mode around (not deprecate it) and not adjust the quoting behavior yet, as it needs more consensus/thought. Self-closing tags are now left as-is for components, strict mode still disallows non-void dom elements to self-close.
Will this be reconsidered after sveltejs/svelte#11052 happening? It sure would be nice to have Prettier not conflict with Svelte in the future.