noDuplicateJsxProps
¥Summary
-
规则生效日期:
v1.0.0¥Rule available since:
v1.0.0 -
诊断类别:
lint/suspicious/noDuplicateJsxProps¥Diagnostic Category:
lint/suspicious/noDuplicateJsxProps -
此规则为推荐规则,默认启用。
¥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:
-
与
react/jsx-no-duplicate-props相同¥Same as
react/jsx-no-duplicate-props
-
¥How to configure
{ "linter": { "rules": { "suspicious": { "noDuplicateJsxProps": "error" } } }}¥Description
防止多次分配 JSX 属性。
¥Prevents JSX properties to be assigned multiple times.
¥Examples
¥Invalid
<Hello name="John" name="John" />code-block.jsx:1:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ This JSX property is assigned multiple times.
> 1 │ <Hello name=“John” name=“John” />
│ ^^^^^^^^^^^
2 │
ℹ This attribute is assigned again here.
> 1 │ <Hello name=“John” name=“John” />
│ ^^^^^^^^^^^
2 │
<label xml:lang="en-US" xml:lang="en-US"></label>code-block.jsx:1:8 lint/suspicious/noDuplicateJsxProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ This JSX property is assigned multiple times.
> 1 │ <label xml:lang=“en-US” xml:lang=“en-US”></label>
│ ^^^^^^^^^^^^^^^^
2 │
ℹ This attribute is assigned again here.
> 1 │ <label xml:lang=“en-US” xml:lang=“en-US”></label>
│ ^^^^^^^^^^^^^^^^
2 │
¥Valid
<Hello firstname="John" lastname="Doe" /><label xml:lang="en-US" lang="en-US"></label>¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号