Refactor: add lint rules #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint & Format Check | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - prod | |
| - development | |
| jobs: | |
| lockfile-check: | |
| name: Lockfile Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Check for package-lock.json | |
| run: | | |
| if [ -f "package-lock.json" ]; then | |
| echo "::error::package-lock.json detected! This project uses Yarn v1. Please remove package-lock.json and use 'yarn install' instead of 'npm install'." | |
| exit 1 | |
| fi | |
| echo "✓ No package-lock.json found. Using Yarn as expected." | |
| lint: | |
| name: ESLint & Prettier | |
| runs-on: ubuntu-latest | |
| needs: lockfile-check | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run ESLint | |
| run: yarn lint | |
| - name: Check Prettier formatting | |
| run: yarn format:check | |
| typecheck: | |
| name: TypeScript | |
| runs-on: ubuntu-latest | |
| needs: lockfile-check | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run TypeScript check | |
| run: yarn typescript | |
| test: | |
| name: Tests | |
| runs-on: ubuntu-latest | |
| needs: lockfile-check | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run tests | |
| run: yarn test |