@wuxh/stylelint-config-basic
个性化 stylelint-config
usage
npm i stylelint @wuxh/stylelint-config-basic -D
.stylelintrc
{
"extends": "@wuxh/stylelint-config-basic"
}
Add script for package.json
{
"scripts": {
"lint": "stylelint \"**/*.css\""
}
}
Add VSCode setting
{
"editor.codeActionsOnSave": {
"source.fixAll.stylelint": true
},
"stylelint.validate": ["css"]
}
lint Less
npm i postcss-less -D
package.json
{
"scripts": {
- "lint": "stylelint \"**/*.css\""
+ "lint": "stylelint \"**/*.{css,less}\""
}
}
.vscode/setting.json
{
- "stylelint.validate": ["css"]
+ "stylelint.validate": ["css", "less"]
}
lint Scss
npm i postcss-scss -D
package.json
{
"scripts": {
- "lint": "stylelint \"**/*.css\""
+ "lint": "stylelint \"**/*.{css,scss}\""
}
}
.vscode/setting.json
{
- "stylelint.validate": ["css"]
+ "stylelint.validate": ["css", "scss"]
}
lint Stylus
npm i postcss-styl stylelint-plugin-stylus -D
package.json
{
"scripts": {
- "lint": "stylelint \"**/*.css\""
+ "lint": "stylelint \"**/*.{css,styl,stylus}\""
}
}
.vscode/setting.json
{
- "stylelint.validate": ["stylus"]
+ "stylelint.customSyntax": "stylelint-plugin-stylus/custom-syntax",
+ "stylelint.validate": ["css", "stylus"]
}