Skip to content

Latest commit

 

History

History
44 lines (31 loc) · 946 Bytes

case-block.md

File metadata and controls

44 lines (31 loc) · 946 Bytes

cupcake/case-block

Enforces block statements in case blocks

  • ⭐️ This rule is included in plugin:cupcake/recommended preset.
  • ✒️ The --fix option on the command line can automatically fix some of the problems reported by this rule.

Enforces block statements in case blocks.

Rule Details

This rule is a stricter version of no-case-declarations, to always use blocks in case statements

Examples of incorrect code:

/*eslint cupcake/case-block: error */

switch (foo) {
    case 1:
        break;
}

Examples of correct code:

/*eslint cupcake/case-block: error */

switch (foo) {
    case 1: {
        break;
    }
}

Options

Nothing.

Implementation