1
1
#! /bin/bash
2
2
3
- shopt -s globstar
4
-
5
3
PROJECT_DIR=" /project"
6
4
7
5
# First arg
@@ -13,6 +11,9 @@ TYPESCRIPT=$(echo $ARGS | jq -r '.typescript')
13
11
# Get boolean value of fix
14
12
FIX=$( echo $ARGS | jq -r ' .fix' )
15
13
14
+ # How verbose to output the linting results
15
+ OUTPUT_LEVEL=$( echo $ARGS | jq -r ' .outputLevel' )
16
+
16
17
# If files key is not present, just use glob
17
18
18
19
if [ $( echo $ARGS | jq -r ' .files' ) == ' null' ]; then
@@ -32,7 +33,21 @@ if [ $TYPESCRIPT == 'false' ]; then
32
33
LINT_ARGS=" --fix $FILES "
33
34
fi
34
35
# Pass files array as args to standard
35
- standard $LINT_ARGS | standard-json | /remap_lint.sh
36
+ OUTPUT=$( standard $LINT_ARGS | standard-json)
37
+
38
+ if [ $OUTPUT_LEVEL == " 0" ]; then
39
+ echo " Linting with StandardJS complete."
40
+ fi
41
+
42
+ if [ $OUTPUT_LEVEL == " 1" ]; then
43
+ echo " Linting with StandardJS complete. Outputting condensed JSON."
44
+ echo $OUTPUT | /remap_lint.sh
45
+ fi
46
+
47
+ if [ $OUTPUT_LEVEL == " 2" ]; then
48
+ echo " Linting with StandardJS complete. Outputting JSON."
49
+ echo $OUTPUT
50
+ fi
36
51
fi
37
52
38
53
echo " Running ts-standard..."
@@ -70,14 +85,29 @@ for TS_ROOT in $TS_ROOTS; do
70
85
LINT_ARGS=" $TS_FILES_IN_ROOT "
71
86
fi
72
87
73
- TS_OUTPUT+=$( ts-standard $LINT_ARGS | standard-json | /remap_lint.sh )
88
+ TS_OUTPUT+=$( ts-standard $LINT_ARGS | standard-json)
74
89
# If ts-standard failed and EXIT_CODE is 0, set EXIT_CODE
75
90
if [ $? -ne 0 ] && [ $EXIT_CODE -eq 0 ]; then
76
91
EXIT_CODE=$?
77
92
fi
78
93
cd $PROJECT_DIR
79
94
done
80
95
96
+
97
+ if [ $OUTPUT_LEVEL == " 0" ]; then
98
+ echo " Linting with StandardJS (TS) complete."
99
+ fi
100
+
101
+ if [ $OUTPUT_LEVEL == " 1" ]; then
102
+ echo " Linting with StandardJS (TS) complete. Outputting condensed JSON."
103
+ echo $TS_OUTPUT | /remap_lint.sh
104
+ fi
105
+
106
+ if [ $OUTPUT_LEVEL == " 2" ]; then
107
+ echo " Linting with StandardJS (TS) complete. Outputting JSON."
108
+ echo $TS_OUTPUT
109
+ fi
110
+
81
111
echo $TS_OUTPUT
82
112
83
113
exit $EXIT_CODE
0 commit comments