File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed
Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change @@ -14,15 +14,20 @@ for pkg in $pkgs; do
1414
1515 echo " [pre-commit] $dir "
1616
17- out=" $( npm --prefix " $dir " run -s lint:fix 2>&1 ) " && { git add -u " $dir " ; continue ; }
18-
19- echo " $out " | grep -qi ' missing script:.*lint:fix' && {
20- out2=" $( npm --prefix " $dir " run -s lint -- --fix 2>&1 ) " && { git add -u " $dir " ; continue ; }
21- echo " $out2 " | grep -qi ' missing script:.*lint' && { echo " [pre-commit] no lint script, skipping" ; continue ; }
22- echo " $out2 " >&2
23- exit 1
24- }
25-
26- echo " $out " >&2
17+ tmp=" $( mktemp) "
18+ if npm --prefix " $dir " run lint:fix 2>&1 | tee " $tmp " ; then
19+ rm -f " $tmp "
20+ git add -u " $dir "
21+ continue
22+ fi
23+
24+ if grep -qi ' missing script:.*lint:fix' " $tmp " ; then
25+ rm -f " $tmp "
26+ npm --prefix " $dir " run lint -- --fix
27+ git add -u " $dir "
28+ continue
29+ fi
30+
31+ rm -f " $tmp "
2732 exit 1
28- done
33+ done
You can’t perform that action at this time.
0 commit comments