UNPKG

1.51 kBMarkdownView Raw
1# max-empty-lines
2
3Limit the number of adjacent empty lines.
4
5<!-- prettier-ignore -->
6```css
7a {}
8 /* ← */
9 /* ← */
10a {} /* ↑ */
11/** ↑
12 * These lines */
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`int`: Maximum number of adjacent empty lines allowed.
20
21For example, with `2`:
22
23The following patterns are considered violations:
24
25<!-- prettier-ignore -->
26```css
27a {}
28
29
30
31b {}
32```
33
34Comment strings are also checked -- so the following is a violation:
35
36<!-- prettier-ignore -->
37```css
38/*
39 Call me Ishmael.
40
41
42
43 Some years ago--never mind how long precisely-—...
44 */
45```
46
47The following patterns are _not_ considered violations:
48
49<!-- prettier-ignore -->
50```css
51a {}
52b {}
53```
54
55<!-- prettier-ignore -->
56```css
57a {}
58
59b {}
60```
61
62<!-- prettier-ignore -->
63```css
64a {}
65
66
67b {}
68```
69
70## Optional secondary options
71
72### `ignore: ["comments"]`
73
74Only enforce the adjacent empty lines limit for lines that are not comments.
75
76For example, with `2` adjacent empty lines:
77
78The following patterns are considered violations:
79
80<!-- prettier-ignore -->
81```css
82/* horse */
83a {}
84
85
86
87b {}
88```
89
90The following patterns are _not_ considered violations:
91
92<!-- prettier-ignore -->
93```css
94/*
95 Call me Ishmael.
96
97
98
99 Some years ago -- never mind how long precisely -- ...
100 */
101```
102
103<!-- prettier-ignore -->
104```css
105a {
106 /*
107 Comment
108
109
110
111
112 inside the declaration with a lot of empty lines...
113 */
114 color: pink;
115}
116```