sbdchd / eslint-plugin-cake

:cake: Sweet rules for ESLint
MIT License
1 stars 0 forks source link

require object destructuring unpacks all values from type #7

Closed sbdchd closed 3 years ago

sbdchd commented 3 years ago

This might only make sense for react specific stuff, but if we have a user defined type for the params Foo, then we want to to ensure that we unpack all the params, otherwise there can be unused args to the component.

type FooParams = {
  a: string
  b: string
  c: string
}
// error since we didn't unpack `c`
function Foo({ a, b }: FooParams) {}
// ok
function Foo({ a, b, ...rest}: FooParams) {}
// ok
function Foo({ a, b, c}: FooParams) {}
sbdchd commented 3 years ago

fixed in 0.3.0