eslint-plugin-react
eslint-plugin-react copied to clipboard
Supporting async/await in `no-did-mount-setstate` rule
Pretty naive approach: checking if the call is in an async method and if an await is found before setState (going over tokens).
Fixes #1110.
Sure. Do you have some in mind?
Things mentioned in the linked issue; this.setState defined in a callback function before the first await, but not invoked or passed to anything prior to the first await; things like that.
That's much more difficult... Do you think we should use a different "entry" than what is currently used for this rule? I don't really have any experience or knowledge in AST so I think I'll need some help to continue
I feel like we may have to track all awaits inside cDM, as well as all this.setState calls, and after they’re all tracked, figure out which ones are a problem.
It’s certainly a very hard problem.