1 | # block-closing-brace-empty-line-before
|
2 |
|
3 | Require or disallow an empty line before the closing brace of blocks.
|
4 |
|
5 |
|
6 | ```css
|
7 | a {
|
8 | color: pink;
|
9 | /* ← */
|
10 | } /* ↑ */
|
11 | /** ↑
|
12 | * This line */
|
13 | ```
|
14 |
|
15 | The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
|
16 |
|
17 | ## Options
|
18 |
|
19 | `string`: `"always-multi-line"|"never"`
|
20 |
|
21 | ### `always-multi-line`
|
22 |
|
23 | The following patterns are considered violations:
|
24 |
|
25 |
|
26 | ```css
|
27 | a {
|
28 | color: pink;
|
29 | }
|
30 | ```
|
31 |
|
32 | The following patterns are _not_ considered violations:
|
33 |
|
34 |
|
35 | ```css
|
36 | a {
|
37 | color: pink;
|
38 |
|
39 | }
|
40 | ```
|
41 |
|
42 |
|
43 | ```css
|
44 | a { color: pink; }
|
45 | ```
|
46 |
|
47 | ### `never`
|
48 |
|
49 | The following patterns are considered violations:
|
50 |
|
51 |
|
52 | ```css
|
53 | a {
|
54 | color: pink;
|
55 |
|
56 | }
|
57 | ```
|
58 |
|
59 | The following patterns are _not_ considered violations:
|
60 |
|
61 |
|
62 | ```css
|
63 | a {
|
64 | color: pink;
|
65 | }
|
66 | ```
|
67 |
|
68 |
|
69 | ```css
|
70 | a { color: pink; }
|
71 | ```
|
72 |
|
73 | ## Optional secondary options
|
74 |
|
75 | ### `except: ["after-closing-brace"]`
|
76 |
|
77 | When a rule is nested, `after-closing-brace` brace will reverse the primary option.
|
78 |
|
79 | For example, with `"never"` and `except: ["after-closing-brace"]`:
|
80 |
|
81 | The following patterns are considered violations:
|
82 |
|
83 |
|
84 | ```css
|
85 | @media print {
|
86 |
|
87 | a {
|
88 | color: aquamarine;
|
89 | }
|
90 | }
|
91 | ```
|
92 |
|
93 |
|
94 | ```css
|
95 | @supports (animation-name: test) {
|
96 |
|
97 | a {
|
98 | color: aquamarine;
|
99 | }
|
100 | }
|
101 | ```
|
102 |
|
103 |
|
104 | ```css
|
105 | @keyframes test {
|
106 |
|
107 | 100% {
|
108 | color: aquamarine;
|
109 | }
|
110 | }
|
111 | ```
|
112 |
|
113 | The following patterns are _not_ considered violations:
|
114 |
|
115 |
|
116 | ```css
|
117 | @media print {
|
118 |
|
119 | a {
|
120 | color: aquamarine;
|
121 | }
|
122 |
|
123 | }
|
124 | ```
|
125 |
|
126 |
|
127 | ```css
|
128 | @font-face {
|
129 | font-family: "MyFont";
|
130 | src: url("myfont.woff2") format("woff2");
|
131 | }
|
132 | ```
|
133 |
|
134 |
|
135 | ```css
|
136 | @supports (animation-name: test) {
|
137 |
|
138 | a {
|
139 | color: aquamarine;
|
140 | }
|
141 |
|
142 | }
|
143 | ```
|
144 |
|
145 |
|
146 | ```css
|
147 | @keyframes test {
|
148 |
|
149 | 100% {
|
150 | color: aquamarine;
|
151 | }
|
152 |
|
153 | }
|
154 | ```
|
155 |
|
156 | For example, with `"always-multi-line"` and `except: ["after-closing-brace"]`:
|
157 |
|
158 | The following patterns are considered violations:
|
159 |
|
160 |
|
161 | ```css
|
162 | @media print {
|
163 |
|
164 | a {
|
165 | color: aquamarine;
|
166 |
|
167 | }
|
168 |
|
169 | }
|
170 | ```
|
171 |
|
172 |
|
173 | ```css
|
174 | @supports (animation-name: test) {
|
175 |
|
176 | a {
|
177 | color: aquamarine;
|
178 |
|
179 | }
|
180 |
|
181 | }
|
182 | ```
|
183 |
|
184 |
|
185 | ```css
|
186 | @keyframes test {
|
187 |
|
188 | 100% {
|
189 | color: aquamarine;
|
190 |
|
191 | }
|
192 |
|
193 | }
|
194 | ```
|
195 |
|
196 | The following patterns are _not_ considered violations:
|
197 |
|
198 |
|
199 | ```css
|
200 | @media print {
|
201 |
|
202 | a {
|
203 | color: aquamarine;
|
204 |
|
205 | }
|
206 | }
|
207 | ```
|
208 |
|
209 |
|
210 | ```css
|
211 | @font-face {
|
212 | font-family: "MyFont";
|
213 | src: url("myfont.woff2") format("woff2");
|
214 |
|
215 | }
|
216 | ```
|
217 |
|
218 |
|
219 | ```css
|
220 | @supports (animation-name: test) {
|
221 |
|
222 | a {
|
223 | color: aquamarine;
|
224 |
|
225 | }
|
226 | }
|
227 | ```
|
228 |
|
229 |
|
230 | ```css
|
231 | @keyframes test {
|
232 |
|
233 | 100% {
|
234 | color: aquamarine;
|
235 |
|
236 | }
|
237 | }
|
238 | ```
|