Skip to content

noDuplicateJsxProps

诊断类别:lint/suspicious/noDuplicateJsxProps

¥Diagnostic Category: lint/suspicious/noDuplicateJsxProps

自从:v1.0.0

¥Since: v1.0.0

来源:

¥Sources:

防止多次分配 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