diff --git a/changelog_unreleased/angular/18047.md b/changelog_unreleased/angular/18047.md new file mode 100644 index 000000000..e2c45380f --- /dev/null +++ b/changelog_unreleased/angular/18047.md @@ -0,0 +1,13 @@ +#### Fix formatting of "non-null assertion" (#18047 by @fisker) + + +```html + +{{ foo?.bar!.baz }} + + +{{ (foo?.bar)!.baz }} + + +{{ foo?.bar!.baz }} +``` diff --git a/package.json b/package.json index 220b27269..150fe0179 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "@typescript-eslint/visitor-keys": "8.46.0", "acorn": "8.15.0", "acorn-jsx": "5.3.2", - "angular-estree-parser": "13.0.2", + "angular-estree-parser": "13.0.4", "angular-html-parser": "8.1.0", "camelcase": "8.0.0", "ci-info": "4.3.1", diff --git a/tests/format/angular/interpolation/html/__snapshots__/format.test.js.snap b/tests/format/angular/interpolation/html/__snapshots__/format.test.js.snap index 73eadc3cc..2584653bc 100644 --- a/tests/format/angular/interpolation/html/__snapshots__/format.test.js.snap +++ b/tests/format/angular/interpolation/html/__snapshots__/format.test.js.snap @@ -32,3 +32,21 @@ printWidth: 80 ================================================================================ `; + +exports[`non-null-assertion.html format 1`] = ` +====================================options===================================== +parsers: ["angular"] +printWidth: 80 + | printWidth +=====================================input====================================== +{{ foo?.bar!.bam }} +{{ (foo?.bar)!.bam }} +{{ (foo?.bar!).bam }} + +=====================================output===================================== +{{ foo?.bar!.bam }} +{{ (foo?.bar)!.bam }} +{{ (foo?.bar)!.bam }} + +================================================================================ +`; diff --git a/tests/format/angular/interpolation/html/non-null-assertion.html b/tests/format/angular/interpolation/html/non-null-assertion.html new file mode 100644 index 000000000..f4617a97d --- /dev/null +++ b/tests/format/angular/interpolation/html/non-null-assertion.html @@ -0,0 +1,3 @@ +{{ foo?.bar!.bam }} +{{ (foo?.bar)!.bam }} +{{ (foo?.bar!).bam }} diff --git a/yarn.lock b/yarn.lock index 6dcb4baa6..70fdc1e92 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2825,12 +2825,12 @@ __metadata: languageName: node linkType: hard -"angular-estree-parser@npm:13.0.2": - version: 13.0.2 - resolution: "angular-estree-parser@npm:13.0.2" +"angular-estree-parser@npm:13.0.4": + version: 13.0.4 + resolution: "angular-estree-parser@npm:13.0.4" peerDependencies: - "@angular/compiler": ^20.1.2 - checksum: 10/da41d8aab2aac414cd71aba40d6f78002f968724cd7477f0579cbb43de783f1fd2329a4230ad3c229fade0966c8e9a139b229230939c274cb0212cb02a8c289d + "@angular/compiler": ^20.3.4 + checksum: 10/51cd3e482643877a6c9d7584dce19119b403f749bd6a58d9acff816aa170785be6e43fca526db15413f7f7670d1dab5e6c14392413931da8bb9f32505dd70c2b languageName: node linkType: hard @@ -7333,7 +7333,7 @@ __metadata: "@typescript-eslint/visitor-keys": "npm:8.46.0" acorn: "npm:8.15.0" acorn-jsx: "npm:5.3.2" - angular-estree-parser: "npm:13.0.2" + angular-estree-parser: "npm:13.0.4" angular-html-parser: "npm:8.1.0" browserslist: "npm:4.26.3" browserslist-to-esbuild: "npm:2.1.1"