1 | # declaration-block-semicolon-newline-before
|
2 |
|
3 | Require a newline or disallow whitespace before the semicolons of declaration blocks.
|
4 |
|
5 |
|
6 | ```css
|
7 | a {
|
8 | color: pink
|
9 | ; top: 0;
|
10 | } ↑
|
11 | /** ↑
|
12 | * The newline before this semicolon */
|
13 | ```
|
14 |
|
15 | This rule ignores semicolons that are preceded by Less mixins.
|
16 |
|
17 | ## Options
|
18 |
|
19 | `string`: `"always"|"always-multi-line"|"never-multi-line"`
|
20 |
|
21 | ### `"always"`
|
22 |
|
23 | There _must always_ be a newline before the semicolons.
|
24 |
|
25 | The following patterns are considered violations:
|
26 |
|
27 |
|
28 | ```css
|
29 | a { color: pink; }
|
30 | ```
|
31 |
|
32 |
|
33 | ```css
|
34 | a {
|
35 | color: pink; top: 0;
|
36 | }
|
37 | ```
|
38 |
|
39 | The following patterns are _not_ considered violations:
|
40 |
|
41 |
|
42 | ```css
|
43 | a { color: pink
|
44 | ; }
|
45 | ```
|
46 |
|
47 |
|
48 | ```css
|
49 | a {
|
50 | color: pink
|
51 | ; top: 0;
|
52 | }
|
53 | ```
|
54 |
|
55 | ### `"always-multi-line"`
|
56 |
|
57 | There _must always_ be a newline before the semicolons in multi-line rules.
|
58 |
|
59 | The following patterns are considered violations:
|
60 |
|
61 |
|
62 | ```css
|
63 | a {
|
64 | color: pink; top: 0;
|
65 | }
|
66 | ```
|
67 |
|
68 | The following patterns are _not_ considered violations:
|
69 |
|
70 |
|
71 | ```css
|
72 | a { color: pink; }
|
73 | ```
|
74 |
|
75 |
|
76 | ```css
|
77 | a { color: pink; top: 0; }
|
78 | ```
|
79 |
|
80 |
|
81 | ```css
|
82 | a {
|
83 | color: pink
|
84 | ; top: 0;
|
85 | }
|
86 | ```
|
87 |
|
88 | ### `"never-multi-line"`
|
89 |
|
90 | There _must never_ be whitespace before the semicolons in multi-line rules.
|
91 |
|
92 | The following patterns are considered violations:
|
93 |
|
94 |
|
95 | ```css
|
96 | a {
|
97 | color: pink
|
98 | ; top: 0;
|
99 | }
|
100 | ```
|
101 |
|
102 | The following patterns are _not_ considered violations:
|
103 |
|
104 |
|
105 | ```css
|
106 | a { color: pink; }
|
107 | ```
|
108 |
|
109 |
|
110 | ```css
|
111 | a { color: pink; top: 0; }
|
112 | ```
|
113 |
|
114 |
|
115 | ```css
|
116 | a {
|
117 | color: pink;
|
118 | top: 0;
|
119 | }
|
120 | ```
|