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