Skip to content

Commit a5957b9

Browse files
committed
(GH-643) Add and configure prettier
This commit - Adds `prettier` to devDependencies - Configures `prettier` with `.prettierrc` with default format rules - Removes `prettier` settings from .vscode/settings.json - Adds `esbenp.prettier-vscode` to recommended extensions and sets it to default formatter - COnfigures VS Code to format on type and save using `prettier`
1 parent 0e80700 commit a5957b9

File tree

5 files changed

+28
-5
lines changed

5 files changed

+28
-5
lines changed

.prettierignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
languages
2+
snippets
3+
syntaxes
4+
out
5+
vendor
6+
package-lock.json

.prettierrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 2,
4+
"endOfLine": "lf",
5+
"printWidth": 120,
6+
"useTabs": false,
7+
"trailingComma": "all",
8+
"semi": true,
9+
}

.vscode/extensions.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"recommendations": [
33
"eamodio.gitlens",
4+
"esbenp.prettier-vscode",
45
"ms-vscode.vscode-typescript-tslint-plugin",
56
"wwm.better-align",
67
"rebornix.Ruby"

.vscode/settings.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"editor.insertSpaces": true,
44
"editor.tabSize": 2,
55
"editor.trimAutoWhitespace": true,
6-
6+
77
"files.encoding": "utf8",
88
// The default end of line character. Use \n for LF and \r\n for CRLF.
99
"files.eol": "\n",
@@ -19,11 +19,17 @@
1919
"node_modules": true,
2020
"out": true // set this to false to include "out" folder in search results
2121
},
22-
22+
2323
"prettier.printWidth": 120,
2424
"prettier.singleQuote": true,
2525
"prettier.tabWidth": 2,
2626

2727
// Turn off tsc task auto detection since we have the necessary tasks as npm scripts
28-
"typescript.tsc.autoDetect": "off"
29-
}
28+
"typescript.tsc.autoDetect": "off",
29+
"typescript.format.enable": false,
30+
"[typescript]": {
31+
"editor.formatOnSave": true,
32+
"editor.formatOnType": true,
33+
"editor.defaultFormatter": "esbenp.prettier-vscode"
34+
},
35+
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,8 @@
551551
"build": "pwsh -file ./build.ps1",
552552
"watch": "npm run build && tsc -watch -p ./",
553553
"pretest": "npm run compile",
554-
"test": "node ./out/test/runtest.js"
554+
"test": "node ./out/test/runtest.js",
555+
"format": "prettier --write '**/**/*.{ts,js,json}'"
555556
},
556557
"devDependencies": {
557558
"@types/glob": "^7.1.1",

0 commit comments

Comments
 (0)