From 807b28cd1e42eb96c2636e1291ca8bfefa0fc903 Mon Sep 17 00:00:00 2001 From: Kian Jones <11655409+kianjones9@users.noreply.github.com> Date: Mon, 23 Mar 2026 15:29:31 -0700 Subject: [PATCH] chore: add pre-commit hooks with lint-staged (#1465) Co-authored-by: cpacker Co-authored-by: Letta Code --- .husky/install.mjs | 8 ++++++++ .husky/pre-commit | 8 ++++++-- package.json | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 .husky/install.mjs diff --git a/.husky/install.mjs b/.husky/install.mjs new file mode 100644 index 0000000..86a98a7 --- /dev/null +++ b/.husky/install.mjs @@ -0,0 +1,8 @@ +if (process.env.NODE_ENV === "production" || process.env.CI === "true") { + process.exit(0); +} + +try { + const husky = (await import("husky")).default; + husky(); +} catch {} diff --git a/.husky/pre-commit b/.husky/pre-commit index 5bbf70e..d5ea074 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,3 +1,7 @@ #!/usr/bin/env sh -# Run the same checks as CI to ensure parity -bun run check + +# Lint staged files only (fast) +bunx lint-staged + +# Typecheck full project (catches type errors in unchanged files) +bun run typecheck diff --git a/package.json b/package.json index 14e7296..e498c56 100644 --- a/package.json +++ b/package.json @@ -64,6 +64,7 @@ "typescript": "^5.0.0" }, "scripts": { + "prepare": "node .husky/install.mjs", "lint": "bunx --bun @biomejs/biome@2.2.5 check src", "fix": "bunx --bun @biomejs/biome@2.2.5 check --write src", "typecheck": "tsc --noEmit",