From 138a16ae0cf8cc0a5841501f77dbd6a7eae99ff2 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Fri, 14 Feb 2025 10:44:56 +0700 Subject: [PATCH] Formt-show Signed-off-by: Andrey Sobolev --- common/config/rush/command-line.json | 10 +++++++++- common/scripts/format-show.sh | 19 +++++++++++++++++++ rush.json | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100755 common/scripts/format-show.sh diff --git a/common/config/rush/command-line.json b/common/config/rush/command-line.json index d55257f6032..ab4189fe12a 100644 --- a/common/config/rush/command-line.json +++ b/common/config/rush/command-line.json @@ -103,7 +103,15 @@ "ignoreMissingScript": true, "safeForSimultaneousRushProcesses": true, "disableBuildCache": true - }, + }, + { + "commandKind": "global", + "name": "doformat", + "summary": "Do a format and show errors after it", + "description": "Do a format and show errors after it", + "safeForSimultaneousRushProcesses": true, + "shellCommand": "rush format && ./common/scripts/format-show.sh" + }, { "commandKind": "phased", "name": "build:watch", diff --git a/common/scripts/format-show.sh b/common/scripts/format-show.sh new file mode 100755 index 00000000000..57d92054b38 --- /dev/null +++ b/common/scripts/format-show.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +roots=$(rush list -p --json | grep "path" | cut -f 2 -d ':' | cut -f 2 -d '"') +files="eslint.log prettier.log" +for file in $roots; do + for check in $files; do + f="$file/.format/$check" + if [ -f $f ]; then + if grep -q "error" "$f"; then + if ! grep -q "0 errors" "$f"; then + if ! grep -q "error.ts" "$f"; then + echo "Errors in $f" + cat "$f" + fi + fi + fi + fi + done +done \ No newline at end of file diff --git a/rush.json b/rush.json index aab6d707191..6cb6cc6a511 100644 --- a/rush.json +++ b/rush.json @@ -16,7 +16,7 @@ * path segment in the "$schema" field for all your Rush config files. This will ensure * correct error-underlining and tab-completion for editors such as VS Code. */ - "rushVersion": "5.148.0", + "rushVersion": "5.149.0", /** * The next field selects which package manager should be installed and determines its version.