Skip to content

Commit c4295e8

Browse files
carmanchris31dummdidummRolaka
authored
Chore/upgrade prettier v3 (#365)
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 <[email protected]> Co-authored-by: Rolaka <[email protected]> Co-authored-by: Simon Holthausen <[email protected]>
1 parent e8aaeb8 commit c4295e8

35 files changed

+709
-3226
lines changed

.github/workflows/main.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ jobs:
66
runs-on: ubuntu-latest
77

88
steps:
9-
- uses: actions/checkout@v2
10-
- uses: actions/setup-node@v1
9+
- uses: actions/checkout@v3
10+
- uses: actions/setup-node@v3
1111
with:
1212
cache: npm
1313

CHANGELOG.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
# prettier-plugin-svelte changelog
22

3-
## 3.0.0 (Unreleased
3+
## 3.0.0 (Unreleased)
44

55
- (breaking) requires `prettier` version 3
66
- (breaking) requires node version 14 or higher
77

8+
## 2.10.1
9+
10+
- (chore) mark as compatible with Svelte 4
11+
12+
## 2.10.0
13+
14+
- (feat) support `requirePragma` and `insertPragma` options ([#350](https://github.com/sveltejs/prettier-plugin-svelte/issues/350))
15+
- (feat) support `<svelte:document>`
16+
- (feat) trim whitespace in `class` attributes ([#339](https://github.com/sveltejs/prettier-plugin-svelte/issues/339))
17+
- (feat) allow multiple comments atop of script/style tags ([#291](https://github.com/sveltejs/prettier-plugin-svelte/issues/291))
18+
- (fix) handle script/style attributes without quotes ([#344](https://github.com/sveltejs/prettier-plugin-svelte/issues/344))
19+
820
## 2.9.0
921

1022
- (feat) support style modifiers ([#330](https://github.com/sveltejs/prettier-plugin-svelte/issues/330))

README.md

+17-1
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@ Install `prettier` and `prettier-plugin-svelte` as dev dependencies in your proj
2929

3030
Then format your code using Prettier CLI. You may need to add `--plugin-search-dir=.`
3131

32+
As a one-time run:
3233
```
33-
prettier --write --plugin-search-dir=. ./**/*.html
34+
npx prettier --write --plugin-search-dir=. ./**/*.html
35+
```
36+
37+
As part of your scripts in `package.json`:
38+
```
39+
"format": "prettier --write --plugin-search-dir=. ./**/*.html"
3440
```
3541

3642
If you want to customize some formatting behavior, see section "Options" below.
@@ -167,6 +173,16 @@ There is a [Tailwind Prettier Plugin](https://github.com/tailwindlabs/prettier-p
167173

168174
More info: https://github.com/tailwindlabs/prettier-plugin-tailwindcss#compatibility-with-other-prettier-plugins
169175

176+
Since we are using configuration overrides to handle svelte files, you might also have to configure the [prettier.documentselectors](https://github.com/prettier/prettier-vscode#prettierdocumentselectors) in your VS Code `settings.json`, to tell Prettier extension to handle svelte files, file like this:
177+
178+
```json5
179+
// settings.json
180+
{
181+
// ..
182+
"prettier.documentSelectors": ["**/*.svelte"],
183+
}
184+
```
185+
170186
## FAQ
171187

172188
### Why is the closing or opening tag (`>` or `<`) hugging the inner tag or text?

0 commit comments

Comments
 (0)