limit formatOnSave option to JS/TS files, add docs re: prettier
This commit is contained in:
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
@@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"recommendations": ["eg2.tslint", "EditorConfig.EditorConfig", "esbenp.prettier-vscode"]
|
|
||||||
}
|
|
||||||
12
.vscode/settings.json
vendored
12
.vscode/settings.json
vendored
@@ -1,6 +1,5 @@
|
|||||||
{
|
{
|
||||||
"editor.renderWhitespace": "boundary",
|
"editor.renderWhitespace": "boundary",
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"files.encoding": "utf8",
|
"files.encoding": "utf8",
|
||||||
"files.trimTrailingWhitespace": true,
|
"files.trimTrailingWhitespace": true,
|
||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true,
|
||||||
@@ -11,5 +10,14 @@
|
|||||||
"node_modules/**": true,
|
"node_modules/**": true,
|
||||||
"typings/**": true
|
"typings/**": true
|
||||||
},
|
},
|
||||||
"typescript.tsdk": "./node_modules/typescript/lib"
|
"typescript.tsdk": "./node_modules/typescript/lib",
|
||||||
|
"[json]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.formatOnSave": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
docs/in-depth/prettier.md
Normal file
19
docs/in-depth/prettier.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# Prettier
|
||||||
|
|
||||||
|
[Prettier](https://prettier.io/) is an automatic code formatter which supports various languages, including TypeScript. It also has extensions for various text editors like [VSCode](https://github.com/prettier/prettier-vscode), [Atom](https://github.com/prettier/prettier-atom), and even [Vim](https://github.com/prettier/vim-prettier). If you have installed these extensions, it will use Prettier's service to automatically format your code after saving.
|
||||||
|
|
||||||
|
If you would rather not use Prettier instead, you can easily disable it too. In VSCode, open `.vscode/settings.json`, then change the `"editor.formatOnSave"` option to `false`:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"[json]": {
|
||||||
|
"editor.formatOnSave": false
|
||||||
|
},
|
||||||
|
"[javascript]": {
|
||||||
|
"editor.formatOnSave": false
|
||||||
|
},
|
||||||
|
"[typescript]": {
|
||||||
|
"editor.formatOnSave": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
@@ -33,10 +33,10 @@ This project provides TSLint rules through a `tslint.json` file, which extends t
|
|||||||
|
|
||||||
We've made some changes to these rules, which we considered necessary and/or relevant to a proper Screeps project:
|
We've made some changes to these rules, which we considered necessary and/or relevant to a proper Screeps project:
|
||||||
|
|
||||||
- set the [forin](http://palantir.github.io/tslint/rules/forin/) rule to `false`, it was forcing `for ( ... in ...)` loops to check if object members were not coming from the class prototype.
|
* set the [forin](http://palantir.github.io/tslint/rules/forin/) rule to `false`, it was forcing `for ( ... in ...)` loops to check if object members were not coming from the class prototype.
|
||||||
- set the [interface-name](http://palantir.github.io/tslint/rules/interface-name/) rule to `false`, in order to allow interfaces that are not prefixed with `I`.
|
* set the [interface-name](http://palantir.github.io/tslint/rules/interface-name/) rule to `false`, in order to allow interfaces that are not prefixed with `I`.
|
||||||
- set the [no-console](http://palantir.github.io/tslint/rules/no-console/) rule to `false`, in order to allow using `console`.
|
* set the [no-console](http://palantir.github.io/tslint/rules/no-console/) rule to `false`, in order to allow using `console`.
|
||||||
- in the [variable-name](http://palantir.github.io/tslint/rules/variable-name/) rule, added `allow-leading-underscore`.
|
* in the [variable-name](http://palantir.github.io/tslint/rules/variable-name/) rule, added `allow-leading-underscore`.
|
||||||
|
|
||||||
### Customising TSLint
|
### Customising TSLint
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user