Ver Fonte

add pre-commit lint hook and install-hook script

Evan You há 10 anos atrás
pai
commit
d106484aed
2 ficheiros alterados com 10 adições e 0 exclusões
  1. 9 0
      build/git-hooks/pre-commit
  2. 1 0
      package.json

+ 9 - 0
build/git-hooks/pre-commit

@@ -0,0 +1,9 @@
+#!/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

+ 1 - 0
package.json

@@ -18,6 +18,7 @@
   "homepage": "http://vuejs.org",
   "scripts": {
     "test": "grunt ci",
+    "install-hook": "ln -s ../../build/git-hooks/pre-commit .git/hooks/pre-commit",
     "dev": "webpack --watch --config build/webpack.dev.config.js & webpack --watch --config build/webpack.test.config.js"
   },
   "dependencies": {