Skip to content

Allow _ to be an unused variable #800

@feross

Description

@feross

In React, it's common to do:

const { width, height, ...restProps } = props
return <div ...restProps>

This assigns all the properties of props except width and height to the <div>.

Currently standard warns about width and height being unused. Would be nice if we could assign these variables to _ and _2 to mark them as unused (since we can't assign them both to _ in one assignment).

const { width: _, height: _2, ...restProps } = props
return <div ...restProps>

@dcousens Didn't you say that you have a rule modification that you use for this purpose? Can you share it?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions