Skip to content

Commit f9813ff

Browse files
committed
Setup Husky with pre-commit hooks for linting and testing
1 parent 4a5e11f commit f9813ff

3 files changed

Lines changed: 353 additions & 11 deletions

File tree

.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+
pnpm lint-staged

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,15 @@
44
"description": "",
55
"main": "index.js",
66
"scripts": {
7-
"test": "vitest --run"
7+
"test": "vitest --run",
8+
"lint": "eslint . --ext .ts,.tsx",
9+
"prepare": "husky"
10+
},
11+
"lint-staged": {
12+
"*.{ts,tsx}": [
13+
"eslint --fix",
14+
"vitest related --run"
15+
]
816
},
917
"keywords": [],
1018
"author": "Kyle Mathews <mathews.kyle@gmail.com>",
@@ -19,6 +27,8 @@
1927
"eslint-plugin-prettier": "^5.2.3",
2028
"eslint-plugin-react": "^7.37.4",
2129
"fake-indexeddb": "^6.0.0",
30+
"husky": "^9.1.7",
31+
"lint-staged": "^15.4.3",
2232
"prettier": "^3.5.1",
2333
"typescript": "^5.7.3",
2434
"vitest": "^3.0.6"

0 commit comments

Comments
 (0)