al-quran.reflectslight.io/.husky/pre-commit

13 lines
301 B
Text
Raw Normal View History

2023-07-16 09:27:56 +02:00
#!/usr/bin/env sh
2023-10-30 00:01:32 +01:00
pattern="\.ts|\.tsx|\.js$"
2023-10-28 15:59:18 +02:00
files=$(git --no-pager diff --cached --name-only | grep -E -e "${pattern}")
if [ "$?" = "0" ]; then
2023-10-30 00:01:32 +01:00
npm run prettier -- ${files} || exit 1
npm run eslint -- --fix --exit-on-fatal-error ${files} || exit 1
2023-10-28 15:59:18 +02:00
git add "${files}"
exit 0
else
exit 0
fi