blob: 210e349fe641cd2772c86fe882964a84d6427983 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
#!/bin/sh
jsfiles=$(git diff --cached --name-only --diff-filter=ACM "*.js" | 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
exit 0
|