1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
checktheroads-hyperglass/.tests/pre-commit-frontend.sh
2021-01-04 00:18:58 -07:00

39 lines
649 B
Bash
Executable File

#!/usr/bin/env bash
UI_DIR="$(pwd)/hyperglass/ui"
check_typescript () {
cd $UI_DIR
node_modules/.bin/tsc --noEmit
}
check_eslint () {
cd $UI_DIR
node_modules/.bin/eslint .
}
check_prettier () {
cd $UI_DIR
node_modules/.bin/prettier -c -w .
}
for arg in "$@"
do
if [ "$arg" == "--typescript" ]
then
check_typescript
exit $?
elif [ "$arg" == "--eslint" ]
then
check_eslint
exit $?
elif [ "$arg" == "--prettier" ]
then
check_prettier
exit $?
else
echo "Arguments --typescript, --eslint, or --prettier required."
exit 1
fi
done