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