UNPKG

1.61 kBMarkdownView Raw
1# declaration-block-trailing-semicolon
2
3Require or disallow a trailing semicolon within declaration blocks.
4
5<!-- prettier-ignore -->
6```css
7a { background: orange; color: pink; }
8/** ↑
9 * This semicolon */
10```
11
12The trailing semicolon is the _last_ semicolon in a declaration block and it is optional.
13
14This rule ignores:
15
16- Less mixins
17- trailing `//` comments
18- declaration blocks containing nested (at-)rules
19
20The [`fix` option](../../../docs/user-guide/usage/options.md#fix) can automatically fix all of the problems reported by this rule.
21
22## Options
23
24`string`: `"always"|"never"`
25
26### `"always"`
27
28There _must always_ be a trailing semicolon.
29
30The following patterns are considered violations:
31
32<!-- prettier-ignore -->
33```css
34a { color: pink }
35```
36
37<!-- prettier-ignore -->
38```css
39a { background: orange; color: pink }
40```
41
42<!-- prettier-ignore -->
43```css
44a { @include foo }
45```
46
47The following patterns are _not_ considered violations:
48
49<!-- prettier-ignore -->
50```css
51a { color: pink; }
52```
53
54<!-- prettier-ignore -->
55```css
56a { background: orange; color: pink; }
57```
58
59<!-- prettier-ignore -->
60```css
61a { @include foo; }
62```
63
64### `"never"`
65
66There _must never_ be a trailing semicolon.
67
68The following patterns are considered violations:
69
70<!-- prettier-ignore -->
71```css
72a { color: pink; }
73```
74
75<!-- prettier-ignore -->
76```css
77a { background: orange; color: pink; }
78```
79
80The following patterns are _not_ considered violations:
81
82<!-- prettier-ignore -->
83```css
84a { color: pink }
85```
86
87<!-- prettier-ignore -->
88```css
89a { background: orange; color: pink }
90```