Skip to content

Commit

Permalink
Run lint with report output and annotate
Browse files Browse the repository at this point in the history
  • Loading branch information
shauns committed Oct 17, 2024
1 parent b3b8f1e commit 079ed2a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 25 deletions.
30 changes: 29 additions & 1 deletion .github/workflows/shopify-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,6 @@ testing.mjs

# NX
.nx

# ESLint reports
eslint-report.json
2 changes: 0 additions & 2 deletions packages/cli-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
24 changes: 2 additions & 22 deletions packages/cli-kit/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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",
Expand Down

0 comments on commit 079ed2a

Please sign in to comment.