Files
mattermost-mobile/scripts/pre-commit.sh
Elias Nahum fda4948c8c MM-23848 consolidate store, upgrade mmkv and fix logout (#4145)
* MM-23848 consolidate store, upgrade mmkv and fix logout

* Feedback review

* Add store.ts to modulesPath
2020-04-16 09:02:47 -04:00

31 lines
641 B
Bash

#!/bin/sh
jsfiles=$(git diff --cached --name-only --diff-filter=ACM | grep -E '.js$|.ts$')
if [ -z "jsfiles" ]; then
exit 0
fi
if [ -n "$jsfiles" ]; then
echo "Checking lint for:"
for js in $jsfiles; do
echo "$js"
e=$(node_modules/.bin/eslint --quiet --fix $js)
if [[ -n "$e" ]]; then
echo "ERROR: Check eslint hints."
echo "$e"
exit 1 # reject
fi
done
echo "Checking for TSC"
tsc=$(node_modules/.bin/tsc --noEmit)
if [[ -n "$tsc" ]]; then
echo "ERROR: Check TSC hints."
echo "$tsc"
exit 1 # reject
fi
fi
exit 0