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

[eslint-plugin-react-hooks] useReducer purity warning #18057

Closed
hug0b opened this issue Feb 17, 2020 · 2 comments
Closed

[eslint-plugin-react-hooks] useReducer purity warning #18057

hug0b opened this issue Feb 17, 2020 · 2 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@hug0b
Copy link

hug0b commented Feb 17, 2020

Apparently useReducer shouldn't perform side effects like firing async actions or updating state, so I think there should be an eslint warning for that.

@hug0b hug0b added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Feb 17, 2020
@vkurchatkin
Copy link

It's not possible to detect side effects with ESLint:

function reducer() {
   // ...
   let foo = bar(); // does bar trigger an effect? No way to tell
  // ...
}

@sophiebits
Copy link
Collaborator

As vkurchatkin says, there isn't a good way to lint for this. Thanks for the idea though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

3 participants