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

no-empty-rulesets does not catch rulesets containing only comments #968

Closed
royaldark opened this issue Nov 23, 2016 · 2 comments
Closed

Comments

@royaldark
Copy link
Contributor

What version of Sass Lint are you using?
1.10.2

With no-empty-rulesets enabled, rulesets containing only comments are not considered empty, and therefore do not trigger the rule. I would argue rulesets like the following are definitely empty:

.baz {
  // Here is a comment
  // These comments often contain rules that were commented out
  // width: 4px;
}

Does this seem like a reasonable assumption?

I worked up a commit that changes the behavior to fix this if there's any interest.

@DanPurdy
Copy link
Member

RIghtly or wrongly I chose to ignore this while we didn't have the ability to disable rules via comments but now that we do I think it's perfectly reasonable to believe that this should still fail as the comments aren't being pumped out into CSS.

There's an argument for /* */ style comments not throwing here as technically they do get added to the resulting stylesheet but arguably the rule is still empty. What do you think?

Also as with all our bug issues PR's are welcome!

@royaldark
Copy link
Contributor Author

I guess I'm not sure why you'd ever want to preserve an empty block, even with comments. Similar tools like CSSLint seem to agree: https://github.com/CSSLint/csslint/wiki/Disallow-empty-rules

I'll submit a PR in the next few days.

royaldark added a commit to royaldark/sass-lint that referenced this issue Jan 17, 2017
This commit makes the no-empty-rulesets rule trigger when a ruleset
contains only comments. Closes sasstools#968.
bgriffith pushed a commit to bgriffith/sass-lint that referenced this issue Aug 27, 2017
This commit makes the no-empty-rulesets rule trigger when a ruleset
contains only comments. Closes sasstools#968.
bgriffith pushed a commit that referenced this issue Aug 27, 2017
This commit makes the no-empty-rulesets rule trigger when a ruleset
contains only comments. Closes #968.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants