Skip to content

Commit

Permalink
Make Stylelint lint HTML & HTML-like files (#140)
Browse files Browse the repository at this point in the history
  • Loading branch information
germanfrelo authored Nov 11, 2024
1 parent d98eafe commit daa3fc2
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 3 deletions.
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@
// Lint CSS with Stylelint
// Disable VS Code's built-in linters to prevent them from reporting the same errors as Stylelint
"stylelint.enable": true, // default
"stylelint.validate": [
"css", // default
"postcss", // default
"astro",
"html",
"php",
"svelte",
"vue",
"xml"
],
"css.validate": false,
"less.validate": false,
"scss.validate": false,
Expand Down
221 changes: 221 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"format:check": "prettier --check .",
"lint": "npm run lint:css && npm run lint:js && npm run lint:md",
"lint:fix": "npm run lint:css:fix && npm run lint:js:fix && npm run lint:md:fix",
"lint:css": "stylelint \"**/*.css\"",
"lint:css": "stylelint --formatter verbose --max-warnings 0 \"**/*.{astro,css,html,php,svelte,vue,xml}\"",
"lint:css:fix": "npm run lint:css -- --fix",
"lint:js": "eslint --max-warnings 0",
"lint:js:fix": "npm run lint:js -- --fix",
Expand All @@ -38,7 +38,7 @@
"test": "npm run format:check && npm run lint"
},
"lint-staged": {
"*.css": [
"(*.astro|*.css|*.html|*.php|*.svelte|*.vue|*.xml)": [
"stylelint",
"prettier --write"
],
Expand All @@ -49,7 +49,7 @@
"*.md": [
"markdownlint-cli2 --fix"
],
"!(*.css|*.js|*.md)": [
"!(*.astro|*.css|*.html|*.js|*.md|*.php|*.svelte|*.vue|*.xml)": [
"prettier --write --ignore-unknown"
]
},
Expand All @@ -60,8 +60,10 @@
"husky": "9.1.6",
"lint-staged": "15.2.10",
"markdownlint-cli2": "0.15.0",
"postcss-html": "1.7.0",
"prettier": "3.3.3",
"stylelint": "16.10.0",
"stylelint-config-html": "1.1.0",
"stylelint-config-recess-order": "5.1.1",
"stylelint-config-standard": "36.0.1",
"stylelint-plugin-defensive-css": "1.0.4"
Expand Down
1 change: 1 addition & 0 deletions stylelint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export default {
extends: [
// Order matters: later configs take precedence over (override) earlier ones.
"stylelint-config-standard",
"stylelint-config-html",
"stylelint-config-recess-order",
],
plugins: ["stylelint-plugin-defensive-css"],
Expand Down

0 comments on commit daa3fc2

Please sign in to comment.