blob: 99fc09bd7922f10bfb3e92c81ee1762cf66ff5cb [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
simon4e7445c2022-11-16 21:18:46 -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
24 echo "Checking for EsLint errors..."
25 npm run lint --workspaces -- --quiet
26fi
27
28echo "Checking for Prettier problems..."
29confirm "npm run format:check --workspaces"