Skip to content

Commit

Permalink
Colorized status echo, brightened red error
Browse files Browse the repository at this point in the history
  • Loading branch information
adamlui committed Nov 29, 2024
1 parent c468e13 commit df3504f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
#!/bin/bash

RED="\033[1;31m" ; NC="\033[0m"
# Init UI colors
NC="\033[0m" # no color
BR="\033[1;91m" # bright red
BY="\033[1;33m" # bright yellow

# Run ESLint for JavaScript + JSON + Markdown + YAML
echo -e "\n${BY}Running ESLint...${NC}"
if npm ls -g eslint &> /dev/null || npm ls eslint &> /dev/null ; then
npm run lint
else
PROJECT_ROOT=$(
cd "$(dirname "$0")/.." && # nav to root
[ "$OSTYPE" == "msys" ] && pwd -W || pwd # get absolute path
)
echo -e "\n${RED}Warning: eslint not installed${NC}"
echo -e "\n${BR}Warning: ESLint not installed${NC}"
echo -e " To add missing dependencies, run 'npm install' from"
echo -e " $PROJECT_ROOT\n"
fi

0 comments on commit df3504f

Please sign in to comment.