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

Update no-typos rule to check static lifecycle methods #2006

Merged
merged 2 commits into from Dec 28, 2019

Conversation

@bsonntag
Copy link
Contributor

bsonntag commented Oct 5, 2018

This updates the "no-typos" rule so that it checks for lifecycle methods that should be static, like getDerivedStateFromProps.

Closes #1999

lib/rules/no-typos.js Outdated Show resolved Hide resolved
}, {
code: `
class Hello extends React.Component {
getDerivedStateFromProps() { }

This comment has been minimized.

Copy link
@ljharb

ljharb Oct 5, 2018

Collaborator

let's please add a "valid" rule for static getDerivedStateFromProps, and also an invalid one for static getDERIVEDStateFromProps :-)

This comment has been minimized.

Copy link
@bsonntag

bsonntag Oct 10, 2018

Author Contributor

I added a test to check that static getDerivedStateFromProps is valid.

Regarding the second, there is already a test that checks static GetDerivedStateFromProps is invalid. Is it necessary to check static getDERIVEDStateFromProps too?

This comment has been minimized.

Copy link
@ljharb

ljharb Oct 10, 2018

Collaborator

as long as the checks cover a) the proper spelling and capitalization, b) any miscapitalization, c) any misspelling, and then those three with 1) static and 2) instance, then we should be good.

@bsonntag bsonntag closed this Oct 16, 2019
@ljharb ljharb reopened this Oct 16, 2019
@ljharb
Copy link
Collaborator

ljharb commented Dec 13, 2019

@bsonntag i've rebased this; the tests are still failing. are you still interested in completing this PR?

@bsonntag
Copy link
Contributor Author

bsonntag commented Dec 13, 2019

@ljharb not really, sorry.

@ljharb
ljharb approved these changes Dec 27, 2019
ljharb and others added 2 commits Dec 27, 2019
This updates the `no-typos` rule so that it checks for lifecycle methods that should be static, like `getDerivedStateFromProps`.
@ljharb ljharb merged commit c1ed90e into yannickcr:master Dec 28, 2019
2 of 3 checks passed
2 of 3 checks passed
continuous-integration/travis-ci/push The Travis CI build is in progress
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.005%) to 97.532%
Details
@ljharb ljharb added the enhancement label Dec 28, 2019
@bsonntag bsonntag deleted the bsonntag:enhancement/static-get-derived-state-from-props branch Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.