-
-
Save apostololeg/e06bafd6072842c50a2789156b1028f3 to your computer and use it in GitHub Desktop.
Shell script to lint only changed files to be used as a githook (specific to my project)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
NM_BIN=./node_modules/.bin | |
echo "Linting changed files" | |
SRC_FILES=$(git diff --staged --diff-filter=ACMTUXB --name-only -- '*.js' | grep -v '\.test\|mock\|e2e\.js$') && x=1 | |
function lint() { | |
if [ "$2" ]; then | |
echo "Linting changed $1 files" | |
$NM_BIN/eslint $2 -c other/${1}.eslintrc | |
else | |
echo "No $1 files changed" | |
fi | |
} | |
lint "app" $SRC_FILES; | |
echo "⚡️ changed files passed linting! ⚡️" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment