Skip to content

CI: warnings on main ​

Errors always fail. Warnings are informations while a branch is being worked on, and a gate before main:

WhereCommandFails on
Every push (a branch, develop)pnpm lint and pnpm lint:csserrors
A merge request to mainpnpm lint:strict and pnpm lint:css:stricterrors and warnings

On main, a warning is either fixed or justified on its line (// eslint-disable-next-line <rule> -- <reason>, // stylelint-disable-next-line <rule> -- <reason>). The infos never fail: the command line does not even see them (ESLINT_INFO_RULES=off).

The scripts, in package.json:

json
{
  "scripts": {
    "lint": "ESLINT_INFO_RULES=off eslint . --concurrency auto",
    "lint:strict": "pnpm lint --max-warnings 0",
    "lint:css": "stylelint \"**/*.scss\"",
    "lint:css:strict": "pnpm lint:css --max-warnings 0",
    "lint:css:fix": "stylelint \"**/*.scss\" --fix"
  }
}

With GitLab CI, for instance:

yaml
lint:
  script:
    - pnpm lint
    - pnpm lint:css

lint-main:
  rules:
    - if: $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "main"
  script:
    - pnpm lint:strict
    - pnpm lint:css:strict

This repository runs the strict commands in pnpm check.

Generated from the JSDoc of the sources.