condividi-link-fediverso-fi.../.githooks/pre-commit/prettier.sh

15 lines
341 B
Bash
Raw Normal View History

2021-08-18 06:57:59 +02:00
#!/bin/bash
CHANGED_FILES=$(git diff --cached --name-only --diff-filter=ACMR "*.js" "*.jsx" "*.ts" "*.tsx" | sed 's| |\\ |g')
[[ -z "$CHANGED_FILES" ]] && exit 0
echo "Running prettier 🚀🚀"
echo "$CHANGED_FILES" | xargs ./node_modules/.bin/prettier --write
echo "$CHANGED_FILES" | xargs git add
echo "Done prettier ✨✨"
exit 0