name: Lint

on:
  pull_request:
  push:
    branches:
      - main

jobs:
  markdownlint:
    name: markdownlint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Run markdownlint
        uses: DavidAnson/markdownlint-cli2-action@v20
        with:
          globs: |
            *.md
            docs/**/*.md

  shellcheck:
    name: ShellCheck
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Run ShellCheck
        uses: ludeeus/action-shellcheck@master
        with:
          severity: error

  prettier:
    name: Prettier
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: "lts/*"

      - name: Install Node packages
        run: npm ci --ignore-scripts

      - name: Check formatting
        run: npx prettier --check .

  biome:
    name: Biome
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Setup Biome
        uses: biomejs/setup-biome@v2

      - name: Run Biome lint
        run: biome lint .

  stylelint:
    name: Stylelint
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v5

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: "lts/*"

      - name: Install Node packages
        run: npm ci --ignore-scripts

      - name: Run Stylelint
        run: npx stylelint web/css/src/**/*.css
