UNPKG

1.22 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<!-- prettier-ignore -->
6```css
7a {
8 //color: pink;
9}
10/** ↑
11 * This comment */
12```
13
14If 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)).
15
16## Options
17
18### `true`
19
20The following patterns are considered violations:
21
22<!-- prettier-ignore -->
23```css
24a {
25 //color: pink;
26}
27```
28
29<!-- prettier-ignore -->
30```css
31//a { color: pink; }
32```
33
34<!-- prettier-ignore -->
35```css
36// Comment {}
37a {
38 color: pink;
39}
40```
41
42The following patterns are _not_ considered violations:
43
44<!-- prettier-ignore -->
45```css
46a {
47 /* color: pink; */
48}
49```
50
51<!-- prettier-ignore -->
52```css
53/* a { color: pink; } */
54```