From d9903459578dd1ef84ac9b365bb5c5814b44b281 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Wed, 30 Oct 2024 04:04:48 +1100 Subject: [PATCH 1/3] Fix husky pre-commit on some Windows clients https://github.com/typicode/husky/issues/1072#issuecomment-1784006332 --- .husky/pre-commit | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index f3f510d2..5af23fe8 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,2 +1,7 @@ -npx lint-staged -npm run typecheck +if [[ "$OS" == "Windows_NT" ]]; then + npx.cmd lint-staged + npm.cmd run typecheck +else + npx lint-staged + npm run typecheck +fi From c76d535f1266d038878bdf2a96297a26c8ee9f35 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Wed, 30 Oct 2024 04:09:39 +1100 Subject: [PATCH 2/3] Limit commit type check to staged files Adds tsc-files package (dev only) and its config --- .husky/pre-commit | 2 -- package-lock.json | 14 ++++++++++++++ package.json | 4 +++- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index 5af23fe8..a19f49ff 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,7 +1,5 @@ if [[ "$OS" == "Windows_NT" ]]; then npx.cmd lint-staged - npm.cmd run typecheck else npx lint-staged - npm run typecheck fi diff --git a/package-lock.json b/package-lock.json index c5aedfbf..711afbe4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,6 +58,7 @@ "tailwindcss": "^3.4.4", "ts-jest": "^29.1.4", "ts-node": "^10.9.2", + "tsc-files": "^1.1.4", "tsx": "^4.15.6", "typescript": "^5.4.5", "typescript-eslint": "^8.0.0", @@ -12105,6 +12106,19 @@ } } }, + "node_modules/tsc-files": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/tsc-files/-/tsc-files-1.1.4.tgz", + "integrity": "sha512-RePsRsOLru3BPpnf237y1Xe1oCGta8rmSYzM76kYo5tLGsv5R2r3s64yapYorGTPuuLyfS9NVbh9ydzmvNie2w==", + "dev": true, + "license": "MIT", + "bin": { + "tsc-files": "cli.js" + }, + "peerDependencies": { + "typescript": ">=3" + } + }, "node_modules/tsconfig": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-7.0.0.tgz", diff --git a/package.json b/package.json index c57885dd..565e3744 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,7 @@ "tailwindcss": "^3.4.4", "ts-jest": "^29.1.4", "ts-node": "^10.9.2", + "tsc-files": "^1.1.4", "tsx": "^4.15.6", "typescript": "^5.4.5", "typescript-eslint": "^8.0.0", @@ -86,6 +87,7 @@ "./**/*.{js,ts,tsx,vue}": [ "prettier --write", "git add" - ] + ], + "**/*.ts": "tsc-files --noEmit" } } From 333205d3942cd656b9bdf072ec64e885048adbb8 Mon Sep 17 00:00:00 2001 From: filtered <176114999+webfiltered@users.noreply.github.com> Date: Wed, 30 Oct 2024 04:10:16 +1100 Subject: [PATCH 3/3] Remove deprecated git add from lint-staged --- package.json | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/package.json b/package.json index 565e3744..2d93ac92 100644 --- a/package.json +++ b/package.json @@ -84,10 +84,7 @@ "zod-validation-error": "^3.3.0" }, "lint-staged": { - "./**/*.{js,ts,tsx,vue}": [ - "prettier --write", - "git add" - ], + "./**/*.{js,ts,tsx,vue}": "prettier --write", "**/*.ts": "tsc-files --noEmit" } }