Skip to content

Rule Change: Allow no-empty-blocks to ignore comment-only blocks #477

Description

@Pixel998

What rule do you want to change?

no-empty-blocks

What change do you want to make?

Generate fewer warnings

How do you think the change should be implemented?

A new option

Example code

@media (min-width: 1200px) {
  .sidebar { /* Fix this later */ }
}

What does the rule currently do for this code?

The rule reports the block as empty.

The rule currently treats comments as not being content, so a block containing only a comment is reported. There is no option to change this behavior.

What will the rule do after it's changed?

With a new option, users could choose for comment-only blocks to be treated as non-empty, so the example above would not be reported.

Participation

  • I am willing to submit a pull request to implement this change.

AI acknowledgment

  • I did not use AI to generate this issue report.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

Additional comments

This would bring no-empty-blocks closer to Stylelint’s block-no-empty, which does not report comment-only blocks by default: https://stylelint.io/user-guide/rules/block-no-empty/

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Feedback Needed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions