nzakas/eslint — pull request #24 by mduvall (2013-07-14 02:05:33+00:00)
Title: Rule to add no-fall-through

This partially addresses https://github.com/nzakas/eslint/issues/19, there's some hairiness here though:

1. The comments parsed by esprima aren't available next to their statement they are included with (example AST available (here)[http://esprima.org/demo/parse.html?code=switch%20(foo)%20%7B%0A%09case%20'bar'%3A%0A%09%09foo.mutate()%3B%0A%09%09%2F%2F%20fall-through%0A%09default%3A%0A%09%09foo.mutate()%3B%0A%7D).
2. This commit only catches the errors if the `break;` is not the last statement, it doesn't handle something like this:

```javascript
switch (foo) {
case 'bar':
if (foo.bar()) {
foo.qux();
break;
} else {
foo.quz();
break;
}
}
```
I'm not sure whether this rule should simply detect the `break;` as the last statement or be in the business of pulling apart the AST looking for a code path that doesn't end in a `break;`.