Skip to content

Commit 727057b

Browse files
committed
Added prettier, lint-staged and husky.
Run prettier as a pre-commit hook.
1 parent 07d4316 commit 727057b

File tree

5 files changed

+515
-5
lines changed

5 files changed

+515
-5
lines changed

.husky/pre-commit

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn --silent lint-staged -r

.lintstagedrc.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"*.{js,jsx,ts,tsx,json,css,md,html}": "prettier --write"
3+
}

.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.git
2+
node_modules
3+
out

package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,14 +319,21 @@
319319
]
320320
},
321321
"scripts": {
322+
"postinstall": "husky install",
322323
"vscode:prepublish": "npm run compile",
323324
"compile": "tsc -p ./",
324325
"watch": "tsc -watch -p ./"
325326
},
326327
"devDependencies": {
327328
"@types/node": "^16.11.7",
328329
"@types/vscode": "^1.1.59",
330+
"husky": "^8.0.3",
331+
"lint-staged": "^13.2.1",
332+
"prettier": "^2.8.7",
329333
"typescript": "^4.4.4"
330334
},
331-
"dependencies": {}
335+
"dependencies": {},
336+
"prettier": {
337+
"printWidth": 100
338+
}
332339
}

0 commit comments

Comments
 (0)