no-invalid-double-slash-comments
CSS / SCSS / LessCSS / SCSS / LessCSS / SCSS / Lesscorrectnessno fixdefault: warncss/stylelint-recommended
What it does
Section titled “What it does”Reports a rule or declaration that starts with //.
Why it matters
Section titled “Why it matters”CSS has no line comments. The browser reads // note as part of the next statement, so the selector or the property name is wrong and the rule or declaration is dropped. The comment seems to work and breaks the line below it.
To fix, write the comment as /* note */. Sass and Less read // as a comment, so there it is not reported.
Example
Section titled “Example”a { color: red }// noteb { color: blue }Configuration
Section titled “Configuration”css: lint: rules: no-invalid-double-slash-comments: warn # off, warn (default), errorless: lint: rules: no-invalid-double-slash-comments: warn # off, warn (default), errorscss: lint: rules: no-invalid-double-slash-comments: warn # off, warn (default), errorEnabled by the presets: css/stylelint-recommended.
Suppress one line with sudsy-disable-next-line no-invalid-double-slash-comments in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools; Sudsy reports what each upstream rule reports.
| Tool | Rule | Match |
|---|---|---|
| stylelint | no-invalid-double-slash-comments |
full |