unit-no-unknown
禁止未知单位。
¥Disallow unknown units.
a { width: 100pixels; }
/** ↑
* These units */
此规则认为 CSS 规范中定义的单位(直至并包括编辑草稿)是已知的。
¥This rule considers units defined in the CSS Specifications, up to and including Editor's Drafts, to be known.
message
次要选项 可以接受该规则的参数。
¥The message
secondary option can accept the arguments of this rule.
选项
¥Options
true
以下模式被视为问题:
¥The following patterns are considered problems:
a {
width: 10pixels;
}
a {
width: calc(10px + 10pixels);
}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
width: 10px;
}
a {
width: 10Px;
}
a {
width: 10pX;
}
a {
width: calc(10px + 10px);
}
可选的辅助选项
¥Optional secondary options
ignoreUnits: ["/regex/", /regex/, "string"]
鉴于:
¥Given:
["/^--foo-/", "--bar"]
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
width: 10--foo--baz;
}
a {
width: 10--bar;
}
ignoreFunctions: ["/regex/", /regex/, "string"]
鉴于:
¥Given:
["foo", "/^my-/", "/^YOUR-/i"]
以下模式不被视为问题:
¥The following patterns are not considered problems:
a {
width: foo(1x);
}
a {
width: my-func(1x);
}
a {
width: YoUr-func(1x);
}