#!/bin/bash
export JSNAMES='\.(js|ts)$'
export JSNAMES=$(git diff --cached --name-only --diff-filter=ACM | grep -E $JSNAMES)
function exit_err() { echo "❌ ????" ; exit 1; }
if [[ ! -z $JSNAMES ]]
then
echo "Examining $JSNAMES"
echo $JSNAMES | xargs npm run format || exit_err
npm run lint || exit_err
echo $JSNAMES | xargs git add
else
echo "nothing to do ????"
exit 0
fi
echo "✅ ????"
pre-commit hook for nodejs projects in Typescript and Javascript.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.