name: CI

on:
  pull_request:
  push:
    branches:
      - '*.x-stable'

jobs:
  lint:
    name: Lint code
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v5

      - name: Setup Node.js
        uses: actions/setup-node@v6
        with:
          node-version: 22

      - name: Install dependencies
        run: npm install

      - name: Check formatting with Prettier
        run: |
          npx prettier --write --log-level=warn .
          git --no-pager diff --exit-code

      - name: Lint code with ESLint
        run: npx eslint .
