@gsc-basic/stylelint-config
v1.0.4
Published
Stylelint config for GSC Basic Team
Downloads
61
Readme
@gsc-basic/stylelint-config
Stylelint Config for GSC Basic Team
DO NOT use it in your own project if you don't know what it's for
说明
通过此拓展共享配置快速开始项目配置,内置支持Vue SFC
、Less
、HTML CSS
的检查。
使用
Stylelint v16.9.0+ is now required.
pnpm i @gsc-basic/stylelint-config stylelint -D
// stylelint.config.mjs
export default {
root: true,
extends: ['@gsc-basic/stylelint-config'],
};
// package.json
{
"scripts": {
"lint:stylelint": "stylelint \"**/*.{vue,less,postcss,css}\" --fix"
}
}
将依赖项提升到根模块目录,保证命令可以正常执行
# .npmrc
public-hoist-pattern[]=*postcss*
ignore
项目根目录添加 .stylelintignore
dist
public
__tests__
coverage
lint-staged支持
pnpm i lint-staged -D
// package.json
{
"scripts": {
"lint-staged": "lint-staged"
},
"lint-staged": {
"*.{css,less,scss,postcss,vue}": [
"stylelint --fix"
]
}
}
# .husky/pre-commit
npm run lint-staged
echo Run pre-commit hook done.
VS code支持
// .vscode/settings.json
{
"stylelint.packageManager": "pnpm",
"stylelint.validate": ["vue", "css", "less", "postcss", "scss"]
}