Skip to content

Commit

Permalink
Introduce stylelint to lint css / less files (#20926)
Browse files Browse the repository at this point in the history
* Adds stylelinter as github action

* exclude stylelinter config file from builds

* exclude built vue files

* fix running stylelint

* Update .github/workflows/stylelinter.yml

Co-authored-by: Ben Burgess <[email protected]>

* restrict action permissions

---------

Co-authored-by: Ben Burgess <[email protected]>
  • Loading branch information
sgiehl and bx80 authored Jun 26, 2023
1 parent d795555 commit e13e124
Show file tree
Hide file tree
Showing 7 changed files with 1,600 additions and 111 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ tests/ export-ignore
.phpstorm.meta.php export-ignore
.scrutinizer.yml export-ignore
.travis.yml export-ignore
.stylelintrc.json export-ignore
PULL_REQUEST_TEMPLATE export-ignore

# Linguist: language statistics
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/clean-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,6 @@ for x in .gitignore .gitmodules .gitattributes .git-blame-ignore-revs .bowerrc .
.phpstorm.meta.php .lfsconfig .travis.sh tsconfig.json tsconfig.spec.json \
.eslintrc.js .eslintignore .eslintrc .browserslistrc babel.config.js jest.config.js \
karma.conf.js karma-conf.js vue.config.js .npmignore .ncurc.json .prettierrc .jscsrc \
phpstan.neon phpstan.neon.dist package.xml; do
phpstan.neon phpstan.neon.dist package.xml .stylelintrc.json; do
find . -name "$x" -exec rm -f {} \;
done
29 changes: 29 additions & 0 deletions .github/workflows/stylelinter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Stylelint

on: pull_request

permissions:
actions: none
checks: none
contents: none
deployments: none
issues: none
packages: none
pull-requests: read
repository-projects: none
security-events: none
statuses: none

jobs:
phpcs:
name: stylelinter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
lfs: false
persist-credentials: false
- name: stylelint
run: |
npm install
npx stylelint "**/*.{css,less}" -f github
12 changes: 12 additions & 0 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"overrides": [
{
"files": ["**/*.less"],
"customSyntax": "postcss-less"
}
],
"ignoreFiles": ["node_modules/**/*", "vendor/**/*", "tests/**/*", "tmp/**/*", "misc/**/*", "plugins/*/vue/dist/*"],
"rules": {
"color-no-invalid-hex": true
}
}
Loading

0 comments on commit e13e124

Please sign in to comment.