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