name: Lint & Type Check

on:
  push:
    branches: ['**']
  pull_request:
    branches: ['**']

jobs:
  lint:
    name: Lint & Type Check
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout code
        uses: actions/checkout@v4
      
      - name: Setup Bun
        uses: oven-sh/setup-bun@v1
        with:
          bun-version: latest
      
      - name: Install dependencies
        run: bun install

      - name: Run ESLint fix
        run: bunx eslint --fix .
        continue-on-error: false

      - name: Run ESLint
        run: bun run lint
        continue-on-error: false
      
      - name: TypeScript Check (Frontend)
        run: bunx tsc --noEmit
        continue-on-error: false
      
      - name: TypeScript Check (API)
        working-directory: ./api
        run: bunx tsc --noEmit --module node16 --moduleResolution node16 --target ES2022 --lib ES2022 **/*.ts
        continue-on-error: false
