Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xt0rted/stylelint-problem-matcher
A GitHub Action that registers a problem matcher for Stylelint's report format
https://github.com/xt0rted/stylelint-problem-matcher
annotations github-actions linting problem-matcher stylelint stylelint-problem-matcher
Last synced: 6 days ago
JSON representation
A GitHub Action that registers a problem matcher for Stylelint's report format
- Host: GitHub
- URL: https://github.com/xt0rted/stylelint-problem-matcher
- Owner: xt0rted
- License: mit
- Created: 2019-11-18T05:30:22.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-10-14T13:03:55.000Z (3 months ago)
- Last Synced: 2024-10-14T13:04:15.151Z (3 months ago)
- Topics: annotations, github-actions, linting, problem-matcher, stylelint, stylelint-problem-matcher
- Language: TypeScript
- Homepage:
- Size: 2.1 MB
- Stars: 19
- Watchers: 5
- Forks: 4
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- awesome-actions - Stylelint problem matcher to create annotations
- fucking-awesome-actions - Stylelint problem matcher to create annotations
- awesome-workflows - Stylelint problem matcher to create annotations
README
# Problem Matcher for stylelint
[![CI](https://github.com/xt0rted/stylelint-problem-matcher/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/xt0rted/stylelint-problem-matcher/actions/workflows/ci.yml)
[![CodeQL](https://github.com/xt0rted/stylelint-problem-matcher/actions/workflows/codeql-analysis.yml/badge.svg?branch=main)](https://github.com/xt0rted/stylelint-problem-matcher/actions/workflows/codeql-analysis.yml)Adds a problem matcher that will detect errors from [Stylelint](https://stylelint.io/) and create annotations for them.
## Usage
```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
- run: npm test
```![Example of inline annotations](docs/annotations.png)
![Example of build log with highlighted errors](docs/build-log.png)
## 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`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstepsrun) option on your build step, you'll need to switch your report formatter to [stylelint-actions-formatters](https://github.com/xt0rted/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`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables#default-environment-variables) instead of your subfolder.
Without this change the actions runner won't be able to associate the annotations with the correct file.### package.json
```json
{
"scripts": {
"test": "stylelint \"scss/**/*.scss\" --custom-formatter=node_modules/stylelint-actions-formatters"
}
}
```### ci.yml
```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](LICENSE)