Skip to content

Commit

Permalink
require eslint for PRs (#4391)
Browse files Browse the repository at this point in the history
* add operator specific eslint

* fix some js operator module eslint issues

* undo exhaustive-deps fix

* require eslint for PRs

* fix package path

* remove lint push trigger

* more lint fixes for operators

* lint app, use workflow call

* mv changes to lint-app

* add lint requirement

* no max warnings

* rm 2204 install

---------

Co-authored-by: Benjamin Kane <[email protected]>
  • Loading branch information
ritch and benjaminpkane authored May 21, 2024
1 parent 8205caf commit 6fd7309
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/lint-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Lint App

on: workflow_call

jobs:
eslint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
changes:
- 'app/**'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "16"

- name: Cache Node Modules
id: node-cache
uses: actions/cache@v3
with:
path: |
app/node_modules
app/.yarn/cache
key: node-modules-${{ hashFiles('app/yarn.lock') }}

- name: Install Dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
run: cd app && yarn install

- name: Read ESLint Packages List and Lint
if: steps.changes.outputs.changes == 'true'
run: |
cd app
ESLINT_PACKAGES=$(grep -v '^#' ./eslint-packages.txt | xargs)
yarn eslint $ESLINT_PACKAGES
7 changes: 5 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ on:
- release/v[0-9]+.[0-9]+.[0-9]+

jobs:
lint:
uses: ./.github/workflows/lint-app.yml

build:
uses: ./.github/workflows/build.yml

Expand All @@ -21,7 +24,7 @@ jobs:

all-tests:
runs-on: ubuntu-latest
needs: [build, test]
needs: [build, lint, test]
if: always()
steps:
- run: sh -c ${{ needs.build.result == 'success' && needs.test.result == 'success' }}
- run: sh -c ${{ needs.build.result == 'success' && needs.lint.result == 'success' && needs.test.result == 'success' }}
3 changes: 3 additions & 0 deletions app/eslint-packages.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# require these paths to pass linting
# for PRs to be merge-able
packages/operators

0 comments on commit 6fd7309

Please sign in to comment.