notes/node_modules/stylelint-scss/src/rules/double-slash-comment-inline/README.md

1.7 KiB

double-slash-comment-inline

Require or disallow //-comments to be inline comments.

a {
  width: 10px; // inline-comment
/*             ↑
 * Such comments */

An inline comment in terms of this rule is a comment that is placed on the same line with any other code, either before or after it.

This rule only works with SCSS-like single-line comments and ignores CSS comments (/* */).

Options

string: "always"|"never"

"always"

//-comments must always be inline comments.

The following patterns are considered warnings:

// comment
a { width: 10px; }
a {
  // comment
  width: 10px;
}

The following patterns are not considered warnings:

a { // comment
  width: 10px;
}
a {
  width: 10px; // comment
}
a, // comment
b {
  width: 10px;
}

"never"

//-comments must never be inline comments.

The following patterns are considered warnings:

a {
  width: 10px; // comment
}
a, // comment
b {
  width: 10px;
}

The following patterns are not considered warnings:

// comment
a { width: 10px; }
a {
  // comment
  width: 10px;
}

Optional options

ignore: ["stylelint-commands"]

"stylelint-commands"

Ignore //-comments that deliver commands to stylelint, e.g. // stylelint-disable color-no-hex.

For example, with "always":

The following patterns are not considered warnings:

a {
  background: pink;
  // stylelint-disable color-no-hex
  color: pink;
}