no-unused-state
rule doesn't handle dynamic keys #1361
Closed
Description
opened on Aug 11, 2017
@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.
Activity