2
0
mirror of https://github.com/thedevs-network/the-guard-bot synced 2025-08-23 10:28:09 +00:00
the-guard-bot/scripts/pre-commit.sh
2018-04-15 14:31:14 +02:00

12 lines
387 B
Bash
Executable File

#!/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