aboutsummaryrefslogtreecommitdiffstats
path: root/git_hooks/pre-commit
blob: 78876285613c63f2be6d074bce0e2c833a408f87 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0

# Prettify all selected files
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write

# Add back the modified/prettified files to staging
echo "$FILES" | xargs git add

exit 0