Skip to content

Commit 795e932

Browse files
authored
Fix husky pre-commit & type check only staged (#1361)
* Fix husky pre-commit on some Windows clients typicode/husky#1072 (comment) * Limit commit type check to staged files Adds tsc-files package (dev only) and its config * Remove deprecated git add from lint-staged
1 parent 8dddffe commit 795e932

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

.husky/pre-commit

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
npx lint-staged
2-
npm run typecheck
1+
if [[ "$OS" == "Windows_NT" ]]; then
2+
npx.cmd lint-staged
3+
else
4+
npx lint-staged
5+
fi

package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"tailwindcss": "^3.4.4",
5454
"ts-jest": "^29.1.4",
5555
"ts-node": "^10.9.2",
56+
"tsc-files": "^1.1.4",
5657
"tsx": "^4.15.6",
5758
"typescript": "^5.4.5",
5859
"typescript-eslint": "^8.0.0",
@@ -83,9 +84,7 @@
8384
"zod-validation-error": "^3.3.0"
8485
},
8586
"lint-staged": {
86-
"./**/*.{js,ts,tsx,vue}": [
87-
"prettier --write",
88-
"git add"
89-
]
87+
"./**/*.{js,ts,tsx,vue}": "prettier --write",
88+
"**/*.ts": "tsc-files --noEmit"
9089
}
9190
}

0 commit comments

Comments
 (0)