【问题标题】:How to lint typos in color names in stylelint?如何在 stylelint 中检查颜色名称中的拼写错误?
【发布时间】:2018-07-10 10:57:22
【问题描述】:

当我在命名颜色中有错字时,是否可以让 stylelint 检测到?比如检测到color: pruple是错误的,真正的颜色名称是purple。

到目前为止,我只能找到强制所有颜色为 hex/alpha/named 的规则,但没有检查来验证实际的命名值。

【问题讨论】:

    标签: stylelint


    【解决方案1】:

    当我在命名颜色中有错字时,是否可以让 stylelint 检测到?

    是的,通过使用csstree-validator 插件。它将验证声明的属性-值对,包括那些值可以包含<color> types。

    {
      "plugins": [
        "stylelint-csstree-validator"
      ],
      "rules": {
        "csstree/validator": true
      }
    }
    

    【讨论】:

      猜你喜欢
      • 2010-09-20
      • 2016-01-15
      • 1970-01-01
      • 2011-02-15
      • 2016-10-27
      • 1970-01-01
      • 1970-01-01
      • 2012-09-04
      • 2015-02-08
      相关资源
      最近更新 更多