noInvalidDirectionInLinearGradient
¥Summary
-
规则生效日期:
v1.9.0¥Rule available since:
v1.9.0 -
诊断类别:
lint/correctness/noInvalidDirectionInLinearGradient¥Diagnostic Category:
lint/correctness/noInvalidDirectionInLinearGradient -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
¥How to configure
{ "linter": { "rules": { "correctness": { "noInvalidDirectionInLinearGradient": "error" } } }}¥Description
禁止线性梯度函数使用非标准方向值。
¥Disallow non-standard direction values for linear gradient functions.
有效且标准的方向值是以下之一:
¥A valid and standard direction value is one of the following:
-
一个角度
¥an angle
-
加上边或角(
to top、to bottom、to left、to right;to top right、to right top、to bottom left等)¥to plus a side-or-corner (
to top,to bottom,to left,to right;to top right,to right top,to bottom left, etc.)
一个常见的错误(匹配过时的非标准语法)是只使用 side-or-corner 而不使用前面的 to。
¥A common mistake (matching outdated non-standard syntax) is to use just a side-or-corner without the preceding to.
¥Examples
¥Invalid
.foo { background: linear-gradient(top, #fff, #000); }code-block.css:1:36 lint/correctness/noInvalidDirectionInLinearGradient ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unexpected nonstandard direction
> 1 │ .foo { background: linear-gradient(top, #fff, #000); }
│ ^^^
2 │
ℹ You should fix the direction value to follow the syntax.
ℹ See MDN web docs for more details.
.foo { background: linear-gradient(45, #fff, #000); }code-block.css:1:36 lint/correctness/noInvalidDirectionInLinearGradient ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Unexpected nonstandard direction
> 1 │ .foo { background: linear-gradient(45, #fff, #000); }
│ ^^
2 │
ℹ You should fix the direction value to follow the syntax.
ℹ See MDN web docs for more details.
¥Valid
.foo { background: linear-gradient(to top, #fff, #000); }.foo { background: linear-gradient(45deg, #fff, #000); }¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号