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-09-08 01:02:25 -07:00

32 lines
586 B
Bash
Executable File

#!/usr/bin/env bash
UI_DIR="$(pwd)/hyperglass/ui"
check_typescript() {
yarn --cwd $UI_DIR typecheck
}
check_eslint() {
yarn --cwd $UI_DIR lint
}
check_prettier() {
yarn --cwd $UI_DIR prettier -c .
}
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