From b3742190bc60bfeecf41e8e3744f5a269532dc45 Mon Sep 17 00:00:00 2001 From: Geoffrey Yu Date: Sun, 10 Mar 2024 10:57:58 -0400 Subject: [PATCH] Add new Github Action for the UI --- .github/workflows/check_js.yml | 44 ++++++++++++++++++++++++++++++++++ ui/.eslintignore | 1 + ui/.eslintrc.cjs | 37 ++++++++++++++++++++++++++++ ui/package-lock.json | 2 +- ui/package.json | 2 +- 5 files changed, 84 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/check_js.yml create mode 100644 ui/.eslintignore create mode 100644 ui/.eslintrc.cjs diff --git a/.github/workflows/check_js.yml b/.github/workflows/check_js.yml new file mode 100644 index 00000000..1a2e7c71 --- /dev/null +++ b/.github/workflows/check_js.yml @@ -0,0 +1,44 @@ +name: Check JS Code + +on: + push: + branches: [ main ] + paths: + - 'ui/**' + pull_request: + branches: [ main ] + paths: + - 'ui/**' + workflow_dispatch: {} + +jobs: + build: + name: Check JS Code + timeout-minutes: 30 + + runs-on: ubuntu-22.04 + + steps: + - uses: actions/checkout@v4 + + - name: Set Up Node 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Dependencies + working-directory: ui + run: npm install + + - name: Check Formatting (prettier) + working-directory: ui + run: npx prettier --check . + if: success() || failure() + + - name: Lint (eslint) + run: npx eslint . + if: success() || failure() + + - name: Run Build (vite) + run: npm run build + if: success() || failure() diff --git a/ui/.eslintignore b/ui/.eslintignore new file mode 100644 index 00000000..06c5e168 --- /dev/null +++ b/ui/.eslintignore @@ -0,0 +1 @@ +dist/** diff --git a/ui/.eslintrc.cjs b/ui/.eslintrc.cjs new file mode 100644 index 00000000..562ef181 --- /dev/null +++ b/ui/.eslintrc.cjs @@ -0,0 +1,37 @@ +module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": [ + "eslint:recommended", + "plugin:react/recommended" + ], + "overrides": [ + { + "env": { + "node": true + }, + "files": [ + ".eslintrc.{js,cjs}" + ], + "parserOptions": { + "sourceType": "script" + } + } + ], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "react" + ], + "rules": { + }, + "settings": { + "react": { + "version": "detect" + } + } +} diff --git a/ui/package-lock.json b/ui/package-lock.json index 3598911e..55ff66bf 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -19,7 +19,7 @@ "@types/react-dom": "^18.2.19", "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.56.0", - "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react": "^7.34.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", "prettier": "3.2.5", diff --git a/ui/package.json b/ui/package.json index 7190c9aa..d870cb42 100644 --- a/ui/package.json +++ b/ui/package.json @@ -22,7 +22,7 @@ "@types/react-dom": "^18.2.19", "@vitejs/plugin-react": "^4.2.1", "eslint": "^8.56.0", - "eslint-plugin-react": "^7.33.2", + "eslint-plugin-react": "^7.34.0", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-react-refresh": "^0.4.5", "prettier": "3.2.5",