1 | # block-closing-brace-newline-before
|
2 |
|
3 | Require a newline or disallow whitespace before the closing brace of blocks.
|
4 |
|
5 |
|
6 | ```css
|
7 | a { color: pink;
|
8 | }
|
9 | /** ↑
|
10 | * The newline before this brace */
|
11 | ```
|
12 |
|
13 | The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
|
14 |
|
15 | ## Options
|
16 |
|
17 | `string`: `"always"|"always-multi-line"|"never-multi-line"`
|
18 |
|
19 | ### `"always"`
|
20 |
|
21 | There _must always_ be a newline before the closing brace.
|
22 |
|
23 | The following patterns are considered violations:
|
24 |
|
25 |
|
26 | ```css
|
27 | a { color: pink;}
|
28 | ```
|
29 |
|
30 | The following patterns are _not_ considered violations:
|
31 |
|
32 |
|
33 | ```css
|
34 | a { color: pink;
|
35 | }
|
36 | ```
|
37 |
|
38 |
|
39 | ```css
|
40 | a {
|
41 | color: pink;
|
42 | }
|
43 | ```
|
44 |
|
45 | ### `"always-multi-line"`
|
46 |
|
47 | There _must always_ be a newline before the closing brace in multi-line blocks.
|
48 |
|
49 | The following patterns are considered violations:
|
50 |
|
51 |
|
52 | ```css
|
53 | a {
|
54 | color: pink;}
|
55 | ```
|
56 |
|
57 | The following patterns are _not_ considered violations:
|
58 |
|
59 |
|
60 | ```css
|
61 | a { color: pink; }
|
62 | ```
|
63 |
|
64 |
|
65 | ```css
|
66 | a { color: pink;
|
67 | }
|
68 | ```
|
69 |
|
70 | ### `"never-multi-line"`
|
71 |
|
72 | There _must never_ be whitespace before the closing brace in multi-line blocks.
|
73 |
|
74 | The following patterns are considered violations:
|
75 |
|
76 |
|
77 | ```css
|
78 | a {
|
79 | color: pink; }
|
80 | ```
|
81 |
|
82 | The following patterns are _not_ considered violations:
|
83 |
|
84 |
|
85 | ```css
|
86 | a { color: pink; }
|
87 | ```
|
88 |
|
89 |
|
90 | ```css
|
91 | a {
|
92 | color: pink;}
|
93 | ```
|