Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat: add no-whitespace-only-children#460

Merged
yeonjuan merged 9 commits intomainfrom
fix/458
Dec 13, 2025
Merged

feat: add no-whitespace-only-children#460
yeonjuan merged 9 commits intomainfrom
fix/458

Conversation

@yeonjuan
Copy link
Owner

Checklist

Description

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 tagPatterns option 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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@yeonjuan yeonjuan marked this pull request as ready for review December 13, 2025 08:16
@yeonjuan yeonjuan merged commit 967616d into main Dec 13, 2025
3 checks passed
@yeonjuan yeonjuan deleted the fix/458 branch December 13, 2025 11:53
@codecov
Copy link

codecov bot commented Dec 13, 2025

Codecov Report

❌ Patch coverage is 95.23810% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.66%. Comparing base (68100e4) to head (35bfbfa).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...nt-plugin/lib/rules/no-whitespace-only-children.js 95.12% 2 Missing ⚠️
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     
Flag Coverage Δ
unittest 98.66% <95.23%> (-0.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
packages/eslint-plugin/lib/rules/index.js 100.00% <100.00%> (ø)
...nt-plugin/lib/rules/no-whitespace-only-children.js 95.12% <95.12%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] A rule to forbid empty content in tags

1 participant