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

39 lines
667 B
Bash
Raw Permalink Normal View History

2021-01-03 10:59:19 -07:00
#!/usr/bin/env bash
2021-01-03 23:21:40 -07:00
UI_DIR="$(pwd)/hyperglass/ui"
check_typescript () {
cd $UI_DIR
2021-01-03 23:50:23 -07:00
node_modules/.bin/tsc --noEmit
2021-01-03 23:21:40 -07:00
}
check_eslint () {
cd $UI_DIR
2021-01-10 01:13:30 -07:00
node_modules/.bin/eslint . --ext .ts --ext .tsx
2021-01-03 23:21:40 -07:00
}
check_prettier () {
cd $UI_DIR
2021-01-10 01:13:30 -07:00
node_modules/.bin/prettier -c .
2021-01-03 23:21:40 -07:00
}
for arg in "$@"
do
if [ "$arg" == "--typescript" ]
then
check_typescript
2021-01-04 00:18:23 -07:00
exit $?
2021-01-03 23:24:48 -07:00
elif [ "$arg" == "--eslint" ]
then
2021-01-03 23:21:40 -07:00
check_eslint
2021-01-04 00:18:23 -07:00
exit $?
2021-01-03 23:24:48 -07:00
elif [ "$arg" == "--prettier" ]
then
2021-01-03 23:21:40 -07:00
check_prettier
2021-01-04 00:18:23 -07:00
exit $?
2021-01-03 23:24:48 -07:00
else
echo "Arguments --typescript, --eslint, or --prettier required."
exit 1
2021-01-03 23:21:40 -07:00
fi
done