2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-23 18:38:05 +00:00
the-guard-bot/scripts/pre-commit.sh

12 lines
387 B
Bash
Raw Normal View History

2018-04-15 14:31:14 +02:00
#!/bin/bash
for file in $(git diff --cached --name-only --diff-filter=ACM "*.js")
do
# we only want to lint the staged changes, not any unstaged changes
git show ":$file" | node_modules/.bin/eslint --stdin --stdin-filename "$file"
if [ $? -ne 0 ]; then
echo "ESLint failed on staged file '$file'. Please check your code and try again."
exit 1 # exit with failure status
fi
done