mirror of
https://github.com/thedevs-network/the-guard-bot
synced 2025-08-23 18:38:05 +00:00
12 lines
387 B
Bash
12 lines
387 B
Bash
|
#!/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
|