tridactyl/hooks/pre-commit

26 lines
589 B
Text
Raw Normal View History

2018-08-24 13:38:05 -06:00
#!/usr/bin/env bash
2018-03-06 22:03:44 +01:00
2019-05-29 17:48:32 +01:00
source ./scripts/common.sh
jsfiles=$(cachedTSLintFiles)
otherfiles=$(cachedPrettierFiles)
# Check if any of the files are ugly or contain a console.log call
consoleFiles=$(noisy $jsfiles)
uglyFiles="$(tslintUgly $jsfiles)"
if [ ! -n "$uglyFiles" ]; then
uglyFiles="$(prettierUgly $otherfiles)"
fi
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