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
}
]
}
]
}
junhaoliao marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 10 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,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::./.github/problem-matchers/stylelint.json'"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a variable for the file path? and reuse it later?

- name: "Run `lint:ci` script."
run: |-
# Disable ANSI color codes in Stylelint default "string" formatter
export NO_COLOR=1
npm run lint:ci
junhaoliao marked this conversation as resolved.
Show resolved Hide resolved
- if: "always()"
name: "Remove Stylelint Problem Matcher"
run: "echo '::remove-matcher::./.github/problem-matchers/stylelint.json'"
junhaoliao marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"lint:check": "npm-run-all --sequential --continue-on-error lint:check:*",
"lint:check:css": "stylelint src/**/*.css",
"lint:check:js": "eslint src webpack.*.js --max-warnings 0",
"lint:ci": "npm-run-all --sequential --continue-on-error lint:check:js \"lint:check:css -- --formatter github\"",
"lint:ci": "npm-run-all --sequential --continue-on-error lint:check:*",
junhaoliao marked this conversation as resolved.
Show resolved Hide resolved
"lint:fix": "npm-run-all --parallel --continue-on-error \"lint:check:* -- --fix\""
},
"repository": {
Expand Down