Skip to content

Commit 32eabce

Browse files
committed
fix: guard process.argv[1] for strict index access
Add tsc --noEmit to hk pre-commit so type errors are caught locally.
1 parent 5ae0cd7 commit 32eabce

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

cli.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ export default defineConfig({
344344
}
345345
}
346346

347-
if (import.meta.filename === realpathSync(process.argv[1])) {
347+
const entryScript = process.argv[1]
348+
if (entryScript && import.meta.filename === realpathSync(entryScript)) {
348349
main().catch((err: unknown) => {
349350
console.error(err)
350351
process.exit(1)

hk.pkl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ hooks {
1616
check = "pnpm exec oxlint --import-plugin --promise-plugin {{files}}"
1717
}
1818
["typos"] = (Builtins.typos)
19+
["tsc"] {
20+
check = "pnpm exec tsc --noEmit"
21+
}
1922
}
2023
}
2124
["commit-msg"] {

0 commit comments

Comments
 (0)