Skip to content

fix(eslint-plugin-template): [prefer-self-closing-tags] do not remove HTML-encoded whitespace #2229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2025

Conversation

reduckted
Copy link
Contributor

@reduckted reduckted commented Feb 3, 2025

Fixes #1700
Fixes #1715

The bug was caused by the fact that the template parser decodes HTML entities. For example if the text content of a node is " ", then that is parsed to a TmplAstText object with a value of " ". Likewise, 	 is parsed to "\t", and so on.

So rather than checking if the TmplAstText.value property is whitespace, we need to get the corresponding text from the source code and see if that text is whitespace.

Copy link

nx-cloud bot commented Feb 3, 2025

View your CI Pipeline Execution ↗ for commit 77a6357.

Command Status Duration Result
nx run-many -t e2e-suite --parallel 1 ✅ Succeeded 33s View ↗
nx run-many -t test --codeCoverage ✅ Succeeded 1m 6s View ↗
nx run-many -t build,typecheck,check-rule-docs,... ✅ Succeeded 42s View ↗
nx-cloud record -- pnpm nx sync:check ✅ Succeeded 4s View ↗
nx-cloud record -- pnpm format-check ✅ Succeeded 5s View ↗
nx run-many -t test ✅ Succeeded 39s View ↗
nx run-many -t build ✅ Succeeded 22s View ↗

☁️ Nx Cloud last updated this comment at 2025-02-03 11:47:41 UTC

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.45%. Comparing base (3475d1c) to head (77a6357).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2229      +/-   ##
==========================================
+ Coverage   90.44%   90.45%   +0.01%     
==========================================
  Files         177      177              
  Lines        3527     3532       +5     
  Branches      593      595       +2     
==========================================
+ Hits         3190     3195       +5     
  Misses        183      183              
  Partials      154      154              
Flag Coverage Δ
unittest 90.45% <100.00%> (+0.01%) ⬆️

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

Files with missing lines Coverage Δ
...gin-template/src/rules/prefer-self-closing-tags.ts 100.00% <100.00%> (ø)
...late/tests/rules/prefer-self-closing-tags/cases.ts 100.00% <ø> (ø)

... and 1 file with indirect coverage changes

Copy link
Member

@JamesHenry JamesHenry left a comment

Choose a reason for hiding this comment

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

Thank you!

@JamesHenry JamesHenry merged commit 7dd8bfa into angular-eslint:main Feb 8, 2025
10 checks passed
@reduckted reduckted deleted the bugfix/1700 branch February 8, 2025 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants