Skip to content

Commit 8abeb0f

Browse files
authored
(chore) prettier --check (#768)
- add prettier --check - Formatting everything Note: If you use windows you might get a warning checking the first time. That's because git may do lf/crlf normalization. Just stage the files and they should magically disappear (because git recognizes that it's only lf/crlf differences)
1 parent 73707aa commit 8abeb0f

File tree

50 files changed

+900
-952
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+900
-952
lines changed

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,8 @@ packages/svelte2tsx/test/*/samples/*/*sx
33
packages/svelte2tsx/test/*/samples/*/*.svelte
44
packages/svelte2tsx/test/sourcemaps/*.html
55
packages/language-server/test/**/*.svelte
6+
packages/language-server/test/**/testfiles/**/*.ts
67
packages/svelte-vscode/syntaxes/*.yaml
8+
**/dist
79
.github/**
10+
.history/**

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"typescript.preferences.quoteStyle": "single",
2+
"typescript.preferences.quoteStyle": "single"
33
}

README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ A `.svelte` file would look something like this:
3333
}
3434
</script>
3535

36-
<button on:click="{handleClick}">
37-
Count: {count}
38-
</button>
36+
<button on:click="{handleClick}">Count: {count}</button>
3937

4038
<p>{count} * 2 = {doubled}</p>
4139
<p>{doubled} * 2 = {quadrupled}</p>
@@ -128,7 +126,7 @@ For tricker issues, you can run the tests with a debugger in VSCode by setting a
128126

129127
Svelte is an MIT-licensed open source project with its ongoing development made possible entirely by the support of awesome volunteers. If you'd like to support their efforts, please consider:
130128

131-
- [Becoming a backer on Open Collective](https://opencollective.com/svelte).
129+
- [Becoming a backer on Open Collective](https://opencollective.com/svelte).
132130

133131
Funds donated via Open Collective will be used for compensating expenses related to Svelte's development such as hosting costs. If sufficient donations are received, funds may also be used to support Svelte's development more directly.
134132

docs/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ LSP-compatible editors, you can use an HTML comment with the `@component` tag:
3939
<!-- @component But only the last documentation comment will be used -->
4040

4141
<main>
42-
<h1>
43-
Hello world
44-
</h1>
42+
<h1>Hello world</h1>
4543
</main>
4644
```
4745

@@ -66,7 +64,7 @@ The VS Code extension comes with its own syntax highlighting grammar which defin
6664
}
6765
```
6866

69-
To find out the scope of the things you want to highlight differently, you can use the scope inspector by entering the command "Developer: Inspect Editor Tokens and Scopes". The scope at the top of the section "textmate scopes" is what you are looking for. The current color is in the section "foreground" - you can use this to look up colors of other scopes if you want them to be the same color but don't know the color-code.
67+
To find out the scope of the things you want to highlight differently, you can use the scope inspector by entering the command "Developer: Inspect Editor Tokens and Scopes". The scope at the top of the section "textmate scopes" is what you are looking for. The current color is in the section "foreground" - you can use this to look up colors of other scopes if you want them to be the same color but don't know the color-code.
7068

7169
For more info on customizing your theme, [see the VS Code docs](https://code.visualstudio.com/docs/getstarted/themes#_customizing-a-color-theme).
7270

@@ -95,8 +93,9 @@ If you have the `Babel Javascript` plugin installed, this may be the cause. Disa
9593
#### My Code does not get formatted
9694

9795
Your default formatter for Svelte files may be wrong.
98-
- Mabye it's set to the old Svelte extension, if so, remove the setting
99-
- Maybe you set all files to be formatted by the prettier extension. Then you have two options: Either install `prettier-plugin-svelte` from npm, or tell VSCode to format the code with the `Svelte for VSCode extension`:
96+
97+
- Mabye it's set to the old Svelte extension, if so, remove the setting
98+
- Maybe you set all files to be formatted by the prettier extension. Then you have two options: Either install `prettier-plugin-svelte` from npm, or tell VSCode to format the code with the `Svelte for VSCode extension`:
10099

101100
```json
102101
"[svelte]": {

docs/internal/deployment.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
The [publisher is Svelte](https://marketplace.visualstudio.com/manage/publishers/svelte)
44

5-
- Extension builds with the account signed up via GitHub from orta
5+
- Extension builds with the account signed up via GitHub from orta
66

77
### npm deployments
88

9-
- Deployments come from a bot: `svelte-language-tools-deploy`
9+
- Deployments come from a bot: `svelte-language-tools-deploy`
1010

1111
### When Deployments happen
1212

13-
- Nightly builds are triggered through a scheduled GitHub workflow every night at 04:00 UTC.
14-
- Production builds are triggered by creating a new tag, which is best done through the "do a release" on Github. The tag name equals the version that is then shown on the marketplace, so each tag should have a higher version than the previous.
13+
- Nightly builds are triggered through a scheduled GitHub workflow every night at 04:00 UTC.
14+
- Production builds are triggered by creating a new tag, which is best done through the "do a release" on Github. The tag name equals the version that is then shown on the marketplace, so each tag should have a higher version than the previous.

docs/internal/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ We chose the second option because TypeScript provides a language service which
5252

5353
`svelte2tsx` uses some [ambient definitions](/packages/svelte2tsx/svelte-shims.d.ts) which are loaded by the language server to do some of the transformations. It also provides [JSX definitions](/packages/svelte2tsx/svelte-jsx.d.ts) which are recognized by the TypeScript compiler and define intrinsic elements, attributes and events - so if you ever get an error that a DOM attribute is not assignable to a DOM element, it's likely a missing declaration in there.
5454

55-
The code generated by `svelte2tsx` is not runnable in any way and does not actually exist at runtime when you run your app, it purely exists for the IntelliSense.
55+
The code generated by `svelte2tsx` is not runnable in any way and does not actually exist at runtime when you run your app, it purely exists for the IntelliSense.
5656

5757
The code also returns source mappings so we know which position in the original code corresponds to which generated position.
5858

docs/preprocessors/in-general.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
If a svelte file contains some language other than `html`, `css` or `javascript`, `svelte-vscode` needs to know how to [preprocess](https://svelte.dev/docs#svelte_preprocess) it. This can be achieved by creating a `svelte.config.js` file at the root of your project which exports a svelte options object (similar to `svelte-loader` and `rollup-plugin-svelte`). It's recommended to use the official [svelte-preprocess](https://github.com/sveltejs/svelte-preprocess) package which can handle many languages.
66

7-
> NOTE: you __cannot__ use the new `import x from y` and `export const` / `export default` syntax in `svelte.config.js`.
7+
> NOTE: you **cannot** use the new `import x from y` and `export const` / `export default` syntax in `svelte.config.js`.
88
99
```js
1010
// svelte.config.js
1111
const sveltePreprocess = require('svelte-preprocess');
1212

1313
module.exports = {
14-
preprocess: sveltePreprocess(),
14+
preprocess: sveltePreprocess()
1515
};
1616
```
1717

@@ -46,9 +46,9 @@ const sveltePreprocess = require('svelte-preprocess');
4646
module.exports = {
4747
preprocess: sveltePreprocess({
4848
defaults: {
49-
script: 'typescript', // <-- now you can just write <script>let typingsAllowed: string;</script>
50-
},
51-
}),
49+
script: 'typescript' // <-- now you can just write <script>let typingsAllowed: string;</script>
50+
}
51+
})
5252
};
5353
```
5454

@@ -63,14 +63,14 @@ const sveltePreprocess = require('svelte-preprocess');
6363
// using sourceMap as an example, but could be anything you need dynamically
6464
function createPreprocessors(sourceMap) {
6565
return sveltePreprocess({
66-
sourceMap,
66+
sourceMap
6767
// ... your settings
6868
});
6969
}
7070

7171
module.exports = {
7272
preprocess: createPreprocessors(true),
73-
createPreprocessors,
73+
createPreprocessors
7474
};
7575
```
7676

@@ -88,10 +88,10 @@ export default {
8888
// ...
8989
svelte({
9090
// ...
91-
preprocess: createPreprocessors(!production),
92-
}),
91+
preprocess: createPreprocessors(!production)
92+
})
9393
// ...
94-
],
94+
]
9595
};
9696
```
9797

docs/preprocessors/scss-less.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ You need a `svelte.config.js`. [Read here on how to set it up and also how it re
2727
const sveltePreprocess = require('svelte-preprocess');
2828

2929
module.exports = {
30-
preprocess: sveltePreprocess(),
30+
preprocess: sveltePreprocess()
3131
};
3232
```
3333

@@ -76,6 +76,6 @@ const sveltePreprocess = require('svelte-preprocess');
7676
const path = require('path');
7777

7878
module.exports = {
79-
preprocess: sveltePreprocess({ includePaths: [path.join(__dirname, 'relative/path')] })
79+
preprocess: sveltePreprocess({ includePaths: [path.join(__dirname, 'relative/path')] })
8080
};
8181
```

docs/preprocessors/typescript.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ You may optionally want to add a `svelte.config.js` file - but it is not require
3232
const sveltePreprocess = require('svelte-preprocess');
3333

3434
module.exports = {
35-
preprocess: sveltePreprocess(),
35+
preprocess: sveltePreprocess()
3636
};
3737
```
3838

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
"build": "tsc -b",
1313
"test": "CI=true yarn workspaces run test",
1414
"watch": "tsc -b -watch",
15-
"lint": "eslint \"packages/**/*.{ts,js}\""
15+
"format": "prettier --write .",
16+
"lint": "prettier --check . && eslint \"packages/**/*.{ts,js}\""
1617
},
1718
"dependencies": {
18-
"axios": "0.21.1",
1919
"typescript": "^4.1.3"
2020
},
2121
"devDependencies": {
@@ -24,6 +24,7 @@
2424
"@typescript-eslint/parser": "^4.3.0",
2525
"eslint": "^7.7.0",
2626
"eslint-plugin-import": "^2.22.1",
27-
"eslint-plugin-svelte3": "^2.7.3"
27+
"eslint-plugin-svelte3": "^2.7.3",
28+
"prettier": "2.2.1"
2829
}
2930
}

0 commit comments

Comments
 (0)