Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(lint): Replace deprecated Stylelint Github formatter with a Github problem matcher. #112

Merged
merged 9 commits into from
Nov 25, 2024
21 changes: 21 additions & 0 deletions .github/problem-matchers/stylelint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"problemMatcher": [
{
"owner": "stylelint",
"pattern": [
{
"regexp": "^([^\\s].*)$",
"file": 1
},
{
"regexp": "^\\s*(\\d+):(\\d+)\\s+(\\S+)\\s+(.+?)\\s+(\\S+)$",
"line": 1,
"column": 2,
"message": 4,
"code": 5,
"loop": true
}
]
}
]
}
14 changes: 13 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ concurrency:
jobs:
lint-check:
runs-on: "ubuntu-latest"
env:
STYLELINT_MATCHER_OWNER: "stylelint"
STYLELINT_MATCHER_PATH: "./.github/problem-matchers/stylelint.json"
steps:
- uses: "actions/checkout@v4"
with:
Expand All @@ -29,4 +32,13 @@ jobs:
with:
node-version: 22
- run: "npm clean-install"
- run: "npm run lint:ci"
- name: "Set up Stylelint Problem Matcher"
run: "echo '::add-matcher::${{env.STYLELINT_MATCHER_PATH}}'"
- name: "Run `lint:check` script."
run: |-
# Disable ANSI color codes in Stylelint default "string" formatter
export NO_COLOR=1
npm run lint:check
- if: "always()"
name: "Remove Stylelint Problem Matcher"
run: "echo '::remove-matcher owner=${{env.STYLELINT_MATCHER_OWNER}}::'"
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"lint:check": "npm-run-all --sequential --continue-on-error lint:check:*",
"lint:check:css": "stylelint src/**/*.css",
"lint:check:js": "eslint . --max-warnings 0",
"lint:ci": "npm-run-all --sequential --continue-on-error lint:check:js \"lint:check:css -- --formatter github\"",
"lint:fix": "npm-run-all --parallel --continue-on-error \"lint:check:* -- --fix\"",
"start": "webpack serve --open --config webpack.dev.js",
"test": "jest"
Expand Down