Skip to content

Commit

Permalink
Docs: Improve examples for no-case-declarations (fixes #6716) (#7920)
Browse files Browse the repository at this point in the history
  • Loading branch information
venikx authored and vitorbal committed Jan 18, 2017
1 parent 7e04b33 commit 3c1e63b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/rules/no-case-declarations.md
Expand Up @@ -39,7 +39,11 @@ Examples of **correct** code for this rule:
/*eslint no-case-declarations: "error"*/
/*eslint-env es6*/

// Declarations outside switch-statements are valid
const a = 0;

switch (foo) {
// The following case clauses are wrapped into blocks using brackets
case 1: {
let x = 1;
break;
Expand All @@ -52,6 +56,10 @@ switch (foo) {
function f() {}
break;
}
case 4:
// Declarations using var without brackets are valid due to function-scope hoisting
var z = 4;
break;
default: {
class C {}
}
Expand Down

0 comments on commit 3c1e63b

Please sign in to comment.