Skip to content

False positive in js/unused-local-variable with aliased destructuring assignments #664

@s0

Description

@s0

As detailed here: Shopify/quilt#434 (comment)

When doing object destructuring with new variable names, we're determining the name of the variable incorrectly, and selecting the name of the property from the object being destructured instead.

E.g:

const {foo: bar} = {foo: 'foo', bar: 'bar'}
// foo is undefined
// bar is now a constant variable

Example FP: https://lgtm.com/projects/g/Shopify/quilt/snapshot/b8540654494cf2f30293faccbaee3b4c19287e76/files/packages/react-google-analytics/src/GaJS.tsx#xf859505316cad831:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions