Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new ESLint rule no-whitespace-only-children that detects and fixes HTML tags containing only whitespace characters as children. This is particularly useful for web components (like Lit) where whitespace can unintentionally override default slot content.
Key changes:
- Implements the rule with support for
tagPatternsoption to selectively check specific tags - Includes auto-fix capability to remove whitespace-only children
- Provides comprehensive test coverage for various whitespace scenarios (spaces, tabs, newlines, mixed)
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
packages/eslint-plugin/lib/rules/no-whitespace-only-children.js |
Implements the core rule logic with pattern matching and auto-fix functionality |
packages/eslint-plugin/tests/rules/no-whitespace-only-children.test.js |
Provides test cases for valid and invalid scenarios, including template literal support |
packages/eslint-plugin/lib/rules/index.js |
Exports the new rule in the rules index |
docs/rules/no-whitespace-only-children.md |
Documents the rule with usage examples and configuration options |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/eslint-plugin/tests/rules/no-whitespace-only-children.test.js
Outdated
Show resolved
Hide resolved
packages/eslint-plugin/lib/rules/no-whitespace-only-children.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
packages/eslint-plugin/lib/rules/no-whitespace-only-children.js
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #460 +/- ##
==========================================
- Coverage 98.71% 98.66% -0.06%
==========================================
Files 85 86 +1
Lines 2810 2852 +42
Branches 772 784 +12
==========================================
+ Hits 2774 2814 +40
- Misses 36 38 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
Checklist
Description