Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@
# por causa dos 1620 arquivos do app. Isso atrapalha DX em pushes frequentes.
# O CI já roda o typecheck completo em todo PR — não precisa duplicar localmente.

# ─────────────────────────────────────────────────────────────────
# Skip on delete-only push (git push origin :branch / git push --delete)
# ─────────────────────────────────────────────────────────────────
# Git invoca pre-push passando refs via stdin no formato:
# <local_ref> <local_sha> <remote_ref> <remote_sha>
# Pra um delete, local_ref="(delete)" e local_sha é todo zeros.
# Se TODAS as refs sendo enviadas são deletes, não há código a checar.
ZERO="0000000000000000000000000000000000000000"
HAS_NON_DELETE=0
while read -r local_ref local_sha remote_ref remote_sha; do
if [ "$local_sha" != "$ZERO" ]; then
HAS_NON_DELETE=1
break
fi
done

if [ "$HAS_NON_DELETE" = "0" ]; then
echo "✓ pre-push: somente deletes — pulando validação"
exit 0
fi

# ─────────────────────────────────────────────────────────────────
# Modo normal
# ─────────────────────────────────────────────────────────────────
if [ "${HUSKY_FULL:-0}" = "1" ]; then
npm run typecheck && npm run lint:baseline
else
Expand Down
Loading