You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
breaking: new options, deprecate svelteStrictMode (#380)
- whether or not empty elements/components should self-close is now left to the user - in other words, if you write `<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 behavior
closes#284closes#279closes#238
related to #348
related to #377
superseeds / closes#379 as less options = better
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,8 @@
4
4
5
5
- (breaking) requires `prettier` version 3
6
6
- (breaking) requires node version 14 or higher
7
+
- (breaking) Whether or not empty elements/components should self-close is now left to the user - in other words, if you write `<div />` or `<Component />` that stays as is, and so does `<div></div>`/`<Component></Component>`. If `svelteStrictMode` is turned on, it will still only allow `<div></div>` notation for elements (but it will leave your components alone)
8
+
- (breaking) `svelteAllowShorthand` now takes precedence over `svelteStrictMode`, which no longer has any effect on that behavior. Set `svelteAllowShorthand` to `false` to get back the v2 behavior
@@ -43,7 +45,7 @@ If you want to customize some formatting behavior, see section "Options" below.
43
45
44
46
## Options
45
47
46
-
``Configurations are optional``
48
+
`Configurations are optional`
47
49
48
50
Make a `.prettierrc` file in your project directory and add your preferred [options](https://prettier.io/docs/en/options.html) to [configure Prettier](https://prettier.io/docs/en/configuration.html). When using Prettier through the CLI, you can also pass options through CLI flags, but a `.prettierrc` file is recommended.
49
51
@@ -61,10 +63,13 @@ Format: join the keywords `options`, `scripts`, `markup`, `styles` with a `-` in
61
63
62
64
### Svelte Strict Mode
63
65
64
-
More strict HTML syntax: less self-closed tags, quotes in attributes, no attribute shorthand (overrules `svelteAllowShorthand`).
66
+
More strict HTML syntax: Quotes in attributes and no self-closing DOM elements (except void elements).
67
+
68
+
> In version 2 this overruled `svelteAllowShorthand`, which is no longer the case.
65
69
66
70
Example:
67
71
72
+
<!-- prettier-ignore -->
68
73
```html
69
74
<!-- svelteStrictMode: true -->
70
75
<divfoo="{bar}"></div>
@@ -83,6 +88,7 @@ Option to enable/disable component attribute shorthand if attribute name and exp
0 commit comments