From dc606847e4cfc4486d77b4197e25f77b63dcea07 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Tue, 18 Feb 2025 17:05:29 +0100 Subject: [PATCH] [PM-16447] Disable preserve whitespaces (#12994) Angular 6 changed the default to not preserve whitespaces. We've continued to opt into this pattern for backwards compatibility but we're experiencing issues with the new control flow syntax and would therefore like to switch and not preserve whitespace any longer. --- apps/browser/src/popup/main.ts | 4 +--- apps/browser/tsconfig.json | 3 +-- apps/desktop/src/app/main.ts | 4 +--- apps/desktop/tsconfig.json | 3 +-- apps/web/src/main.ts | 4 +--- apps/web/tsconfig.json | 3 +-- bitwarden_license/bit-web/src/main.ts | 4 +--- libs/components/src/chip-select/chip-select.component.ts | 1 - .../components/src/color-password/color-password.component.ts | 1 - libs/components/src/navigation/nav-group.component.ts | 1 - libs/components/src/toast/toastr.component.ts | 1 - libs/components/src/toggle-group/toggle-group.component.ts | 1 - libs/components/src/toggle-group/toggle.component.ts | 1 - 13 files changed, 7 insertions(+), 24 deletions(-) diff --git a/apps/browser/src/popup/main.ts b/apps/browser/src/popup/main.ts index dadd7917b99..bb975f48e5d 100644 --- a/apps/browser/src/popup/main.ts +++ b/apps/browser/src/popup/main.ts @@ -23,9 +23,7 @@ if (process.env.ENV === "production") { } function init() { - // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. - // eslint-disable-next-line @typescript-eslint/no-floating-promises - platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true }); + void platformBrowserDynamic().bootstrapModule(AppModule); } init(); diff --git a/apps/browser/tsconfig.json b/apps/browser/tsconfig.json index 8055260db57..6b6096825a7 100644 --- a/apps/browser/tsconfig.json +++ b/apps/browser/tsconfig.json @@ -46,8 +46,7 @@ "useDefineForClassFields": false }, "angularCompilerOptions": { - "strictTemplates": true, - "preserveWhitespaces": true + "strictTemplates": true }, "include": [ "src", diff --git a/apps/desktop/src/app/main.ts b/apps/desktop/src/app/main.ts index 287d66795d2..ba964177dbc 100644 --- a/apps/desktop/src/app/main.ts +++ b/apps/desktop/src/app/main.ts @@ -12,9 +12,7 @@ if (!ipc.platform.isDev) { enableProdMode(); } -// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. -// eslint-disable-next-line @typescript-eslint/no-floating-promises -platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true }); +void platformBrowserDynamic().bootstrapModule(AppModule); // Disable drag and drop to prevent malicious links from executing in the context of the app document.addEventListener("dragover", (event) => event.preventDefault()); diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json index 0bef5a5564d..05253fc47d7 100644 --- a/apps/desktop/tsconfig.json +++ b/apps/desktop/tsconfig.json @@ -45,8 +45,7 @@ "useDefineForClassFields": false }, "angularCompilerOptions": { - "strictTemplates": true, - "preserveWhitespaces": true + "strictTemplates": true }, "include": ["src", "../../libs/common/src/key-management/crypto/services/encrypt.worker.ts"] } diff --git a/apps/web/src/main.ts b/apps/web/src/main.ts index 1d1519c8b50..b202a170d26 100644 --- a/apps/web/src/main.ts +++ b/apps/web/src/main.ts @@ -11,6 +11,4 @@ if (process.env.NODE_ENV === "production") { enableProdMode(); } -// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. -// eslint-disable-next-line @typescript-eslint/no-floating-promises -platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true }); +void platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json index 68ac8c80085..d1da8ac4532 100644 --- a/apps/web/tsconfig.json +++ b/apps/web/tsconfig.json @@ -35,8 +35,7 @@ } }, "angularCompilerOptions": { - "strictTemplates": true, - "preserveWhitespaces": true + "strictTemplates": true }, "files": ["src/polyfills.ts", "src/main.ts", "src/theme.ts"], "include": [ diff --git a/bitwarden_license/bit-web/src/main.ts b/bitwarden_license/bit-web/src/main.ts index 1d1519c8b50..b202a170d26 100644 --- a/bitwarden_license/bit-web/src/main.ts +++ b/bitwarden_license/bit-web/src/main.ts @@ -11,6 +11,4 @@ if (process.env.NODE_ENV === "production") { enableProdMode(); } -// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. -// eslint-disable-next-line @typescript-eslint/no-floating-promises -platformBrowserDynamic().bootstrapModule(AppModule, { preserveWhitespaces: true }); +void platformBrowserDynamic().bootstrapModule(AppModule); diff --git a/libs/components/src/chip-select/chip-select.component.ts b/libs/components/src/chip-select/chip-select.component.ts index e9be66da7d4..a4c73b699cf 100644 --- a/libs/components/src/chip-select/chip-select.component.ts +++ b/libs/components/src/chip-select/chip-select.component.ts @@ -45,7 +45,6 @@ export type ChipSelectOption = Option & { multi: true, }, ], - preserveWhitespaces: false, }) export class ChipSelectComponent implements ControlValueAccessor, AfterViewInit { @ViewChild(MenuComponent) menu: MenuComponent; diff --git a/libs/components/src/color-password/color-password.component.ts b/libs/components/src/color-password/color-password.component.ts index e48758ca59a..4fc94e41854 100644 --- a/libs/components/src/color-password/color-password.component.ts +++ b/libs/components/src/color-password/color-password.component.ts @@ -22,7 +22,6 @@ enum CharacterType { } }`, - preserveWhitespaces: false, standalone: true, }) export class ColorPasswordComponent { diff --git a/libs/components/src/navigation/nav-group.component.ts b/libs/components/src/navigation/nav-group.component.ts index 62bdee26740..37244f37c8d 100644 --- a/libs/components/src/navigation/nav-group.component.ts +++ b/libs/components/src/navigation/nav-group.component.ts @@ -29,7 +29,6 @@ import { SideNavService } from "./side-nav.service"; ], standalone: true, imports: [CommonModule, NavItemComponent, IconButtonModule, I18nPipe], - preserveWhitespaces: false, }) export class NavGroupComponent extends NavBaseComponent implements AfterContentInit { @ContentChildren(NavBaseComponent, { diff --git a/libs/components/src/toast/toastr.component.ts b/libs/components/src/toast/toastr.component.ts index c93e96150ad..75124ceb4b3 100644 --- a/libs/components/src/toast/toastr.component.ts +++ b/libs/components/src/toast/toastr.component.ts @@ -23,7 +23,6 @@ import { ToastComponent } from "./toast.component"; transition("active => removed", animate("{{ easeTime }}ms {{ easing }}")), ]), ], - preserveWhitespaces: false, standalone: true, imports: [ToastComponent], }) diff --git a/libs/components/src/toggle-group/toggle-group.component.ts b/libs/components/src/toggle-group/toggle-group.component.ts index 5033a27ed6d..057a594654a 100644 --- a/libs/components/src/toggle-group/toggle-group.component.ts +++ b/libs/components/src/toggle-group/toggle-group.component.ts @@ -12,7 +12,6 @@ let nextId = 0; @Component({ selector: "bit-toggle-group", templateUrl: "./toggle-group.component.html", - preserveWhitespaces: false, standalone: true, }) export class ToggleGroupComponent { diff --git a/libs/components/src/toggle-group/toggle.component.ts b/libs/components/src/toggle-group/toggle.component.ts index 7bd62056763..bb48b7e103e 100644 --- a/libs/components/src/toggle-group/toggle.component.ts +++ b/libs/components/src/toggle-group/toggle.component.ts @@ -19,7 +19,6 @@ let nextId = 0; @Component({ selector: "bit-toggle", templateUrl: "./toggle.component.html", - preserveWhitespaces: false, standalone: true, imports: [NgClass], })