From 2914e377fcd815d599bf78e9c1b9c16ec589189d Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Fri, 10 May 2024 14:29:31 -0700 Subject: [PATCH] require eslint for PRs --- .github/workflows/lint.yml | 39 ++++++++++++++++++++++++++++++++++++++ .github/workflows/pr.yml | 3 +++ app/eslint-packages.txt | 1 + 3 files changed, 43 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 app/eslint-packages.txt diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..775277c1a9 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +name: Lint + +on: + pull_request: + paths: + - "app/**" + push: + paths: + - "app/**" + +jobs: + eslint: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: "16" + + - name: Cache Node Modules + uses: actions/cache@v3 + with: + path: | + app/node_modules + app/.yarn/cache + key: node-modules-${{ hashFiles('app/yarn.lock') }} + + - name: Install Dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' + run: cd app && yarn install + + - name: Read ESLint Packages List and Lint + run: | + cd app + ESLINT_PACKAGES=$(grep -v '^#' ./eslint-packages.txt | xargs) + yarn eslint $ESLINT_PACKAGES --max-warnings=0 diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index bcd3c19946..8a202d1e2e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -10,6 +10,9 @@ on: - release/v[0-9]+.[0-9]+.[0-9]+ jobs: + lint: + uses: ./.github/workflows/lint.yml + build: uses: ./.github/workflows/build.yml diff --git a/app/eslint-packages.txt b/app/eslint-packages.txt new file mode 100644 index 0000000000..97fd853d53 --- /dev/null +++ b/app/eslint-packages.txt @@ -0,0 +1 @@ +operators