UNPKG

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