1 # Disallow or enforce spaces inside of blocks after opening block and before closing block (block-spacing)
5 This rule enforces consistent spacing inside an open block token and the next token on the same line. This rule also enforces consistent spacing inside a close block token and previous token on the same line.
9 This rule has a string option:
11 * `"always"` (default) requires one or more spaces
12 * `"never"` disallows spaces
16 Examples of **incorrect** code for this rule with the default `"always"` option:
19 /*eslint block-spacing: "error"*/
21 function foo() {return true;}
23 function baz() {let i = 0;
28 static {this.bar = 0;}
32 Examples of **correct** code for this rule with the default `"always"` option:
35 /*eslint block-spacing: "error"*/
37 function foo() { return true; }
41 static { this.bar = 0; }
47 Examples of **incorrect** code for this rule with the `"never"` option:
50 /*eslint block-spacing: ["error", "never"]*/
52 function foo() { return true; }
56 static { this.bar = 0; }
60 Examples of **correct** code for this rule with the `"never"` option:
63 /*eslint block-spacing: ["error", "never"]*/
65 function foo() {return true;}
69 static {this.bar = 0;}
75 If you don't want to be notified about spacing style inside of blocks, you can safely disable this rule.