.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / rules / comment-empty-line-before / README.md
1 # comment-empty-line-before
2
3 Require or disallow an empty line before comments.
4
5 ```css
6 a {}
7               /* ← */
8 /* comment */ /* ↑ */
9 /**              ↑
10 *        This line */
11 ```
12
13 If the comment is the very first node in a stylesheet then it is ignored. Shared-line comments are also ignored.
14
15 If you're using a custom syntax which support single-line comments with `//`, those are ignored as well.
16
17 **Caveat:** Comments within *selector and value lists* are currently ignored.
18
19 The `--fix` option on the [command line](../../../docs/user-guide/cli.md#autofixing-errors) can automatically fix all of the problems reported by this rule. We recommend to enable [`indentation`](../indentation/README.md) rule for better autofixing results with this rule.
20
21 ## Options
22
23 `string`: `"always"|"never"`
24
25 ### `"always"`
26
27 There *must always* be an empty line before comments.
28
29 The following patterns are considered violations:
30
31 ```css
32 a {}
33 /* comment */
34 ```
35
36 The following patterns are *not* considered violations:
37
38 ```css
39 a {}
40
41 /* comment */
42 ```
43
44 ```css
45 a {} /* comment */
46 ```
47
48 ### `"never"`
49
50 There *must never* be an empty line before comments.
51
52 The following patterns are considered violations:
53
54 ```css
55 a {}
56
57 /* comment */
58 ```
59
60 The following patterns are *not* considered violations:
61
62 ```css
63 a {}
64 /* comment */
65 ```
66
67 ```css
68 a {} /* comment */
69 ```
70
71 ## Optional secondary options
72
73 ### `except: ["first-nested"]`
74
75 Reverse the primary option for comments that are nested and the first child of their parent node.
76
77 For example, with `"always"`:
78
79 The following patterns are considered violations:
80
81 ```css
82 a {
83
84   /* comment */
85   color: pink;
86 }
87 ```
88
89 The following patterns are *not* considered violations:
90
91 ```css
92 a {
93   /* comment */
94   color: pink;
95 }
96 ```
97
98 ### `ignore: ["after-comment", "stylelint-commands"]`
99
100 #### `"after-comment"`
101
102 Don't require an empty line after a comment.
103
104 For example, with `"always"`:
105
106 The following patterns are *not* considered violations:
107
108 ```css
109 a {
110   background: pink;
111
112   /* comment */
113   /* comment */
114   color: #eee;
115 }
116 ```
117
118 ```css
119 a {
120   background: pink;
121
122   /* comment */
123
124   /* comment */
125   color: #eee;
126 }
127 ```
128
129 #### `"stylelint-commands"`
130
131 Ignore comments that deliver commands to stylelint, e.g. `/* stylelint-disable color-no-hex */`.
132
133 For example, with `"always"`:
134
135 The following patterns are considered violations:
136
137 ```css
138 a {
139   background: pink;
140   /* not a stylelint command */
141   color: #eee;
142 }
143 ```
144
145 The following patterns are *not* considered violations:
146
147 ```css
148 a {
149   background: pink;
150   /* stylelint-disable color-no-hex */
151   color: pink;
152 }
153 ```