From 8af5423616bc9ae97000189d9d4c37c110cdd370 Mon Sep 17 00:00:00 2001 From: Ballard Date: Wed, 7 Feb 2024 03:07:38 -0500 Subject: [PATCH] chore: add eslint workflow --- .bin/pre-commit-lint.sh | 6 ------ .eslintrc.js | 31 +++++++++++++++++++++++++++++++ .eslintrc.yml | 11 ----------- .github/workflows/eslint.yaml | 25 +++++++++++++++++++++++++ 4 files changed, 56 insertions(+), 17 deletions(-) create mode 100644 .eslintrc.js delete mode 100644 .eslintrc.yml create mode 100644 .github/workflows/eslint.yaml diff --git a/.bin/pre-commit-lint.sh b/.bin/pre-commit-lint.sh index e917a3d29..916820131 100755 --- a/.bin/pre-commit-lint.sh +++ b/.bin/pre-commit-lint.sh @@ -2,12 +2,6 @@ set -euxo pipefail -# Check if ESLint is installed -if ! command -v eslint &> /dev/null; then - echo "ESLint is not installed. Installing ESLint..." - yarn add eslint --dev -fi - pushd client || exit 1 files=("$@") files=("${files[@]/#/../}") # add ../ to each element diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 000000000..02dd10ab9 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,31 @@ +module.exports = { + "env": { + "browser": true, + "es2021": true + }, + "extends": "plugin:react/recommended", + "overrides": [ + { + "env": { + "node": true + }, + "files": [ + ".eslintrc.{js,cjs}" + ], + "parserOptions": { + "sourceType": "script" + } + } + ], + "parser": "@typescript-eslint/parser", + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "plugins": [ + "@typescript-eslint", + "react" + ], + "rules": { + } +} diff --git a/.eslintrc.yml b/.eslintrc.yml deleted file mode 100644 index b0e071aac..000000000 --- a/.eslintrc.yml +++ /dev/null @@ -1,11 +0,0 @@ -env: - browser: true - es2021: true -extends: plugin:react/recommended -parser: "@typescript-eslint/parser" -parserOptions: - ecmaVersion: latest - sourceType: module -plugins: - - react -rules: {} diff --git a/.github/workflows/eslint.yaml b/.github/workflows/eslint.yaml new file mode 100644 index 000000000..fc3bd5d84 --- /dev/null +++ b/.github/workflows/eslint.yaml @@ -0,0 +1,25 @@ +name: ESLint + +on: + push: + branches: [main, develop, 127-fix-precommit-conditions] + pull_request: + branches: [main, develop] + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: 20 + - name: Install dependencies + run: yarn install + + - name: Run ESLint + run: yarn run eslint