From 079ed2aa2c62b6cedcba2607138d6764002e192f Mon Sep 17 00:00:00 2001 From: Shaun Stanworth Date: Thu, 17 Oct 2024 14:24:32 +0100 Subject: [PATCH] Run lint with report output and annotate --- .github/workflows/shopify-cli.yml | 30 +++++++++++++++++++++++++++++- .gitignore | 3 +++ packages/cli-kit/package.json | 2 -- packages/cli-kit/project.json | 24 ++---------------------- 4 files changed, 34 insertions(+), 25 deletions(-) diff --git a/.github/workflows/shopify-cli.yml b/.github/workflows/shopify-cli.yml index 1c8d1108c2..0e06e34898 100644 --- a/.github/workflows/shopify-cli.yml +++ b/.github/workflows/shopify-cli.yml @@ -113,7 +113,7 @@ jobs: matrix: os: ['ubuntu-latest'] node: ['18.20.3'] - target: ['build', 'type-check', 'lint'] + target: ['build', 'type-check'] steps: - uses: actions/checkout@v3 with: @@ -127,6 +127,34 @@ jobs: - name: ${{ matrix.target }} run: pnpm nx run-many --all --skip-nx-cache --target=${{ matrix.target }} --output-style=stream + pr-platform-agnostic-lint: + name: '[PR] Run ${{ matrix.target }} with Node ${{ matrix.node }} in ${{ matrix.os }}' + runs-on: ${{ matrix.os }} + if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }} + timeout-minutes: 30 + strategy: + matrix: + os: ['ubuntu-latest'] + node: ['18.20.3'] + steps: + - uses: actions/checkout@v3 + with: + repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }} + ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }} + fetch-depth: 1 + - name: Setup deps + uses: ./.github/actions/setup-cli-deps + with: + node-version: ${{ matrix.node }} + - name: Lint + run: pnpm nx run-many --all --skip-nx-cache --target=lint --output-style=stream --format=json -o eslint-report.json + continue-on-error: true + - name: Annotate Code Linting Results + uses: ataylorme/eslint-annotate-action@v3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + report-json: "packages/*/eslint-report.json" + pr-platform-agnostic-bundle: name: '[PR] Run bundle with Node ${{ matrix.node }} in ${{ matrix.os }}' runs-on: ${{ matrix.os }} diff --git a/.gitignore b/.gitignore index 854f0c12e8..13df16cc1c 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,6 @@ testing.mjs # NX .nx + +# ESLint reports +eslint-report.json diff --git a/packages/cli-kit/package.json b/packages/cli-kit/package.json index f45b1d10cb..d488bfa045 100644 --- a/packages/cli-kit/package.json +++ b/packages/cli-kit/package.json @@ -50,9 +50,7 @@ "docs:open": "nx docs:open", "lint": "nx lint", "lint:ruby": "nx lint:ruby", - "lint:js": "nx lint:js", "lint:fix": "nx lint:fix", - "lint:js:fix": "nx lint:js:fix", "lint:ruby:fix": "nx lint:ruby:fix", "prepack": "cross-env NODE_ENV=production pnpm nx build && cp ../../README.md README.md", "test": "nx test", diff --git a/packages/cli-kit/project.json b/packages/cli-kit/project.json index 8fcf122e49..aa54c0637b 100644 --- a/packages/cli-kit/project.json +++ b/packages/cli-kit/project.json @@ -49,12 +49,9 @@ }, "lint": { "executor": "nx:run-commands", - "dependsOn": [ - "lint:js" - ], "options": { - "cwd": "packages/cli-kit", - "commands": [] + "command": "pnpm eslint \"src/**/*.{ts,tsx}\"", + "cwd": "packages/cli-kit" } }, "lint:ruby": { @@ -64,24 +61,7 @@ "cwd": "packages/cli-kit/assets/cli-ruby" } }, - "lint:js": { - "executor": "nx:run-commands", - "options": { - "command": "pnpm eslint \"src/**/*.{ts,tsx}\"", - "cwd": "packages/cli-kit" - } - }, "lint:fix": { - "executor": "nx:run-commands", - "dependsOn": [ - "lint:js:fix" - ], - "options": { - "cwd": "packages/cli-kit", - "commands": [] - } - }, - "lint:js:fix": { "executor": "nx:run-commands", "options": { "command": "pnpm eslint 'src/**/*.{ts,tsx}' --fix",