coding-standards icon indicating copy to clipboard operation
coding-standards copied to clipboard

at-rule-empty-line-before not ignoring // comments in SCSS

Open mattheu opened this issue 5 years ago • 3 comments

The rule at-rule-empty-line-before enforces a line break before anything with an @, which in SCSS can be quite a few things e.g. @function. We have this configured to still allow comments before, but it only recognises comments of the format /* comment */ and not // comment. I suspect because these aren't really allowed in vanilla CSS.

mattheu avatar Sep 18 '20 11:09 mattheu

@mattheu so, given that //-style "comments", indeed, are not actual comments according to CSS specification, do you still think this is a bug?

Maybe we should disallow these comments, and enforce using proper /* CSS comments. */...?

tfrommen avatar Feb 09 '21 19:02 tfrommen

Yeah that would also work too I think

mattheu avatar Feb 09 '21 20:02 mattheu

There are a few stylelint-scss comment rules we can add:

via https://github.com/kristerkari/stylelint-scss/#-comment

//-comment

  • double-slash-comment-empty-line-before: Require or disallow an empty line before //-comments (Autofixable).
  • double-slash-comment-inline: Require or disallow //-comments to be inline comments.
  • double-slash-comment-whitespace-inside: Require or disallow whitespace after the // in //-comments

ntwb avatar Feb 18 '21 03:02 ntwb