Skip to content

Instantly share code, notes, and snippets.

@yyx990803
Last active October 22, 2018 20:52
Show Gist options
  • Save yyx990803/1a0aa30ff5ffc7fca74f to your computer and use it in GitHub Desktop.
Save yyx990803/1a0aa30ff5ffc7fca74f to your computer and use it in GitHub Desktop.
pre-commit hook for Vue.js
#!/usr/bin/env bash
# get files to be linted
FILES=$(git diff --cached --name-only | grep -E '^src|^test/unit/specs|^test/e2e')
# lint them if any
if [[ $FILES ]]; then
./node_modules/.bin/eslint $FILES
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment