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

Fix crash in no-unused-prop-types #1545

Merged
merged 1 commit into from
Nov 18, 2017
Merged

Conversation

jomasti
Copy link
Contributor

@jomasti jomasti commented Nov 18, 2017

When checking props in setState updater functions, some assumptions were
being made about the props argument being defined.

Fixes #1542

@@ -949,7 +949,7 @@ module.exports = {
}

function handleSetStateUpdater(node) {
if (!node.params || !node.params.length || !inSetStateUpdater()) {
if (!node.params || !node.params.length || node.params.length < 2 || !inSetStateUpdater()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!node.params.length is node.params.length === 0, so this is now redundant with the "< 2" comparison. let's remove the former.

@ljharb ljharb added the bug label Nov 18, 2017
When checking props in setState updater functions, some assumptions were
being made about the props argument being defined.
@ljharb ljharb merged commit 56c0a0b into jsx-eslint:master Nov 18, 2017
@ljharb
Copy link
Member

ljharb commented Nov 18, 2017

@yannickcr this also should go in a v7.5.1, ASAP

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.

2 participants