From a5b74d42a290a017f105a29a240f41037b93ce4f Mon Sep 17 00:00:00 2001 From: ZL Asica <40444637+ZL-Asica@users.noreply.github.com> Date: Tue, 5 Nov 2024 11:48:20 -0600 Subject: [PATCH] ci: update eslint and prettier rules --- .github/workflows/firebase-deploy.yml | 8 ++++ .github/workflows/firebase-preview.yml | 61 +++++++++++++++++--------- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git a/.github/workflows/firebase-deploy.yml b/.github/workflows/firebase-deploy.yml index 74630d0..ffa6f6b 100644 --- a/.github/workflows/firebase-deploy.yml +++ b/.github/workflows/firebase-deploy.yml @@ -36,6 +36,14 @@ jobs: - name: ๐Ÿ“‚ Install Packages run: npm ci + # ๐Ÿšจ Run Lint check + - name: ๐Ÿšจ Run Lint + run: npm run lint:fix | tee lint-results.txt + + # ๐ŸŽจ Run Prettier format check + - name: ๐ŸŽจ Run Prettier + run: npm run format | tee prettier-results.txt + - name: ๐Ÿงช Run Tests with Vitest run: npm run test:ci diff --git a/.github/workflows/firebase-preview.yml b/.github/workflows/firebase-preview.yml index 8cb4562..9311e23 100644 --- a/.github/workflows/firebase-preview.yml +++ b/.github/workflows/firebase-preview.yml @@ -29,40 +29,61 @@ jobs: - name: ๐Ÿ”จ Build the app run: npm run build + # ๐Ÿšจ Run Lint check + - name: ๐Ÿšจ Run Lint + run: npm run lint:fix | tee lint-results.txt + + # ๐ŸŽจ Run Prettier format check + - name: ๐ŸŽจ Run Prettier + run: npm run format | tee prettier-results.txt + - name: ๐Ÿงช Test the app with Vitest run: npm run test:ci | tee test-results.txt + # ๐Ÿšฎ Clean up all results for comment + - name: ๐Ÿšฎ Clean up results + run: | + sed -i 's/\x1b\[[0-9;]*m//g' prettier-results.txt + sed -i 's/\x1b\[[0-9;]*m//g' lint-results.txt + sed -i 's/\x1b\[[0-9;]*m//g' test-results.txt - # ๐Ÿšฎ Clean up test results for comment - - name: ๐Ÿšฎ Clean up test results - run: sed -i 's/\x1b\[[0-9;]*m//g' test-results.txt # Removes ANSI color codes - - # ๐Ÿ“„ Format test results for better readability - - name: ๐Ÿ“„ Format test results + # ๐Ÿ“„ Format all results for better readability + - name: ๐Ÿ“„ Format all results run: | { echo "### ๐Ÿงช Test Results" echo "" if grep -q "failed" test-results.txt; then - # Extract failed test details if any echo "โŒ **Some tests failed**:" echo '```' grep -E "Test Files|Tests|Duration|failed" test-results.txt echo '```' - echo "" echo "๐Ÿ’ฅ Please review the failed tests above." else - # Format output for passing tests - grep -E "(Test Files|Tests|Duration)" test-results.txt | while read -r line; do - if [[ $line == *"Test Files"* ]]; then - echo "๐Ÿ—‚ **Test Summary**: $line" - elif [[ $line == *"Tests"* ]]; then - echo "โœ… **Tests Passed**: $line" - elif [[ $line == *"Duration"* ]]; then - echo "โฑ๏ธ **Total Duration**: $line" - fi - done - echo "" - echo "๐ŸŽ‰ All tests passed successfully!" + echo "โœ… **Tests Passed**: All tests passed successfully!" + fi + echo "" + echo "---" + echo "" + echo "### ๐ŸŽจ Prettier Format Check" + echo "" + if grep -q "(changed)" prettier-results.txt; then + echo "โš ๏ธ **Prettier Issues Found** - Some format issues are fixed automatically by Prettier:" + echo '```' + grep -E "\s+\(changed\)" prettier-results.txt || true + echo '```' + else + echo "โœ… **Prettier**: No formatting issues found!" + fi + echo "" + echo "### ๐ŸŽจ Lint Check" + echo "" + if grep -qE "^[^0]* problems" lint-results.txt; then + echo "โš ๏ธ **Lint Issues Found** - PLEASE FIX THEM!" + echo '```' + cat lint-results.txt + echo '```' + else + echo "โœ… **Lint**: No linting issues found!" fi } > formatted-results.txt