From cf9d28a097005664f57c8b4727e2876330664d01 Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Thu, 5 Jun 2025 10:14:06 -0700 Subject: [PATCH] RN: Improve `lint-ci` Script (#51853) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51853 While testing D75988059 with D76047973, I noticed a few opportunities to improve the script used by `yarn lint-ci`: - The exit code does not currently propagate, meaning `lint-ci` will succeed when it shouldn't. - The shell script uses some non-idiomatic practices, so this improves it. Changelog: [Internal] Reviewed By: kassens, cipolleschi Differential Revision: D76049502 fbshipit-source-id: ebefddf0909edc89cd97de756b93bfaaa3d7cdef --- .github/workflow-scripts/analyze_code.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflow-scripts/analyze_code.sh b/.github/workflow-scripts/analyze_code.sh index ebb6a1d72ee..1dd5bcbf28f 100755 --- a/.github/workflow-scripts/analyze_code.sh +++ b/.github/workflow-scripts/analyze_code.sh @@ -4,12 +4,19 @@ # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. -GITHUB_OWNER=-facebook -GITHUB_REPO=-react-native -export GITHUB_OWNER -export GITHUB_REPO +export GITHUB_OWNER=-facebook +export GITHUB_REPO=-react-native -cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow-check --silent --json; echo google-java-format; node scripts/lint-java.js --diff) | node packages/react-native-bots/code-analysis-bot.js +{ + echo eslint + npm run lint --silent -- --format=json + + echo flow + npm run flow-check --silent --json + + echo google-java-format + node scripts/lint-java.js --diff +} | node packages/react-native-bots/code-analysis-bot.js STATUS=$? if [ $STATUS == 0 ]; then @@ -17,3 +24,4 @@ if [ $STATUS == 0 ]; then else echo "Code analysis failed, error status $STATUS." fi +exit $STATUS