From 3e5b542a1f90a12d5a0f61db6d02abc2b8597adb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Pe=CC=81rard?= Date: Mon, 27 Jan 2025 09:21:02 +0100 Subject: [PATCH] add lint in CI match config with start-ui-web --- .eslintrc.json | 3 +- .github/workflows/code-quality.yml | 56 ++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/code-quality.yml diff --git a/.eslintrc.json b/.eslintrc.json index b81e1bf..b696728 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -12,7 +12,8 @@ { "argsIgnorePattern": "^_" } ], "sonarjs/no-duplicate-string": "off", - "sonarjs/cognitive-complexity": ["warn", 50] + "sonarjs/cognitive-complexity": ["warn", 50], + "sonarjs/prefer-immediate-return": "warn" }, "overrides": [ { diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml new file mode 100644 index 0000000..bf85ef5 --- /dev/null +++ b/.github/workflows/code-quality.yml @@ -0,0 +1,56 @@ +name: 🔎 Code Quality + +on: + push: + branches: + - master + - main + - develop + - staging + pull_request: + +jobs: + lint-code: + timeout-minutes: 10 + name: Lint and Type Check + runs-on: ubuntu-latest + + strategy: + matrix: + node: [20, 22, 'lts/*'] + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + version: 8 + run_install: false + + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Cache node modules + uses: actions/cache@v4 + env: + cache-name: cache-node-modules + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store-${{ env.cache-name }}- + ${{ runner.os }}-pnpm-store- + ${{ runner.os }}- + + - name: Install dependencies + run: pnpm install + + - name: TypeScript check + run: pnpm lint:staged