Content-Length: 272791 | pFad | https://redirect.github.com/jsx-eslint/eslint-plugin-react/issues/1361

67 `no-unused-state` rule doesn't handle dynamic keys · Issue #1361 · jsx-eslint/eslint-plugin-react · GitHub
Skip to content

no-unused-state rule doesn't handle dynamic keys #1361

@EvHaus

Description

@EvHaus

@wbinnssmith The following code:

_handleUpdate = (stateName, active) => {
	this.setState({[stateName]: active});
};

Gives out an Unused state field: 'stateName' error from the no-unused-state rule.

I think it's probably best to have no-unused-state rule ignore dynamic object keys since it will be too difficult to detect whether or not they're really being used. But at the very least, it shouldn't use the variable name as the key to look for.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: https://redirect.github.com/jsx-eslint/eslint-plugin-react/issues/1361

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy