UNPKG

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