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