eslint-config-callstack icon indicating copy to clipboard operation
eslint-config-callstack copied to clipboard

fix: add missing ignoreRestSiblings to allow to omit values

Open zamotany opened this issue 3 years ago • 2 comments

Summary

Add missing ignoreRestSiblings to allow to omit values in destructuring assignment.

Without ignoreRestSiblings: true this code fails:

const { modalDialogs: _, ...rest } = (params ?? {}) as InternalParams;
// error  '_' is assigned a value but never used  @typescript-eslint/no-unused-vars

zamotany avatar Apr 21 '22 14:04 zamotany

Edit:

ignoreRestSiblings: true will not require values to have to be renamed to ^_, eg:

const { modalDialogs, ...rest } = (params ?? {}) as InternalParams;

will pass w/o errors.

zamotany avatar Apr 21 '22 15:04 zamotany

Will this ignore unused props when being unused as well?

function Component({ prop1, prop2 }: Props) { 
  return prop1 
}

thymikee avatar Apr 21 '22 16:04 thymikee