number-max-precision
限制数字中允许的小数位数。
¥Limit the number of decimal places allowed in numbers.
a { top: 3.245634px; }
/** ↑
* This decimal place */
message
次要选项 可以接受该规则的参数。
¥The message
secondary option can accept the arguments of this rule.
选项
¥Options
int
:允许的最大小数位数。
¥int
: Maximum number of decimal places allowed.
例如,对于 2
:
¥For example, with 2
:
以下模式被视为问题:
¥The following patterns are considered problems:
a { top: 3.245px; }
a { top: 3.245634px; }
@media (min-width: 3.234em) {}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { top: 3.24px; }
@media (min-width: 3.23em) {}
可选的辅助选项
¥Optional secondary options
ignoreProperties: ["/regex/", /regex/, "string"]
忽略指定属性的数字精度。
¥Ignore the precision of numbers for the specified properties.
例如,0
。
¥For example, with 0
.
鉴于:
¥Given:
["transition"]
以下模式被视为问题:
¥The following patterns are considered problems:
a { top: 10.5px; }
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { transition: all 4.5s ease; }
ignoreUnits: ["/regex/", /regex/, "string"]
对于具有指定单位的值,忽略数字的精度。
¥Ignore the precision of numbers for values with the specified units.
例如,2
。
¥For example, with 2
.
鉴于:
¥Given:
["/^my-/", "%"]
以下模式被视为问题:
¥The following patterns are considered problems:
a { top: 3.245px; }
a { top: 3.245634px; }
@media (min-width: 3.234em) {}
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { top: 3.245%; }
@media (min-width: 3.23em) {}
a {
width: 10.5432%;
}
a { top: 3.245my-unit; }
a {
width: 10.989my-other-unit;
}
insideFunctions: {"/regex/": int, /regex/: int, "string": int}
insideFunctions
选项可以更改指定功能的主选项值。
¥The insideFunctions
option can change a primary option value for specified functions.
例如,2
。
¥For example, with 2
.
鉴于:
¥Given:
{ "/^(oklch|oklab|lch|lab)$/": 4 }
以下模式被视为问题:
¥The following patterns are considered problems:
a { color: rgb(127.333 0 0); }
a { color: rgb(calc(127.333 / 3) 0 0); }
以下模式不被视为问题:
¥The following patterns are not considered problems:
a { color: oklch(0.333 0 0); }
a { color: lab(0.3333 0 0); }
a { color: oklab(calc(127.333 / 3) 0 0); }