Generatore Git hook
Genera script Git hook come pre-commit, pre-push e altri.
Gestore hook
Gestore pacchetti
Fase dell'hook Git
Controlli pre-commit
pre-commit
# Block accidental commit of .env secrets
if git diff --cached --name-only | grep -qE "(^|/)\.env($|\.)" && ! git diff --cached --name-only | grep -qE "\.env\.example$"; then
echo "Error: Refusing to commit .env secret file. Unstage it first." >&2
exit 1
fi
npx --no -- lint-staged
npm run typecheck
Istruzioni di configurazione
npx --no -- husky init # Save script into .husky/pre-commit
Configurazione associata
{
"lint-staged": {
"*.{ts,tsx,js,jsx}": [
"eslint --fix",
"prettier --write"
],
"*.{json,md,css}": [
"prettier --write"
]
}
}