diff --git a/apps/browser/src/autofill/background/tabs.background.ts b/apps/browser/src/autofill/background/tabs.background.ts index 4d520680980..cd2c1595d69 100644 --- a/apps/browser/src/autofill/background/tabs.background.ts +++ b/apps/browser/src/autofill/background/tabs.background.ts @@ -20,10 +20,8 @@ export default class TabsBackground { return; } - // 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 - this.updateCurrentTabData(); - this.setupTabEventListeners(); + void this.updateCurrentTabData(); + void this.setupTabEventListeners(); } /** diff --git a/apps/browser/src/autofill/content/autofill-init.ts b/apps/browser/src/autofill/content/autofill-init.ts index 8f69937ac60..b6fc6c3392e 100644 --- a/apps/browser/src/autofill/content/autofill-init.ts +++ b/apps/browser/src/autofill/content/autofill-init.ts @@ -1,5 +1,3 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { EVENTS } from "@bitwarden/common/autofill/constants"; import AutofillPageDetails from "../models/autofill-page-details"; @@ -122,7 +120,7 @@ class AutofillInit implements AutofillInitInterface { * @param {AutofillExtensionMessage} message */ private async fillForm({ fillScript, pageDetailsUrl }: AutofillExtensionMessage) { - if ((document.defaultView || window).location.href !== pageDetailsUrl) { + if ((document.defaultView || window).location.href !== pageDetailsUrl || !fillScript) { return; } @@ -177,7 +175,7 @@ class AutofillInit implements AutofillInitInterface { message: AutofillExtensionMessage, sender: chrome.runtime.MessageSender, sendResponse: (response?: any) => void, - ): boolean => { + ): boolean | null => { const command: string = message.command; const handler: CallableFunction | undefined = this.getExtensionMessageHandler(command); if (!handler) { diff --git a/apps/browser/src/autofill/content/autofiller.ts b/apps/browser/src/autofill/content/autofiller.ts index c7a742f1fe1..bc9fd0bb05f 100644 --- a/apps/browser/src/autofill/content/autofiller.ts +++ b/apps/browser/src/autofill/content/autofiller.ts @@ -1,5 +1,3 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { setupExtensionDisconnectAction } from "../utils"; if (document.readyState === "loading") { @@ -9,7 +7,7 @@ if (document.readyState === "loading") { } function loadAutofiller() { - let pageHref: string = null; + let pageHref: null | string = null; let filledThisHref = false; let delayFillTimeout: number; let doFillInterval: number | NodeJS.Timeout; @@ -51,9 +49,7 @@ function loadAutofiller() { sender: "autofiller", }; - // 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 - chrome.runtime.sendMessage(msg); + void chrome.runtime.sendMessage(msg); } } diff --git a/apps/browser/src/autofill/content/bootstrap-autofill-overlay-menu.ts b/apps/browser/src/autofill/content/bootstrap-autofill-overlay-menu.ts index 605ffff0fec..40e32843fd4 100644 --- a/apps/browser/src/autofill/content/bootstrap-autofill-overlay-menu.ts +++ b/apps/browser/src/autofill/content/bootstrap-autofill-overlay-menu.ts @@ -1,5 +1,3 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { AutofillInlineMenuContentService } from "../overlay/inline-menu/content/autofill-inline-menu-content.service"; import { AutofillOverlayContentService } from "../services/autofill-overlay-content.service"; import DomElementVisibilityService from "../services/dom-element-visibility.service"; @@ -11,7 +9,7 @@ import AutofillInit from "./autofill-init"; (function (windowContext) { if (!windowContext.bitwardenAutofillInit) { - let inlineMenuContentService: AutofillInlineMenuContentService; + let inlineMenuContentService: undefined | AutofillInlineMenuContentService; if (globalThis.self === globalThis.top) { inlineMenuContentService = new AutofillInlineMenuContentService(); } diff --git a/apps/browser/src/autofill/content/bootstrap-autofill-overlay-notifications.ts b/apps/browser/src/autofill/content/bootstrap-autofill-overlay-notifications.ts index 495ae0e22db..8a079fa26c8 100644 --- a/apps/browser/src/autofill/content/bootstrap-autofill-overlay-notifications.ts +++ b/apps/browser/src/autofill/content/bootstrap-autofill-overlay-notifications.ts @@ -1,5 +1,3 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { OverlayNotificationsContentService } from "../overlay/notifications/content/overlay-notifications-content.service"; import { AutofillOverlayContentService } from "../services/autofill-overlay-content.service"; import DomElementVisibilityService from "../services/dom-element-visibility.service"; @@ -20,7 +18,7 @@ import AutofillInit from "./autofill-init"; inlineMenuFieldQualificationService, ); - let overlayNotificationsContentService: OverlayNotificationsContentService; + let overlayNotificationsContentService: undefined | OverlayNotificationsContentService; if (globalThis.self === globalThis.top) { overlayNotificationsContentService = new OverlayNotificationsContentService(); } @@ -29,7 +27,7 @@ import AutofillInit from "./autofill-init"; domQueryService, domElementVisibilityService, autofillOverlayContentService, - null, + undefined, overlayNotificationsContentService, ); setupAutofillInitDisconnectAction(windowContext); diff --git a/apps/browser/src/autofill/content/bootstrap-autofill-overlay.ts b/apps/browser/src/autofill/content/bootstrap-autofill-overlay.ts index 1777b135fe9..d204362ee25 100644 --- a/apps/browser/src/autofill/content/bootstrap-autofill-overlay.ts +++ b/apps/browser/src/autofill/content/bootstrap-autofill-overlay.ts @@ -1,5 +1,3 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { AutofillInlineMenuContentService } from "../overlay/inline-menu/content/autofill-inline-menu-content.service"; import { OverlayNotificationsContentService } from "../overlay/notifications/content/overlay-notifications-content.service"; import { AutofillOverlayContentService } from "../services/autofill-overlay-content.service"; @@ -12,8 +10,8 @@ import AutofillInit from "./autofill-init"; (function (windowContext) { if (!windowContext.bitwardenAutofillInit) { - let inlineMenuContentService: AutofillInlineMenuContentService; - let overlayNotificationsContentService: OverlayNotificationsContentService; + let inlineMenuContentService: undefined | AutofillInlineMenuContentService; + let overlayNotificationsContentService: undefined | OverlayNotificationsContentService; if (globalThis.self === globalThis.top) { inlineMenuContentService = new AutofillInlineMenuContentService(); overlayNotificationsContentService = new OverlayNotificationsContentService(); diff --git a/apps/browser/src/autofill/content/trigger-autofill-script-injection.ts b/apps/browser/src/autofill/content/trigger-autofill-script-injection.ts index 95a2391991b..9db691c1359 100644 --- a/apps/browser/src/autofill/content/trigger-autofill-script-injection.ts +++ b/apps/browser/src/autofill/content/trigger-autofill-script-injection.ts @@ -1,5 +1,3 @@ (function () { - // 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 - chrome.runtime.sendMessage({ command: "triggerAutofillScriptInjection" }); + void chrome.runtime.sendMessage({ command: "triggerAutofillScriptInjection" }); })(); diff --git a/apps/browser/src/autofill/services/autofill.service.ts b/apps/browser/src/autofill/services/autofill.service.ts index 6aa99bbda41..099f345cb75 100644 --- a/apps/browser/src/autofill/services/autofill.service.ts +++ b/apps/browser/src/autofill/services/autofill.service.ts @@ -213,9 +213,7 @@ export default class AutofillService implements AutofillServiceInterface { this.autofillScriptPortsSet.delete(port); }); - // 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 - this.injectAutofillScriptsInAllTabs(); + void this.injectAutofillScriptsInAllTabs(); } /** @@ -470,9 +468,7 @@ export default class AutofillService implements AutofillServiceInterface { await this.cipherService.updateLastUsedDate(options.cipher.id, activeAccount.id); } - // 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 - BrowserApi.tabSendMessage( + void BrowserApi.tabSendMessage( tab, { command: options.autoSubmitLogin ? "triggerAutoSubmitLogin" : "fillForm", @@ -502,9 +498,10 @@ export default class AutofillService implements AutofillServiceInterface { ); if (didAutofill) { - // 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 - this.eventCollectionService.collect(EventType.Cipher_ClientAutofilled, options.cipher.id); + await this.eventCollectionService.collect( + EventType.Cipher_ClientAutofilled, + options.cipher.id, + ); if (totp !== null) { return totp; } else { diff --git a/apps/browser/src/background/idle.background.ts b/apps/browser/src/background/idle.background.ts index 90276eaea0a..5b3a7f7d163 100644 --- a/apps/browser/src/background/idle.background.ts +++ b/apps/browser/src/background/idle.background.ts @@ -1,5 +1,3 @@ -// FIXME: Update this file to be type safe and remove this and next line -// @ts-strict-ignore import { firstValueFrom } from "rxjs"; import { AccountService } from "@bitwarden/common/auth/abstractions/account.service"; @@ -15,7 +13,7 @@ const IdleInterval = 60 * 5; // 5 minutes export default class IdleBackground { private idle: typeof chrome.idle | typeof browser.idle | null; - private idleTimer: number | NodeJS.Timeout = null; + private idleTimer: null | number | NodeJS.Timeout = null; private idleState = "active"; constructor( @@ -80,9 +78,8 @@ export default class IdleBackground { globalThis.clearTimeout(this.idleTimer); this.idleTimer = null; } - // 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 - this.idle.queryState(IdleInterval, (state: string) => { + + void this.idle?.queryState(IdleInterval, (state: string) => { if (state !== this.idleState) { this.idleState = state; handler(state); diff --git a/apps/browser/src/background/runtime.background.ts b/apps/browser/src/background/runtime.background.ts index 1e7a0140022..725ca1b2780 100644 --- a/apps/browser/src/background/runtime.background.ts +++ b/apps/browser/src/background/runtime.background.ts @@ -48,7 +48,7 @@ export default class RuntimeBackground { private platformUtilsService: BrowserPlatformUtilsService, private notificationsService: NotificationsService, private autofillSettingsService: AutofillSettingsServiceAbstraction, - private processReloadSerivce: ProcessReloadServiceAbstraction, + private processReloadService: ProcessReloadServiceAbstraction, private environmentService: BrowserEnvironmentService, private messagingService: MessagingService, private logService: LogService, @@ -241,7 +241,7 @@ export default class RuntimeBackground { await closeUnlockPopout(); } - this.processReloadSerivce.cancelProcessReload(); + this.processReloadService.cancelProcessReload(); if (item) { await BrowserApi.focusWindow(item.commandToRetry.sender.tab.windowId);