File tree 2 files changed +6
-31
lines changed
2 files changed +6
-31
lines changed Original file line number Diff line number Diff line change 1
- #! /bin/bash
2
- cd " $( git rev-parse --show-toplevel) "
3
- ESLINT=" node_modules/.bin/eslint"
4
- pwd
1
+ #! /bin/sh
2
+ . " $( dirname " $0 " ) /_/husky.sh"
5
3
6
- if [[ ! -x " $ESLINT " ]]; then
7
- printf " \t\033[41mPlease install ESlint\033[0m (npm i --save-dev eslint)\n"
8
- exit 1
9
- fi
10
-
11
- STAGED_FILES=($( git diff --cached --name-only --diff-filter=ACM | grep " \.js$" ) )
12
-
13
- echo " Linting ${# STAGED_FILES[@]} files"
14
-
15
- if [[ " $STAGED_FILES " = " " ]]; then
16
- exit 0
17
- fi
18
-
19
- $ESLINT " ${STAGED_FILES[@]} "
20
-
21
- ESLINT_EXIT=" $? "
22
-
23
- # ESLINT_EXIT=0
24
-
25
- if [[ " ${ESLINT_EXIT} " == 0 ]]; then
26
- printf " \n\033[42mCOMMIT SUCCEEDED\033[0m\n"
27
- else
28
- printf " \n\033[41mCOMMIT FAILED:\033[0m Fix eslint errors and try again\n"
29
- exit 1
30
- fi
31
-
32
- exit $?
4
+ npx lint-staged
Original file line number Diff line number Diff line change
1
+ {
2
+ "*.js" : " eslint --fix"
3
+ }
You can’t perform that action at this time.
0 commit comments