如何在 stylelint 中检查颜色名称中的拼写错误?
How to lint typos in color names in stylelint?
是否可以让 stylelint 检测到我在命名颜色中出现拼写错误?就像检测到 color: pruple
是错误的,真正的颜色名称是 purple
.
到目前为止,我只能找到强制所有颜色为 hex/alpha/named 的规则,但没有检查以验证实际命名的值。
Is it possible to have stylelint detect when I have a typo in a named color?
是的,通过使用 csstree-validator plugin. It will validate the property-value pairs of declarations, including those where the value can contain <color>
types。
{
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": true
}
}
是否可以让 stylelint 检测到我在命名颜色中出现拼写错误?就像检测到 color: pruple
是错误的,真正的颜色名称是 purple
.
到目前为止,我只能找到强制所有颜色为 hex/alpha/named 的规则,但没有检查以验证实际命名的值。
Is it possible to have stylelint detect when I have a typo in a named color?
是的,通过使用 csstree-validator plugin. It will validate the property-value pairs of declarations, including those where the value can contain <color>
types。
{
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": true
}
}