UNPKG

1.9 kBMarkdownView Raw
1# declaration-colon-space-after
2
3Require a single space or disallow whitespace after the colon of declarations.
4
5<!-- prettier-ignore -->
6```css
7a { color: pink }
8/** ↑
9 * The space after this colon */
10```
11
12The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
13
14## Options
15
16`string`: `"always"|"never"|"always-single-line"`
17
18### `"always"`
19
20There _must always_ be a single space after the colon.
21
22The following patterns are considered violations:
23
24<!-- prettier-ignore -->
25```css
26a { color :pink }
27```
28
29<!-- prettier-ignore -->
30```css
31a { color:pink }
32```
33
34The following patterns are _not_ considered violations:
35
36<!-- prettier-ignore -->
37```css
38a { color : pink }
39```
40
41<!-- prettier-ignore -->
42```css
43a { color: pink }
44```
45
46### `"never"`
47
48There _must never_ be whitespace after the colon.
49
50The following patterns are considered violations:
51
52<!-- prettier-ignore -->
53```css
54a { color : pink }
55```
56
57<!-- prettier-ignore -->
58```css
59a { color: pink }
60```
61
62The following patterns are _not_ considered violations:
63
64<!-- prettier-ignore -->
65```css
66a { color :pink }
67```
68
69<!-- prettier-ignore -->
70```css
71a { color:pink }
72```
73
74### `"always-single-line"`
75
76There _must always_ be a single space after the colon _if the declaration's value is single-line_.
77
78The following patterns are considered violations:
79
80<!-- prettier-ignore -->
81```css
82a {
83 box-shadow:0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);
84}
85```
86
87The following patterns are _not_ considered violations:
88
89<!-- prettier-ignore -->
90```css
91a {
92 box-shadow: 0 0 0 1px #5b9dd9, 0 0 2px 1px rgba(30, 140, 190, 0.8);
93}
94```
95
96<!-- prettier-ignore -->
97```css
98a {
99 box-shadow:
100 0 0 0 1px #5b9dd9,
101 0 0 2px 1px rgba(30, 140, 190, 0.8);
102}
103```
104
105<!-- prettier-ignore -->
106```css
107a {
108 box-shadow:0 0 0 1px #5b9dd9,
109 0 0 2px 1px rgba(30, 140, 190, 0.8);
110}
111```