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