2 title: switch-colon-spacing
9 Spacing around colons improves readability of `case`/`default` clauses.
13 This rule controls spacing around colons of `case` and `default` clauses in `switch` statements.
14 This rule does the check only if the consecutive tokens exist on the same line.
16 This rule has 2 options that are boolean value.
20 "switch-colon-spacing": ["error", {"after": true, "before": false}]
24 * `"after": true` (Default) requires one or more spaces after colons.
25 * `"after": false` disallows spaces after colons.
26 * `"before": true` requires one or more spaces before colons.
27 * `"before": false` (Default) disallows before colons.
29 Examples of **incorrect** code for this rule:
34 /*eslint switch-colon-spacing: "error"*/
44 Examples of **correct** code for this rule:
49 /*eslint switch-colon-spacing: "error"*/
64 Examples of **incorrect** code for this rule with `{"after": false, "before": true}` option:
69 /*eslint switch-colon-spacing: ["error", {"after": false, "before": true}]*/
79 Examples of **correct** code for this rule with `{"after": false, "before": true}` option:
84 /*eslint switch-colon-spacing: ["error", {"after": false, "before": true}]*/
101 If you don't want to notify spacing around colons of switch statements, then it's safe to disable this rule.