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

Add new rule for getDerivedStateFromProps #1999

Closed
dotterian opened this issue Sep 26, 2018 · 1 comment · Fixed by #2006
Closed

Add new rule for getDerivedStateFromProps #1999

dotterian opened this issue Sep 26, 2018 · 1 comment · Fixed by #2006

Comments

@dotterian
Copy link

React enforces getDerivedStateFromProps to be static method.
When I use it as instance method i get this error in browser
screenshot from 2018-09-27 00-59-33

It would be great if eslint could check for this error and warn me in case I forget to place "static" before my "getDerivedStateFromProps".

I'd write this rule myself but I don't have enough free time and lack knowledge of how to write eslint rules properly.

@ljharb
Copy link
Member

ljharb commented Sep 26, 2018

That seems reasonable (although your tests should have caught that too). Seems like something no-typos could handle?

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

Successfully merging a pull request may close this issue.

2 participants