tridactyl/hooks/pre-commit

24 lines
478 B
Text
Raw Normal View History

#!/bin/bash
2018-03-06 22:03:44 +01:00
source ./scripts/common
jsfiles=$(cachedJS)
[ -z "$jsfiles" ] && exit 0
# Check if any of the files are ugly or contain a console.log call
consoleFiles=$(noisy $jsfiles)
uglyFiles=$(ugly $jsfiles)
if [ -n "$consoleFiles" ]; then
echo "Warning: adding console.log calls in ${consoleFiles[@]}"
echo 'Did you mean to use logger.debug?'
echo
fi
if [ -n "$uglyFiles" ]; then
echo "Prettify your files first:"
2018-05-25 09:24:46 +01:00
echo 'npm run pretty'
exit 1
fi