From e85709436f00a7d657c9d7777e69483da9ff353e Mon Sep 17 00:00:00 2001 From: Nate Date: Thu, 15 May 2025 15:38:13 -0700 Subject: [PATCH] ci: :art: run prettier check for all PRs --- .github/workflows/pr_checks.yaml | 21 ++++++++++++++++++++- package.json | 4 +++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_checks.yaml b/.github/workflows/pr_checks.yaml index eec79f4c6..36cee63ab 100644 --- a/.github/workflows/pr_checks.yaml +++ b/.github/workflows/pr_checks.yaml @@ -30,6 +30,24 @@ jobs: if: steps.root-cache.outputs.cache-hit != 'true' run: npm ci + prettier-check: + needs: install-root + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + + - uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-root-node-modules-${{ hashFiles('package-lock.json') }} + + - name: Check code formatting with Prettier + run: npx prettier --check "**/*.{js,jsx,ts,tsx,json,css,md}" --ignore-path .gitignore + install-config-yaml: needs: install-root runs-on: ubuntu-latest @@ -859,6 +877,7 @@ jobs: runs-on: ubuntu-latest needs: - install-root + - prettier-check - install-core - core-checks - install-gui @@ -881,4 +900,4 @@ jobs: - name: Decide whether the needed jobs succeeded or failed uses: re-actors/alls-green@release/v1 with: - jobs: ${{ toJSON(needs) }} + jobs: ${{ toJSON(needs) }} \ No newline at end of file diff --git a/package.json b/package.json index 01270032f..79e522af1 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "tsc:watch:gui": "tsc --project gui/tsconfig.json --watch --noEmit --pretty", "tsc:watch:vscode": "tsc --project extensions/vscode/tsconfig.json --watch --noEmit --pretty", "tsc:watch:core": "tsc --project core/tsconfig.json --watch --noEmit --pretty", - "tsc:watch:binary": "tsc --project binary/tsconfig.json --watch --noEmit --pretty" + "tsc:watch:binary": "tsc --project binary/tsconfig.json --watch --noEmit --pretty", + "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\" --ignore-path .gitignore", + "format:check": "prettier --check \"**/*.{js,jsx,ts,tsx,json,css,md}\" --ignore-path .gitignore" }, "devDependencies": { "@typescript-eslint/parser": "^7.8.0",