noDuplicatedSpreadProps
Este conteúdo não está disponível em sua língua ainda.
Summary
Section titled “Summary”- Rule available since:
v2.3.8 - Diagnostic Category:
lint/nursery/noDuplicatedSpreadProps - This rule doesn’t have a fix.
- The default severity of this rule is information.
- This rule belongs to the following domains:
- Sources:
- Same as
react/jsx-props-no-spread-multi
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noDuplicatedSpreadProps": "error" } } }}Description
Section titled “Description”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.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”<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} />Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.