Eslint: Indent rule: missing option to enforce indentation of break

Created on 8 Feb 2015  路  3Comments  路  Source: eslint/eslint

The indent rule recognizes if a break within of a switch statement should be indented or not.
The following two examples are both valid:

switch (a) {
case '1':
    b();
break;
default:
    c();
break;
}
switch (a) {
case '1':
    b();
    break;
default:
    c();
    break;
}

This one fails:

switch (a) {
case '1':
    b();
break;
default:
    c();
    break;
}
test.js
  7:0  error  Expected indentation of 0 characters  indent

What I want is an option to enforce a consistent indentation of break.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

accepted archived due to age bug rule

All 3 comments

As per the rewrite if the indent rule, break statements get indented to the same level as the content body of the case statement by default.
As per this issue, do we need something different or is it ok to close this issue.

For me it would be ok to close this issue. I don't think I've ever seen code where break has the same indentation as the case label.

closing based on the above discussion.

Was this page helpful?
0 / 5 - 0 ratings