]>
Commit | Line | Data |
---|---|---|
8f9d1d4d DC |
1 | --- |
2 | title: space-return-throw-case | |
eb39fafa | 3 | |
8f9d1d4d DC |
4 | --- |
5 | ||
6 | Requires spaces after `return`, `throw`, and `case` keywords. | |
7 | ||
8 | (removed) This rule was **removed** in ESLint v2.0 and **replaced** by the [keyword-spacing](keyword-spacing) rule. | |
eb39fafa | 9 | |
f2a92ac6 | 10 | (fixable) The `--fix` option on the [command line](../use/command-line-interface#--fix) automatically fixed problems reported by this rule. |
eb39fafa DC |
11 | |
12 | Require spaces following `return`, `throw`, and `case`. | |
13 | ||
14 | ## Rule Details | |
15 | ||
16 | Examples of **incorrect** code for this rule: | |
17 | ||
8f9d1d4d DC |
18 | ::: incorrect |
19 | ||
eb39fafa DC |
20 | ```js |
21 | /*eslint space-return-throw-case: "error"*/ | |
22 | ||
23 | throw{a:0} | |
24 | ||
25 | function f(){ return-a; } | |
26 | ||
27 | switch(a){ case'a': break; } | |
28 | ``` | |
29 | ||
8f9d1d4d DC |
30 | ::: |
31 | ||
eb39fafa DC |
32 | Examples of **correct** code for this rule: |
33 | ||
8f9d1d4d DC |
34 | ::: correct |
35 | ||
eb39fafa DC |
36 | ```js |
37 | /*eslint space-return-throw-case: "error"*/ | |
38 | ||
39 | throw {a: 0}; | |
40 | ||
41 | function f(){ return -a; } | |
42 | ||
43 | switch(a){ case 'a': break; } | |
44 | ``` | |
8f9d1d4d DC |
45 | |
46 | ::: |