Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rule proposal: no-useless-scu #985

Closed
nkt opened this issue Nov 30, 2016 · 4 comments
Closed

Rule proposal: no-useless-scu #985

nkt opened this issue Nov 30, 2016 · 4 comments
Labels

Comments

@nkt
Copy link

nkt commented Nov 30, 2016

shouldComponentUpdate method is useless when component extending PureComponent.

@ljharb
Copy link
Member

ljharb commented Nov 30, 2016

It's worth noting that I think it will actually work - it just means there's no point in it extending PureComponent then. I'm 👍 on this rule.

@jseminck
Copy link
Contributor

I'll take a look at this rule, since it was just recently requested again in #1217

It looks pretty easy to add:

  • Validate the MethodDefinition name
  • Validate that the method is declared in a PureComponent (for which a helper already exists)

Probably will need some help with the actual rule name and errors + docs. I suppose no-useless-scu is not a good name, as we want to warn the user not to extend React.PureComponent when they want to override shouldComponentUpdate?

@jseminck
Copy link
Contributor

Nevermind. There is a PR already. Missed it.

@alexzherdev
Copy link
Contributor

Fixed via #1084.

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

No branches or pull requests

4 participants