UNPKG

1.07 kBMarkdownView Raw
1# no-invalid-double-slash-comments
2
3Disallow double-slash comments (`//...`) which are not supported by CSS and [could lead to unexpected results](https://stackoverflow.com/a/20192639/130652).
4
5```css
6a {
7 //color: pink;
8}
9/** ↑
10 * This comment */
11```
12
13If you are using a preprocessor that allows `//` single-line comments (e.g. Sass, Less, Stylus), this rule will not complain about those. They are compiled into standard CSS comments by your preprocessor, so stylelint will consider them valid. This rule only complains about the lesser-known method of using `//` to "comment out" a single-line of code in regular CSS. (If you didn't know this was possible, have a look at ["Single Line Comments (//) in CSS"](http://www.xanthir.com/b4U10)).
14
15## Options
16
17### `true`
18
19The following patterns are considered violations:
20
21```css
22a {
23 //color: pink;
24}
25```
26
27```css
28//a { color: pink; }
29```
30
31```css
32// Comment {}
33a {
34 color: pink;
35}
36```
37
38The following patterns are *not* considered violations:
39
40```css
41a {
42 /* color: pink; */
43}
44```
45
46```css
47/* a { color: pink; } */
48```