We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb31275 commit b550cccCopy full SHA for b550ccc
.husky/hook-utils.sh
@@ -0,0 +1,10 @@
1
+#!/bin/sh
2
+[ -z "$LOG_PREFIX" ] && LOG_PREFIX="[.husky/???]"
3
+
4
+log() {
5
+ echo "${LOG_PREFIX} $1"
6
+}
7
8
+error() {
9
+ echo >&2 "${LOG_PREFIX} $1"
10
.husky/pre-commit
@@ -1,4 +1,15 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
-npm run lint
+export NODE_ENV=production
+LOG_PREFIX="[.husky/pre-commit]"
+. "$(dirname "$0")/hook-utils.sh"
+log "$> npm run lint"
11
+if ! npm run lint; then
12
+ error "ERROR: Dirty code detected!"
13
+ error "Fix the lint errors before committing to the repository."
14
+ exit -1
15
+fi
0 commit comments