1 | # block-closing-brace-space-before
|
2 |
|
3 | Require a single space or disallow whitespace before the closing brace of blocks.
|
4 |
|
5 | ```css
|
6 | a { color: pink; }
|
7 | /** ↑
|
8 | * The space before this brace */
|
9 | ```
|
10 |
|
11 | The `--fix` option on the [command line](../../../docs/user-guide/cli.md#autofixing-errors) can automatically fix all of the problems reported by this rule.
|
12 |
|
13 | ## Options
|
14 |
|
15 | `string`: `"always"|"never"|"always-single-line"|"never-single-line"|"always-multi-line"|"never-multi-line"`
|
16 |
|
17 | ### `"always"`
|
18 |
|
19 | There *must always* be a single space before the closing brace.
|
20 |
|
21 | The following patterns are considered violations:
|
22 |
|
23 | ```css
|
24 | a { color: pink;}
|
25 | ```
|
26 |
|
27 | ```css
|
28 | a
|
29 | { color: pink;}
|
30 | ```
|
31 |
|
32 | The following patterns are *not* considered violations:
|
33 |
|
34 | ```css
|
35 | a { color: pink; }
|
36 | ```
|
37 |
|
38 | ```css
|
39 | a {
|
40 | color: pink; }
|
41 | ```
|
42 |
|
43 | ### `"never"`
|
44 |
|
45 | There *must never* be whitespace before the closing brace.
|
46 |
|
47 | The following patterns are considered violations:
|
48 |
|
49 | ```css
|
50 | a { color: pink; }
|
51 | ```
|
52 |
|
53 | ```css
|
54 | a
|
55 | { color: pink; }
|
56 | ```
|
57 |
|
58 | The following patterns are *not* considered violations:
|
59 |
|
60 | ```css
|
61 | a{ color: pink;}
|
62 | ```
|
63 |
|
64 | ```css
|
65 | a{
|
66 | color: pink;}
|
67 | ```
|
68 |
|
69 | ### `"always-single-line"`
|
70 |
|
71 | There *must always* be a single space before the closing brace in single-line blocks.
|
72 |
|
73 | The following patterns are considered violations:
|
74 |
|
75 | ```css
|
76 | a { color: pink;}
|
77 | ```
|
78 |
|
79 | The following patterns are *not* considered violations:
|
80 |
|
81 | ```css
|
82 | a { color: pink; }
|
83 | ```
|
84 |
|
85 | ```css
|
86 | a {
|
87 | color: pink;}
|
88 | ```
|
89 |
|
90 | ### `"never-single-line"`
|
91 |
|
92 | There *must never* be whitespace before the closing brace in single-line blocks.
|
93 |
|
94 | The following patterns are considered violations:
|
95 |
|
96 | ```css
|
97 | a { color: pink; }
|
98 | ```
|
99 |
|
100 | The following patterns are *not* considered violations:
|
101 |
|
102 | ```css
|
103 | a { color: pink;}
|
104 | ```
|
105 |
|
106 | ```css
|
107 | a {
|
108 | color: pink; }
|
109 | ```
|
110 |
|
111 | ### `"always-multi-line"`
|
112 |
|
113 | There *must always* be a single space before the closing brace in multi-line blocks.
|
114 |
|
115 | The following patterns are considered violations:
|
116 |
|
117 | ```css
|
118 | a {
|
119 | color: pink;}
|
120 | ```
|
121 |
|
122 | The following patterns are *not* considered violations:
|
123 |
|
124 | ```css
|
125 | a { color: pink;}
|
126 | ```
|
127 |
|
128 | ```css
|
129 | a {
|
130 | color: pink; }
|
131 | ```
|
132 |
|
133 | ### `"never-multi-line"`
|
134 |
|
135 | There *must never* be whitespace before the closing brace in multi-line blocks.
|
136 |
|
137 | The following patterns are considered violations:
|
138 |
|
139 | ```css
|
140 | a {
|
141 | color: pink; }
|
142 | ```
|
143 |
|
144 | The following patterns are *not* considered violations:
|
145 |
|
146 | ```css
|
147 | a { color: pink; }
|
148 | ```
|
149 |
|
150 | ```css
|
151 | a {
|
152 | color: pink;}
|
153 | ```
|