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
* drop support for svelte <5
* Update README.md
* Update README.md
* update readme
* Update README.md
---------
Co-authored-by: Simon H <[email protected]>
Copy file name to clipboardExpand all lines: README.md
+8-48Lines changed: 8 additions & 48 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,5 @@
1
+
> This documentation is for `prettier-plugin-svelte` version 4 which only works with Svelte 5. See [this branch](https://github.com/sveltejs/prettier-plugin-svelte/tree/version-3) for documentation of previous versions.
2
+
1
3
# Prettier for Svelte components
2
4
3
5
Format your Svelte components using Prettier.
@@ -26,6 +28,7 @@ Installing the plugin as a package allows:
26
28
27
29
### Compatibility
28
30
31
+
-`prettier-plugin-svelte@4` only works with `prettier@3`
29
32
-`prettier-plugin-svelte@3` only works with `prettier@3`
30
33
-`prettier-plugin-svelte@2` only works with `prettier@2`
31
34
@@ -56,8 +59,7 @@ If you want to customize some formatting behavior, see section [Options](#option
Version 3 contains the following breaking changes:
232
+
> For migration to `prettier-plugin-svelte@3`[see here](https://github.com/sveltejs/prettier-plugin-svelte/tree/version-3?tab=readme-ov-file#migration).
254
233
255
-
- 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)
256
-
-`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
257
-
- Some deprecated `svelteSortOrder` options were removed, see the the options section above for which values are valid for that options
258
-
259
-
Version 3 of this plugin only works with Prettier version 3. Prettier version 3 contains some changes to how it loads plugins which may require you to adjust your configuration file:
260
-
261
-
- Prettier no longer searches for plugins in the directory automatically, you need to tell Prettier specifically which plugins to use. This means you need to add `"plugins": ["prettier-plugin-svelte"]` to your config if you haven't already. Also remove the deprecated option `pluginSearchDirs`.
262
-
- Prettier loads plugins from the plugin array differently. If you have used `require.resolve("prettier-plugin-svelte")` in your `.prettierrc.cjs` to tell Prettier where to find the plugin, you may need to remove that and just write `"prettier-plugin-svelte"` instead
234
+
Upgrade to Svelte 5 before upgrading to `prettier-plugin-svelte@4`, as it doesn't support older Svelte versions.
263
235
264
236
## FAQ
265
237
@@ -283,15 +255,3 @@ becomes this
283
255
```
284
256
285
257
it's because of whitespace sensitivity. For inline elements (`span`, `a`, etc) it makes a difference when rendered if there's a space (or newline) between them. Since we don't know if your slot inside your Svelte component is surrounded by inline elements, Svelte components are treated as such, too. You can adjust this whitespace sensitivity through [this setting](https://prettier.io/docs/en/options.html#html-whitespace-sensitivity). You can read more about HTML whitespace sensitivity [here](https://prettier.io/blog/2018/11/07/1.15.0.html#whitespace-sensitive-formatting).
286
-
287
-
### Version 2 does not work in `pnpm`
288
-
289
-
You may need to use a `.prettierrc.cjs` file instead to point Prettier to the exact location of the plugin using `require.resolve`:
0 commit comments