@ db-ux/ 核心风格林特
验证您( S) CSS 代码中对 DB UX 的正确使用 .
安装
npm install stylelint @db-ux/core-stylelint --save-dev
说明: 我们建议安装
stylelint-config-standard, (中文(简体) ),stylelint-use-logical打开@double-great/stylelint-a11y还有.
使用量
将此添加到您的 .stylelintrc.json 配置文件 :
{
"plugins": [
...
"@db-ux/core-stylelint"
]
}
规则
启用您内部的规则 .stylelintrc.json 改为:
{
rules: {
"db-ux/use-spacings": [true], // margins, paddings, gaps
"db-ux/use-sizing": [true], // height, width, block-size, inline-size
"db-ux/use-border-width": [true], // border-width & border
"db-ux/use-border-radius": [true], // border-radius
"db-ux/use-border-color": [true] // border-color & border
}
}
其他设置
每个规则都有一些额外的设置,可以适用于 .stylelintrc.json数字 :
{
rules: {
"db-ux/use-xxx": [
true,
{
allowCalc: true, // allow all calc() functions - they are hard to lint
ignore: ["test.scss"], // ignore specific files
allow: {
// allow additional values e.g. for SASS or exceptions/workarounds
startsWith: ["map.get"],
includes: ["--custom-gap"],
exact: ["$custom-padding"]
}
}
]
}
}