Skip to content

Support braces for no-fallthrough #7889

@cowwoc

Description

@cowwoc

What version of ESLint are you using?
3.0.1
What rule do you want to change?
no-fallthrough
What code should be flagged as correct with this change?

/*eslint no-fallback: ["error", { "commentPattern": "[\\w\\s]*fallthrough" }]*/
var foo = ...;
switch(bar) {
    case 0: {
      if (typeof(foo) == 'string')
        return doSomething();
      // Otherwise, fallthrough
    }
    default:
      doSomethingElse();
}

What happens when the rule is applied to this code now?
Errors:
Expected a 'break' statement before 'default'.

... Basically I am asking for the rule to support case statements that contain braces.

Metadata

Metadata

Assignees

No one assigned

    Labels

    archived due to ageThis issue has been archived; please open a new issue for any further discussionenhancementThis change enhances an existing feature of ESLintevaluatingThe team will evaluate this issue to decide whether it meets the criteria for inclusionruleRelates to ESLint's core rules

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions