Skip to content

Commit dc80285

Browse files
author
Colin McNeil
committed
Count violations
1 parent 7fd9bb3 commit dc80285

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

prompts/eslint/scripts/lint-standardjs.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ else
2323
FILES=$(echo $ARGS | jq -r '.files[]')
2424
fi
2525

26+
TOTAL_VIOLATIONS=0
2627

2728
# If typescript is false, run standard
2829
if [ $TYPESCRIPT == 'false' ]; then
@@ -35,8 +36,11 @@ if [ $TYPESCRIPT == 'false' ]; then
3536
# Pass files array as args to standard
3637
OUTPUT=$(standard $LINT_ARGS | standard-json)
3738

39+
# Count total violations
40+
TOTAL_VIOLATIONS=$(echo $OUTPUT | jq -r '.results[].messages | length')
41+
3842
if [ $OUTPUT_LEVEL == "0" ]; then
39-
echo "Linting with StandardJS complete."
43+
echo "Linting with StandardJS complete. $TOTAL_VIOLATIONS violations found."
4044
fi
4145

4246
if [ $OUTPUT_LEVEL == "1" ]; then
@@ -86,6 +90,9 @@ for TS_ROOT in $TS_ROOTS; do
8690
fi
8791

8892
TS_OUTPUT+=$(ts-standard $LINT_ARGS | standard-json)
93+
94+
# Count total violations
95+
TOTAL_VIOLATIONS=$(echo $TS_OUTPUT | jq -r '.results[].messages | length')
8996
# If ts-standard failed and EXIT_CODE is 0, set EXIT_CODE
9097
if [ $? -ne 0 ] && [ $EXIT_CODE -eq 0 ]; then
9198
EXIT_CODE=$?
@@ -95,7 +102,7 @@ done
95102

96103

97104
if [ $OUTPUT_LEVEL == "0" ]; then
98-
echo "Linting with StandardJS (TS) complete."
105+
echo "Linting with StandardJS (TS) complete. $TOTAL_VIOLATIONS violations found."
99106
fi
100107

101108
if [ $OUTPUT_LEVEL == "1" ]; then

prompts/eslint/scripts/lint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ESLINT_JSON=$(npx --no-install "eslint@$ESLINT_VERSION" --format json "$ESLINT_A
2121

2222
if [ $OUTPUT_LEVEL == "0" ]; then
2323
echo "Linting with ESLint v$ESLINT_VERSION complete."
24+
TOTAL_VIOLATIONS=$(echo $ESLINT_JSON | jq -r '.[].messages | length')
2425
fi
2526

2627
if [ $OUTPUT_LEVEL == "1" ]; then

0 commit comments

Comments
 (0)