File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed
Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+ # Generate ESLint warnings and errors breakdown by rule with files listed under each rule
3+ # Output saved to: eslint-warnings-by-rule-frontend.txt and eslint-warnings-by-rule-backend.txt
4+
5+ # Function to process ESLint output and generate breakdown
6+ generate_breakdown () {
7+ local dir=$1
8+ local output_file=$2
9+ local extensions=$3
10+
11+ echo " Processing ${dir} ..."
12+
13+ cd " ${dir} " || exit 1
14+
15+ npx eslint . --ext " ${extensions} " --format=json | \
16+ jq -r ' .[] |
17+ select(.messages | length > 0) |
18+ .filePath as $file |
19+ .messages[] |
20+ "\(.ruleId)|\($file)"' | \
21+ sort | \
22+ awk -F' |' '
23+ BEGIN {
24+ prev=""
25+ prev_file=""
26+ file_count=0
27+ total=0
28+ }
29+ {
30+ if ($1 != prev) {
31+ if (prev != "") {
32+ print " (" total " issues in " file_count " files)\n"
33+ }
34+ print $1 ":"
35+ prev=$1
36+ prev_file=""
37+ file_count=0
38+ total=0
39+ }
40+ if ($2 != prev_file) {
41+ print " " $2
42+ prev_file=$2
43+ file_count++
44+ }
45+ total++
46+ }
47+ END {
48+ if (prev != "") {
49+ print " (" total " issues in " file_count " files)"
50+ }
51+ }' > " ${output_file} "
52+
53+ cd .. || exit 1
54+ }
55+
56+ # Process frontend
57+ generate_breakdown " frontend" " ../eslint-warnings-by-rule-frontend.txt" " .ts,.tsx"
58+
59+ # Process backend
60+ generate_breakdown " backend" " ../eslint-warnings-by-rule-backend.txt" " .ts"
61+
62+ echo " "
63+ echo " ✅ ESLint breakdowns generated:"
64+ echo " - eslint-warnings-by-rule-frontend.txt"
65+ echo " - eslint-warnings-by-rule-backend.txt"
You can’t perform that action at this time.
0 commit comments