tridactyl/hooks/pre-commit
Colin Caine 5b444f76b7 Be less precise
Replace precise-commits with whole file prettification
2018-04-14 16:59:16 +01:00

10 lines
321 B
Bash
Executable file

#!/bin/sh
jsfiles=$(git diff --cached --name-only --diff-filter=ACM "*.js" "*.jsx" "*.ts" "*.tsx" | tr '\n' ' ')
[ -z "$jsfiles" ] && exit 0
# Prettify all staged .js files
echo "$jsfiles" | xargs ./node_modules/.bin/prettier --write
# Add back the modified/prettified files to staging
echo "$jsfiles" | xargs git add