Перейти к содержимому

noDuplicatedSpreadProps

Это содержимое пока не доступно на вашем языке.

biome.json
{
"linter": {
"rules": {
"nursery": {
"noDuplicatedSpreadProps": "error"
}
}
}
}

Disallow JSX prop spreading the same identifier multiple times.

Enforces that any unique expression is only spread once. Generally spreading the same expression twice is an indicator of a mistake since any attribute between the spreads may be overridden when the intent was not to. Even when that is not the case this will lead to unnecessary computations being performed.

<div {...props} something="else" {...props} />
code-block.jsx:1:1 lint/nursery/noDuplicatedSpreadProps ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The expression props has spread more than once.

> 1 │ <div {…props} something=“else” {…props} />
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2 │

Spreading an expression more than once will lead to unnecessary computations being performed. Reduce spreads of this expression down to 1.

<div something="else" {...props} />