Skip to content

Commit d07c1b7

Browse files
authored
ci(lint): Replace deprecated Stylelint Github formatter with a Github problem matcher. (#112)
1 parent d2ebacf commit d07c1b7

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"problemMatcher": [
3+
{
4+
"owner": "stylelint",
5+
"pattern": [
6+
{
7+
"regexp": "^([^\\s].*)$",
8+
"file": 1
9+
},
10+
{
11+
"regexp": "^\\s*(\\d+):(\\d+)\\s+(\\S+)\\s+(.+?)\\s+(\\S+)$",
12+
"line": 1,
13+
"column": 2,
14+
"message": 4,
15+
"code": 5,
16+
"loop": true
17+
}
18+
]
19+
}
20+
]
21+
}

.github/workflows/lint.yaml

+13-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ concurrency:
2121
jobs:
2222
lint-check:
2323
runs-on: "ubuntu-latest"
24+
env:
25+
STYLELINT_MATCHER_OWNER: "stylelint"
26+
STYLELINT_MATCHER_PATH: "./.github/problem-matchers/stylelint.json"
2427
steps:
2528
- uses: "actions/checkout@v4"
2629
with:
@@ -29,4 +32,13 @@ jobs:
2932
with:
3033
node-version: 22
3134
- run: "npm clean-install"
32-
- run: "npm run lint:ci"
35+
- name: "Set up Stylelint Problem Matcher"
36+
run: "echo '::add-matcher::${{env.STYLELINT_MATCHER_PATH}}'"
37+
- name: "Run `lint:check` script."
38+
run: |-
39+
# Disable ANSI color codes in Stylelint default "string" formatter
40+
export NO_COLOR=1
41+
npm run lint:check
42+
- if: "always()"
43+
name: "Remove Stylelint Problem Matcher"
44+
run: "echo '::remove-matcher owner=${{env.STYLELINT_MATCHER_OWNER}}::'"

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"lint:check": "npm-run-all --sequential --continue-on-error lint:check:*",
1111
"lint:check:css": "stylelint src/**/*.css",
1212
"lint:check:js": "eslint . --max-warnings 0",
13-
"lint:ci": "npm-run-all --sequential --continue-on-error lint:check:js \"lint:check:css -- --formatter github\"",
1413
"lint:fix": "npm-run-all --parallel --continue-on-error \"lint:check:* -- --fix\"",
1514
"start": "webpack serve --open --config webpack.dev.js",
1615
"test": "jest"

0 commit comments

Comments
 (0)