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

no-access-state-in-setstate makes eslint crash #1657

Closed
jer-sen opened this issue Jan 26, 2018 · 3 comments
Closed

no-access-state-in-setstate makes eslint crash #1657

jer-sen opened this issue Jan 26, 2018 · 3 comments
Assignees

Comments

@jer-sen
Copy link

jer-sen commented Jan 26, 2018

Here property.key can be not an object (null ?): https://github.com/yannickcr/eslint-plugin-react/blob/7b742d0ddecfdfb796a3705aae56e4534c9bb370/lib/rules/no-access-state-in-setstate.js#L151

In this case, eslint crashes...

@enrique-ramirez
Copy link

I'm having this same issue after upgrading to 7.6.0 from 7.5.1. It was working fine before and downgrading works for now.

Cannot read property 'name' of undefined
TypeError: Cannot read property 'name' of undefined
    at ObjectPattern.node.properties.forEach.property (/Users/enriqueramirez/Sites/aphrodite/node_modules/eslint-plugin-react/lib/rules/no-access-state-in-setstate.js:151:28)
    at Array.forEach (<anonymous>)
    at ObjectPattern (/Users/enriqueramirez/Sites/aphrodite/node_modules/eslint-plugin-react/lib/rules/no-access-state-in-setstate.js:150:25)
    at listeners.(anonymous function).forEach.listener (/Users/enriqueramirez/Sites/aphrodite/node_modules/eslint/lib/util/safe-emitter.js:47:58)
    at Array.forEach (<anonymous>)
    at Object.emit (/Users/enriqueramirez/Sites/aphrodite/node_modules/eslint/lib/util/safe-emitter.js:47:38)
    at NodeEventGenerator.applySelector (/Users/enriqueramirez/Sites/aphrodite/node_modules/eslint/lib/util/node-event-generator.js:251:26)
    at NodeEventGenerator.applySelectors (/Users/enriqueramirez/Sites/aphrodite/node_modules/eslint/lib/util/node-event-generator.js:280:22)
    at NodeEventGenerator.enterNode (/Users/enriqueramirez/Sites/aphrodite/node_modules/eslint/lib/util/node-event-generator.js:294:14)
    at CodePathAnalyzer.enterNode (/Users/enriqueramirez/Sites/aphrodite/node_modules/eslint/lib/code-path-analysis/code-path-analyzer.js:608:23)

Not sure what more information I could provide that could be useful.

@ljharb
Copy link
Member

ljharb commented Jan 27, 2018

What would be most useful would be providing the code that causes the no-access-state-in-setstate rule to crash.

@jer-sen
Copy link
Author

jer-sen commented Jan 29, 2018

Thanks @ljharb !

This was referenced Sep 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants