Skip to content

Instantly share code, notes, and snippets.

@JulianCataldo
Last active April 10, 2023 16:35
Show Gist options
  • Save JulianCataldo/dba6c0587d0e9d1be26e80eef40f3be3 to your computer and use it in GitHub Desktop.
Save JulianCataldo/dba6c0587d0e9d1be26e80eef40f3be3 to your computer and use it in GitHub Desktop.
Astro tooling : Stylelint
/** @type {import("@types/stylelint").Options} */
module.exports = {
extends: [
'stylelint-config-standard',
'stylelint-config-standard-scss',
'stylelint-config-prettier',
],
overrides: [
{
files: ['*.astro', '**/*.astro'],
customSyntax: 'postcss-html',
},
{
files: ['*.vue', '**/*.vue'],
extends: [
'stylelint-config-standard-scss',
'stylelint-config-prettier',
'stylelint-config-recommended-vue/scss',
],
},
],
rules: {
'comment-empty-line-before': null,
'shorthand-property-no-redundant-values': null,
'scss/double-slash-comment-empty-line-before': null,
'color-function-notation': null,
'property-no-vendor-prefix': null,
'value-keyword-case': null,
'declaration-block-no-redundant-longhand-properties': null,
'hue-degree-notation': null,
'length-zero-no-unit': null,
'alpha-value-notation': null,
'selector-pseudo-class-no-unknown': [
true,
{
ignorePseudoClasses: ['global'],
},
],
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['v-deep']
},
],
},
};
{
"scripts": {
"lint:style": "stylelint ./src/**/*.vue ./src/**/*.scss ./src/**/*.astro --fix"
},
"devDependencies": {
"postcss-html": "^1.4.1",
"@types/stylelint": "^14.0.0",
"stylelint": "^14.8.5",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-recommended-scss": "^6.0.0",
"stylelint-config-recommended-vue": "^1.4.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-config-standard-scss": "^4.0.0"
}
}
// VSCode
// Extension: "stylelint.vscode-stylelint"
{
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "astro"],
"stylelint.snippet": ["css", "less", "postcss", "scss", "vue", "astro"]
// "editor.formatOnPaste": false,
// "editor.formatOnType": false,
// "editor.formatOnSave": true,
// "editor.codeActionsOnSave": {
// "source.fixAll": true
// }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment