Skip to content

Commit 138a16a

Browse files
committed
Formt-show
Signed-off-by: Andrey Sobolev <[email protected]>
1 parent a87147d commit 138a16a

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

common/config/rush/command-line.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,15 @@
103103
"ignoreMissingScript": true,
104104
"safeForSimultaneousRushProcesses": true,
105105
"disableBuildCache": true
106-
},
106+
},
107+
{
108+
"commandKind": "global",
109+
"name": "doformat",
110+
"summary": "Do a format and show errors after it",
111+
"description": "Do a format and show errors after it",
112+
"safeForSimultaneousRushProcesses": true,
113+
"shellCommand": "rush format && ./common/scripts/format-show.sh"
114+
},
107115
{
108116
"commandKind": "phased",
109117
"name": "build:watch",

common/scripts/format-show.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
3+
roots=$(rush list -p --json | grep "path" | cut -f 2 -d ':' | cut -f 2 -d '"')
4+
files="eslint.log prettier.log"
5+
for file in $roots; do
6+
for check in $files; do
7+
f="$file/.format/$check"
8+
if [ -f $f ]; then
9+
if grep -q "error" "$f"; then
10+
if ! grep -q "0 errors" "$f"; then
11+
if ! grep -q "error.ts" "$f"; then
12+
echo "Errors in $f"
13+
cat "$f"
14+
fi
15+
fi
16+
fi
17+
fi
18+
done
19+
done

rush.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* path segment in the "$schema" field for all your Rush config files. This will ensure
1717
* correct error-underlining and tab-completion for editors such as VS Code.
1818
*/
19-
"rushVersion": "5.148.0",
19+
"rushVersion": "5.149.0",
2020

2121
/**
2222
* The next field selects which package manager should be installed and determines its version.

0 commit comments

Comments
 (0)