noImplicitBoolean
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/style/noImplicitBoolean¥Diagnostic Category:
lint/style/noImplicitBoolean -
此规则包含 safe 修复程序。
¥This rule has a safe fix.
-
此规则的默认严重级别为 information。
¥The default severity of this rule is information.
-
来源:
¥Sources:
-
¥Inspired from
react/jsx-boolean-value
-
¥How to configure
{ "linter": { "rules": { "style": { "noImplicitBoolean": "error" } } }}¥Description
禁止在 JSX 布尔属性上允许隐式 true 值
¥Disallow implicit true values on JSX boolean attributes
¥Examples
¥Invalid
<input disabled />code-block.jsx:1:8 lint/style/noImplicitBoolean FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Use explicit boolean values for boolean JSX props.
> 1 │ <input disabled />
│ ^^^^^^^^
2 │
ℹ Safe fix: Add explicit `true` literal for this attribute
1 │ <input·disabled={true}·/>
│ +++++++
¥Valid
<input disabled={false} /><input disabled={''} /><input disabled={0} /><input disabled={undefined} /><input disabled='false' />¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号