1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

Add eslint rule no-floating-promises (#7789)

* add eslint rule no-floating-promises

* add eslint-disable comment to offending lines
This commit is contained in:
Will Martin
2024-02-02 15:13:37 -05:00
committed by GitHub
parent 6e96964c1a
commit cb8849c355
273 changed files with 1602 additions and 0 deletions

View File

@@ -204,6 +204,8 @@ export class VaultComponent implements OnInit, OnDestroy {
);
this.broadcasterService.subscribe(BroadcasterSubscriptionId, (message: any) => {
// 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.ngZone.run(async () => {
switch (message.command) {
case "syncCompleted":
@@ -393,6 +395,8 @@ export class VaultComponent implements OnInit, OnDestroy {
organization.canUseAdminCollections ||
(await this.cipherService.get(cipherId)) != 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.editCipherId(cipherId);
} else {
this.platformUtilsService.showToast(
@@ -400,6 +404,8 @@ export class VaultComponent implements OnInit, OnDestroy {
this.i18nService.t("errorOccurred"),
this.i18nService.t("unknownCipher"),
);
// 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.router.navigate([], {
queryParams: { cipherId: null, itemId: null },
queryParamsHandling: "merge",
@@ -420,6 +426,8 @@ export class VaultComponent implements OnInit, OnDestroy {
}
const cipher = allCiphers$.find((c) => c.id === cipherId);
if (organization.useEvents && cipher != undefined) {
// 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.viewEvents(cipher);
} else {
this.platformUtilsService.showToast(
@@ -427,6 +435,8 @@ export class VaultComponent implements OnInit, OnDestroy {
this.i18nService.t("errorOccurred"),
this.i18nService.t("unknownCipher"),
);
// 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.router.navigate([], {
queryParams: { viewEvents: null },
queryParamsHandling: "merge",
@@ -669,6 +679,8 @@ export class VaultComponent implements OnInit, OnDestroy {
},
);
// 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
modal.onClosedPromise().then(() => {
this.go({ cipherId: null, itemId: null });
});
@@ -797,6 +809,8 @@ export class VaultComponent implements OnInit, OnDestroy {
// Navigate away if we deleted the colletion we were viewing
if (this.selectedCollection?.node.id === collection.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
this.router.navigate([], {
queryParams: { collectionId: this.selectedCollection.parent?.node.id ?? null },
queryParamsHandling: "merge",
@@ -883,8 +897,12 @@ export class VaultComponent implements OnInit, OnDestroy {
);
if (field === "password") {
// 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_ClientCopiedPassword, cipher.id);
} else if (field === "totp") {
// 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_ClientCopiedHiddenField, cipher.id);
}
}
@@ -981,6 +999,8 @@ export class VaultComponent implements OnInit, OnDestroy {
};
}
// 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.router.navigate([], {
relativeTo: this.route,
queryParams: queryParams,