14 lines
328 B
Bash
Executable file
14 lines
328 B
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
pattern="\.ts|\.tsx|\.js$"
|
|
files=$(git --no-pager diff --cached --name-only | grep -E -e "${pattern}")
|
|
if [ "$?" = "0" ]; then
|
|
npm run prettier -- ${files} || exit 1
|
|
npm run eslint -- --fix --exit-on-fatal-error ${files} || exit 1
|
|
for f in $files; do
|
|
git add "${f}"
|
|
done
|
|
exit 0
|
|
else
|
|
exit 0
|
|
fi
|