al-quran.reflectslight.io/.husky/pre-commit
2023-10-29 20:03:16 -03:00

12 lines
301 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
git add "${files}"
exit 0
else
exit 0
fi