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

False positive no-unreachable catch in generator #12880

Closed
etienne-dldc opened this issue Feb 6, 2020 · 1 comment · Fixed by #12897
Closed

False positive no-unreachable catch in generator #12880

etienne-dldc opened this issue Feb 6, 2020 · 1 comment · Fixed by #12897
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly help wanted The team would welcome a contribution from the community for this issue rule Relates to ESLint's core rules

Comments

@etienne-dldc
Copy link

The no-unreachable rule does not understand that yield can throw an error an report an error.

Here is small repro:

/*eslint no-unreachable: "error"*/

function* generator() {
  try {
    yield 1;
    yield 2;
    return 3;
  } catch (err) { // eslint warn about the catch being unreachable
    return err;
  }
}

var gen = generator();
gen.throw(5) // this will run the code in the catch

Online demo

@etienne-dldc etienne-dldc added bug ESLint is working incorrectly triage An ESLint team member will look at this issue soon labels Feb 6, 2020
@kaicataldo kaicataldo added accepted There is consensus among the team that this change meets the criteria for inclusion rule Relates to ESLint's core rules and removed triage An ESLint team member will look at this issue soon labels Feb 7, 2020
@kaicataldo
Copy link
Member

Thanks for reporting this. Agreed that this is a bug. Documentation describing this behavior can be found here.

@kaicataldo kaicataldo added the help wanted The team would welcome a contribution from the community for this issue label Feb 7, 2020
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Aug 14, 2020
@eslint-deprecated eslint-deprecated bot added the archived due to age This issue has been archived; please open a new issue for any further discussion label Aug 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
accepted There is consensus among the team that this change meets the criteria for inclusion archived due to age This issue has been archived; please open a new issue for any further discussion bug ESLint is working incorrectly help wanted The team would welcome a contribution from the community for this issue rule Relates to ESLint's core rules
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants