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-fallthrough fails to warn about missing break inside braces #4652

Closed
mminer opened this issue Dec 9, 2015 · 3 comments
Closed

no-fallthrough fails to warn about missing break inside braces #4652

mminer opened this issue Dec 9, 2015 · 3 comments
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon

Comments

@mminer
Copy link

mminer commented Dec 9, 2015

With the following code, the no-fallthrough rule correctly warns about the missing break statement.

let foo = 'bar';

switch (foo) {
  case 'bar':
    console.log('Reached matching case.');

  default:
    console.log('Reached default case.');
}

Expected a "break" statement before "default"

However, when braces surround the case statements, no-fallthrough fails to report the problem, even though all cases are indeed executed.

let foo = 'bar';

switch (foo) {
  case 'bar': {
    console.log('Reached matching case.');
  }

  default: {
    console.log('Reached default case.');
  }
}

Using ESLint v1.10.3.

@eslintbot
Copy link

@mminer Thanks for the issue! If you're reporting a bug, please be sure to include:

  1. The version of ESLint you are using (run eslint -v)
  2. What you did (the source code and ESLint configuration)
  3. The actual ESLint output complete with numbers
  4. What you expected to happen instead

Requesting a new rule? Please see Proposing a New Rule for instructions.

@eslintbot eslintbot added the triage An ESLint team member will look at this issue soon label Dec 9, 2015
@nzakas
Copy link
Member

nzakas commented Dec 9, 2015

I believe this is already fixed on master, can you try it out?

@mminer
Copy link
Author

mminer commented Dec 9, 2015

Yep you're right, the problem is fixed in master. Glad to hear it. I'll go ahead and close this issue.

@mminer mminer closed this as completed Dec 9, 2015
@eslint-deprecated eslint-deprecated bot locked and limited conversation to collaborators Feb 6, 2018
@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 Feb 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived due to age This issue has been archived; please open a new issue for any further discussion triage An ESLint team member will look at this issue soon
Projects
None yet
Development

No branches or pull requests

3 participants