Skip to content

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

@mminer

Description

@mminer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    archived due to ageThis issue has been archived; please open a new issue for any further discussiontriageAn ESLint team member will look at this issue soon

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions