We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yarn add -D stylelint stylelint-config-standard stylelint-config-standard-vue postcss-html
module.exports = { "extends": [ "stylelint-config-standard", "stylelint-config-standard-vue", ], "rules": { } }
yarn add -D stylelint-config-standard-scss
module.exports = { "extends": [ "stylelint-config-standard", "stylelint-config-standard-vue/scss", ], "rules": { } }
{ "eslint.format.enable": true, "css.validate": false, "less.validate": false, "scss.validate": false, "stylelint.enable": true, "stylelint.validate": [ "css", "less", "scss", "postcss", "vue", ], "editor.codeActionsOnSave": { "source.fixAll.eslint": true, "source.fixAll.stylelint": true, }, }
网上说stylelint存在版本问题,需要VsCode插件降级的0.x;但我在最新版1.x的实践没有遇到额外问题。
npm install lint-staged --save-dev
直接添加在 package.json 中,或者新建 .lintstagedrc 文件来存放配置
package.json
.lintstagedrc
{ "lint-staged": { "*": "your-cmd" } }
也可以用数组配置多个命令,如下
{ "lint-staged": { "*": ["your-cmd1", "your-cmd2"] } }
然后在 Husky 中添加 Hook
npx husky add .husky/pre-commit "npx lint-staged" # 此命令会以追加而不是覆盖的方式添加
module.exports = { "*.{js,jsx,vue}": [ "eslint", ], "*.{css,scss,vue}": [ "stylelint", ], };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
css
.stylelintrc.js
sass
.stylelintrc.js
VsCode Setting(JSON)
lint-staged
安装
配置
直接添加在
package.json
中,或者新建.lintstagedrc
文件来存放配置也可以用数组配置多个命令,如下
然后在 Husky 中添加 Hook
.lintstagedrc.js
The text was updated successfully, but these errors were encountered: