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 #14038

Closed
steida opened this issue Oct 30, 2018 · 2 comments
Closed

eslint-plugin-react-hooks #14038

steida opened this issue Oct 30, 2018 · 2 comments

Comments

@steida
Copy link

steida commented Oct 30, 2018

function Editor({ data: { page } }: EditorProps) {
  if (page == null) throw Error('missing page data in editor')
  const [editorValue, setEditorValue] = useState(() => {
}

I believe this should be a valid case, because throw.

@steida
Copy link
Author

steida commented Oct 30, 2018

Hmm, I just realized throw should not be used for valid business case (GraphQL endpoint was updated). Render nothing (and request app update) is the correct approach.

@steida steida closed this as completed Oct 30, 2018
@sophiebits
Copy link
Collaborator

I think we shouldn't warn on this.

@sophiebits sophiebits reopened this Oct 30, 2018
sophiebits added a commit to sophiebits/react that referenced this issue Oct 30, 2018
Seems like this should be OK. Fixes facebook#14038.

Now when tracking paths, we completely ignore segments that end in a throw. In https://eslint.org/docs/developer-guide/code-path-analysis I don't see a way to detect throws other than manually tracking them, so that's what I've done.
sophiebits added a commit to sophiebits/react that referenced this issue Oct 30, 2018
Seems like this should be OK. Fixes facebook#14038.

Now when tracking paths, we completely ignore segments that end in a throw. In https://eslint.org/docs/developer-guide/code-path-analysis I don't see a way to detect throws other than manually tracking them, so that's what I've done.
sophiebits added a commit to sophiebits/react that referenced this issue Oct 31, 2018
Seems like this should be OK. Fixes facebook#14038.

Now when tracking paths, we completely ignore segments that end in a throw. In https://eslint.org/docs/developer-guide/code-path-analysis I don't see a way to detect throws other than manually tracking them, so that's what I've done.
sophiebits added a commit that referenced this issue Oct 31, 2018
Seems like this should be OK. Fixes #14038.

Now when tracking paths, we completely ignore segments that end in a throw.
jetoneza pushed a commit to jetoneza/react that referenced this issue Jan 23, 2019
Seems like this should be OK. Fixes facebook#14038.

Now when tracking paths, we completely ignore segments that end in a throw.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants