From a51a1ec94beaeefc07acb8a65b1d37e040d3bc6a Mon Sep 17 00:00:00 2001 From: Talisson Costa Date: Wed, 10 Jun 2026 16:29:52 -0300 Subject: [PATCH] ci(frontend): lint changed files on pull requests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a lint job to the frontend PR workflow that runs eslint on only the files changed in the PR. The frontend has a large pre-existing eslint/tsc backlog, so a whole-repo gate isn't viable — diff-scoping stops new violations without blocking on legacy debt. eslint extends plugin:prettier/recommended, so this also catches formatting issues. Co-Authored-By: Claude Opus 4.8 (1M context) --- .github/workflows/frontend-pull-request.yml | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.github/workflows/frontend-pull-request.yml b/.github/workflows/frontend-pull-request.yml index 9a202c776213..6eab0865e108 100644 --- a/.github/workflows/frontend-pull-request.yml +++ b/.github/workflows/frontend-pull-request.yml @@ -34,3 +34,42 @@ jobs: - name: Run unit tests run: npm run test:unit -- --passWithNoTests + + lint: + name: Lint changed files + runs-on: ubuntu-latest + + defaults: + run: + working-directory: frontend + + steps: + - uses: actions/checkout@v5 + with: + fetch-depth: 0 # needed to diff against the PR base + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: frontend/.nvmrc + cache: npm + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + run: npm ci + + # Diff-scoped: the frontend has a large pre-existing eslint/tsc backlog, + # so a whole-repo gate isn't viable yet. + - name: Lint changed files + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + run: | + CHANGED=$(git diff --name-only --diff-filter=ACMR --relative \ + "$BASE_SHA" HEAD -- '*.ts' '*.tsx' '*.js') + if [ -z "$CHANGED" ]; then + echo "No frontend JS/TS files changed — skipping." + exit 0 + fi + echo "Linting changed files:" + echo "$CHANGED" + echo "$CHANGED" | xargs npx eslint