File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -70,3 +70,18 @@ if [ ${#blocked[@]} -gt 0 ]; then
7070 echo " "
7171 exit 1
7272fi
73+
74+ # ── Lint & format staged JS/TS files ────────────────────────────────────────
75+ # Auto-fix lint/format issues on staged files and re-stage them.
76+ # Skips if biome is not available (e.g., agent runtime without devDependencies).
77+
78+ JS_FILES=$( echo " $STAGED " | grep -E ' \.(ts|js|mjs|mts|cjs|cts|jsx|tsx)$' || true)
79+
80+ if [ -n " $JS_FILES " ] && command -v npx & > /dev/null; then
81+ # Check if biome is installed
82+ if npx biome --version & > /dev/null 2>&1 ; then
83+ # shellcheck disable=SC2086
84+ echo " $JS_FILES " | xargs npx biome check --write --no-errors-on-unmatched 2> /dev/null || true
85+ echo " $JS_FILES " | xargs git diff --name-only 2> /dev/null | xargs git add 2> /dev/null || true
86+ fi
87+ fi
You can’t perform that action at this time.
0 commit comments