Skip to content
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

[prefer-self-closing-tags] closes ng-container with   #1700

Open
2 tasks done
twittwer opened this issue Jan 18, 2024 · 0 comments
Open
2 tasks done

[prefer-self-closing-tags] closes ng-container with   #1700

twittwer opened this issue Jan 18, 2024 · 0 comments
Labels
package: eslint-plugin-template Angular Template rules triage This issue needs to be looked at and categorized by a maintainer

Comments

@twittwer
Copy link

Description and reproduction of the issue

The self-closing tag rule considers an ng-content with a non-breakable space as an empty tag.
But this is not true, as a non-breakable space is a rendered element.
The auto-fixer removes the non-breakable space, which causes a UI change.

{
  "rules": {
    "@angular-eslint/template/prefer-self-closing-tags": ["error"]
  }
}
<!-- input -->
<ng-container i18n>prefix</ng-container>
<ng-container>&nbsp;</ng-container>
<ng-container i18n>suffix</ng-container>

Rendered: prefix suffix

<!-- auto fixed output -->
<ng-container i18n>prefix</ng-container>
<ng-container />
<ng-container i18n>suffix</ng-container>

Rendered: prefixsuffix

Versions

package version
@angular-eslint/eslint-plugin-template 17.2.0
@angular-eslint/template-parser 17.2.0
@typescript-eslint/parser 6.19.0
ESLint 8.56.0
node 20.10.0
# Please run `npx ng version` in your project and paste the full output here:

Angular CLI: 17.1.0
Node: 20.10.0
Package Manager: npm 10.2.3
OS: win32 x64

Angular: 17.1.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, localize, platform-browser
... platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.0
@angular-devkit/build-angular   17.1.0
@angular-devkit/core            17.1.0
@angular-devkit/schematics      17.1.0
@schematics/angular             17.1.0
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.3
  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest supported version of the packages and checked my ng version output per the instructions given here.
@twittwer twittwer added package: eslint-plugin-template Angular Template rules triage This issue needs to be looked at and categorized by a maintainer labels Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: eslint-plugin-template Angular Template rules triage This issue needs to be looked at and categorized by a maintainer
Projects
None yet
Development

No branches or pull requests

1 participant