Skip to content

Commit 0ba0d59

Browse files
authored
build: Setup husky pre commit (#16)
Quickly setting up husky pre commit to make sure things are always pretty.
1 parent cc47465 commit 0ba0d59

File tree

3 files changed

+236
-4
lines changed

3 files changed

+236
-4
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+
npx --no-install lint-staged

package.json

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"description": "",
55
"main": "index.js",
66
"private": true,
7+
"workspaces": [
8+
"packages/*"
9+
],
710
"scripts": {
811
"build": "pnpm -r --filter='./packages/*' run build",
912
"clean": "pnpm -r --filter='./packages/*' clean && rm -rf node_modules",
@@ -13,7 +16,8 @@
1316
"format": "pnpm -r --filter='./packages/*' format && prettier --write '*.{cjs,json}' --ignore-unknown --no-error-on-unmatched-pattern",
1417
"format:check": "pnpm -r --filter='./packages/*' format:check && prettier --check '*.{cjs,json}' --ignore-unknown --no-error-on-unmatched-pattern",
1518
"test:unit": "pnpm -r --filter='./packages/*' run test:unit",
16-
"test:unit:ci": "pnpm -r --filter='./packages/*' run test:unit:ci"
19+
"test:unit:ci": "pnpm -r --filter='./packages/*' run test:unit:ci",
20+
"prepare": "husky install"
1721
},
1822
"keywords": [],
1923
"author": "",
@@ -29,12 +33,16 @@
2933
"eslint-plugin-import": "^2.29.0",
3034
"eslint-plugin-isaacscript": "^3.5.8",
3135
"eslint-plugin-prettier": "^5.0.1",
36+
"husky": "^8.0.0",
37+
"lint-staged": "^15.2.0",
3238
"prettier": "^3.1.0",
3339
"typescript": "^5.3.2"
3440
},
35-
"workspaces": [
36-
"packages/*"
37-
],
41+
"lint-staged": {
42+
"*.{js,jsx,ts,tsx,json,css,scss,md,json}": [
43+
"prettier --write"
44+
]
45+
},
3846
"volta": {
3947
"node": "20.9.0"
4048
},

0 commit comments

Comments
 (0)