Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected enforcement of at-rule-empty-line-before ignoring after-comment #4924

Closed
agarzola opened this issue Sep 3, 2020 · 2 comments
Closed

Comments

@agarzola
Copy link

agarzola commented Sep 3, 2020

There are false positives for at-rules that immediately follow a multi-line comment in SCSS single-line comment syntax (i.e. multiple lines, each preceded by // ), with "ignore": ["after-comment"] configuration.

Which rule, if any, is the bug related to?

at-rule-empty-line-before

What code is needed to reproduce the bug?

// This is a single-line comment. The next line is not flagged.
@media (min-width: 600px) {
  body {
    background-color: lightblue;
  }
}

/* This is a multi-line comment in multi-line comment syntax
 * and the next line is not flagged. */
@media (min-width: 700px) {
  body {
    background-color: pink;
  }
}

// This is a multi-line comment in single-line comment syntax
// and the next line is flagged as an error by stylelint.
@media (min-width: 800px) {
  body {
    background-color: green;
  }
}

What stylelint configuration is needed to reproduce the bug?

e.g.

{
  "rules": {
    "at-rule-empty-line-before": [
      "always",
      {
        "ignore": ["after-comment"]
      }
    ]
  }
}

Which version of stylelint are you using?

13.7.0

How are you running stylelint: CLI, PostCSS plugin, Node.js API?

CLI with stylelint "**/*.css" and the configuration above in .stylelintrc in the CWD.

Does the bug relate to non-standard syntax (e.g. SCSS, Less etc.)?

Yes, this happens with single-line comment syntax, which is an SCSS feature.

What did you expect to happen?

No errors to be flagged, since a multi-line comment in single-line syntax is still a comment. I expect "ignore": ["after-comment"] to include all syntax variations of a comment.

What actually happened (e.g. what warnings or errors did you get)?

test.scss
18:1  ✖  Expected empty line before at-rule   at-rule-empty-line-before

cc: @danarbello

@alexander-akait
Copy link
Member

I think duplicate #4917

@jeddy3
Copy link
Member

jeddy3 commented Nov 17, 2020

@agarzola Thanks for the agree and for using the template.

I think duplicate #4917

I agree. I'll expand that issue so that it applies to all *-empty-line-before rules.

@agarzola That issue as labelled as ready to implement. Please consider contributing if you have time.

There are steps on how to fix a bug in a rule in the Developer guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants