eslint-react
eslint-react copied to clipboard
[feat] New rule `no-explict-spread-props`
Describe the problem
<a
className={styles.link}
{...{
href: props.href,
rel: 'noopener noreferrer',
target: '_blank',
}}
{...props}
>
{label}
</a>
Describe the solution you'd like
This kind of code should be forbidden and should be auto fixed to
<a
className={styles.link}
href={props.href}
rel="noopener noreferrer"
target="_blank"
{...props}
>
{label}
</a>
Alternatives considered
No response
Additional context
This should be allowed:
<Comp
{...(
props.a ? { b: 'c' } : {}
)}
{...props}
/>