Skip to content
command

GitHub Action

Problem Matcher for stylelint

v1.3.0 Latest version

Problem Matcher for stylelint

command

Problem Matcher for stylelint

Sets up a problem matcher for stylelint that's used to create annotations for violations

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Problem Matcher for stylelint

uses: xt0rted/stylelint-problem-matcher@v1.3.0

Learn more about this action in xt0rted/stylelint-problem-matcher

Choose a version

Problem Matcher for stylelint

CI CodeQL

Adds a problem matcher that will detect errors from Stylelint and create annotations for them.

Usage

on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v2
          with:
            node-version: 16
      - uses: xt0rted/stylelint-problem-matcher@v1
      - run: npm ci
      - run: npm test

Example of inline annotations

Example of build log with highlighted errors

Options

Name Allowed values Description
action add (default), remove If the problem matcher should be registered or removed

Using with sub folders

If you're running Stylelint from a sub folder, or using the working-directory option on your build step, you'll need to switch your report formatter to stylelint-actions-formatters. This package is a copy of the formatters that Stylelint ships with (string and verbose) but they're modified so the file paths are rooted to GITHUB_WORKSPACE instead of your subfolder. Without this change the actions runner won't be able to associate the annotations with the correct file.

package.json

{
  "scripts": {
    "test": "stylelint \"scss/**/*.scss\" --custom-formatter=node_modules/stylelint-actions-formatters"
  }
}

ci.yml

on: push
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v2
          with:
            node-version: 16
      - uses: xt0rted/stylelint-problem-matcher@v1
      - run: npm ci
        working-directory: "src/website"
      - run: npm test
        working-directory: "src/website"

License

The scripts and documentation in this project are released under the MIT License