Rule Change: Allow no-empty-blocks to ignore comment-only blocks
- Dominant language
- JavaScript
- Stars
- 308
- Forks
- 44
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 18
Description
### 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
```css
@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
- [x] I am willing to submit a pull request to implement this change.
### AI acknowledgment
- [x] 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/
Contributor guide
Assessment
This issue has not been assessed yet.