noReactSpecificProps
¥Summary
-
规则生效日期:
v1.7.2¥Rule available since:
v1.7.2 -
诊断类别:
lint/suspicious/noReactSpecificProps¥Diagnostic Category:
lint/suspicious/noReactSpecificProps -
此规则包含 safe 修复程序。
¥This rule has a safe fix.
-
此规则的默认严重级别为 warning。
¥The default severity of this rule is warning.
-
此规则属于以下域:
¥This rule belongs to the following domains:
-
来源:
¥Sources:
-
与
solid/no-react-specific-props相同¥Same as
solid/no-react-specific-props -
与
qwik/no-react-props相同¥Same as
qwik/no-react-props
-
¥How to configure
{ "linter": { "rules": { "suspicious": { "noReactSpecificProps": "error" } } }}¥Description
防止使用 React 特定的 JSX 属性。
¥Prevents React-specific JSX properties from being used.
此规则适用于不使用 React 风格 prop 名称的基于 JSX 的框架(例如 Qwik、Solid 等)。
¥This rule is intended for use in JSX-based frameworks (such as Qwik, Solid, etc.) that do not use React-style prop names.
¥Examples
¥Invalid
<Hello className="John" />code-block.jsx:1:8 lint/suspicious/noReactSpecificProps FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
⚠ This JSX attribute is specific to React.
> 1 │ <Hello className=“John” />
│ ^^^^^^^^^
2 │
ℹ This attribute may not be supported by non-React frameworks, as it is not native to HTML.
> 1 │ <Hello className=“John” />
│ ^^^^^^^^^
2 │
ℹ Safe fix: Replace this attribute name with “class”
1 │ - <Hello·className=“John”·/>
1 │ + <Hello·class=“John”·/>
2 2 │
¥Valid
<Hello class="Doe" />¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号