Skip to content

Commit

Permalink
ci(lint): Replace deprecated Stylelint Github formatter with a Github…
Browse files Browse the repository at this point in the history
… problem matcher. (#112)
  • Loading branch information
junhaoliao authored Nov 25, 2024
1 parent d2ebacf commit d07c1b7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
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

0 comments on commit d07c1b7

Please sign in to comment.