Skip to content

Instantly share code, notes, and snippets.

@janurag
Last active March 17, 2017 12:40
Show Gist options
  • Save janurag/9cc62ae6817ab84e7a9b81e193441f74 to your computer and use it in GitHub Desktop.
Save janurag/9cc62ae6817ab84e7a9b81e193441f74 to your computer and use it in GitHub Desktop.
Pre commit Testing and Standardization of Javascript code
#!/bin/sh
# Description: Written while working in Macbook
# color for bash
RED='\033[0;31m'
NC='\033[0m' # No Color
echo "Wait.... I am Testing Your code!"
# for Testing
pwd && ls
# checking eslint status
eslintStatus=0
./node_modules/eslint/bin/eslint.js . || eslintStatus=$?
if [ $eslintStatus -ne 0 ]; then
echo "${RED}ERROR:: PLEASE RESOLVE THE ABOVE ERROR AND THEN COMMIT ${NC}"
exit 1
fi
# For Testing
# echo "eslintStatus: "
# echo $eslintStatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment