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

Open
#477 2 comments 0 reactions 1 assignee View on GitHub

@Pixel998 is already working on this.

Since Jun 24, 2026.

Assessment

This issue has not been assessed yet.

Description

enhancement
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/

Dominant language
JavaScript
Stars
308
Forks
44
Avg merge
2d 6h
Merged PRs (30d)
18

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from eslint/css

All issues in eslint/css

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.