Skip to content

Add no-unused-state#1103

Merged
ljharb merged 6 commits intojsx-eslint:masterfrom
wbinnssmith:wbinnssmith/no-unused-state
Jul 21, 2017
Merged

Add no-unused-state#1103
ljharb merged 6 commits intojsx-eslint:masterfrom
wbinnssmith:wbinnssmith/no-unused-state

Conversation

@wbinnssmith
Copy link
Copy Markdown
Contributor

Link to significant commit is here

This adds a new rule, react/no-unused-state, which discovers state fields in a React component and warns if any of them are never read. It was developed internally at Facebook by @rjbailey and has been in use throughout Facebook's JS for a couple months now. It was written against a modern version of node, so has been rebased on @ljharb's branch dropping support for node < 4.

It currently supports es2015 classes extending React.Component (no support currently for React.createClass()) and can detect when state is as this.state = {}, assigning state in a property initializer, and when calling this.setState().

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

6 participants