sindresorhus/eslint-plugin-unicorn

`no-useless-fallback-in-spread`: Support ternary

Closed

#1,861 opened on Jul 19, 2022

 (4 comments) (7 reactions) (0 assignees)JavaScript (468 forks)user submission
enhancementhelp wanted

Repository metrics

Stars
 (5,022 stars)
PR merge metrics
 (Avg merge 1d 16h) (399 merged PRs in 30d)

Description

The rule currently does not detect ternary like this:

{...(foo ? {bar: true} : {})}

This can be safely be reduced to

{...(foo && {bar: true})}

Contributor guide