blob: 0a14d55eb2017d13be7f30723637dc004c581652 [file] [log] [blame]
simon7a7b4d52022-09-23 02:09:42 -04001#!/usr/bin/env sh
simon7a7b4d52022-09-23 02:09:42 -04002
simon718f76c2022-11-07 20:55:01 -05003confirm () {
4 if ! eval "$@" ; then
simon4e7445c2022-11-16 21:18:46 -05005 printf "Found some problems in the code. Do you still want to push? [y/N] "
simon718f76c2022-11-07 20:55:01 -05006 read -r REPLY
7
8 if [ "$REPLY" = "${REPLY#[Yy]}" ]
9 then
10 echo "Cancelling push..."
11 exit 1
simon4e7445c2022-11-16 21:18:46 -050012 else
13 return 1
simon718f76c2022-11-07 20:55:01 -050014 fi
15 else
16 echo "OK!"
17 fi
18}
19
Misha Krieger-Raynauld173fbba2022-11-16 14:10:38 -050020echo "Checking for ESLint errors and warnings..."
simon718f76c2022-11-07 20:55:01 -050021confirm "npm run lint --workspaces -- --max-warnings 0"
simon4e7445c2022-11-16 21:18:46 -050022
23if [ $? -eq 1 ]; then
Misha Krieger-Raynauld173fbba2022-11-16 14:10:38 -050024 echo "Checking for ESLint errors..."
simon4e7445c2022-11-16 21:18:46 -050025 npm run lint --workspaces -- --quiet
26fi
27
28echo "Checking for Prettier problems..."
29confirm "npm run format:check --workspaces"