mirror of
https://github.com/bitwarden/browser
synced 2026-01-06 18:43:25 +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:
@@ -102,6 +102,8 @@ export class ClientsComponent implements OnInit {
|
||||
isPaging() {
|
||||
const searching = this.isSearching();
|
||||
if (searching && this.didScroll) {
|
||||
// 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.resetPaging();
|
||||
}
|
||||
return !searching && this.clients && this.clients.length > this.pageSize;
|
||||
|
||||
@@ -54,6 +54,8 @@ export class EventsComponent extends BaseEventsComponent implements OnInit {
|
||||
this.providerId = params.providerId;
|
||||
const provider = await this.providerService.get(this.providerId);
|
||||
if (provider == null || !provider.useEvents) {
|
||||
// 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(["/providers", this.providerId]);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -94,6 +94,8 @@ export class PeopleComponent
|
||||
const provider = await this.providerService.get(this.providerId);
|
||||
|
||||
if (!provider.canManageUsers) {
|
||||
// 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 });
|
||||
return;
|
||||
}
|
||||
@@ -108,6 +110,8 @@ export class PeopleComponent
|
||||
if (qParams.viewEvents != null) {
|
||||
const user = this.users.filter((u) => u.id === qParams.viewEvents);
|
||||
if (user.length > 0 && user[0].status === ProviderUserStatusType.Confirmed) {
|
||||
// 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.events(user[0]);
|
||||
}
|
||||
}
|
||||
@@ -215,6 +219,8 @@ export class PeopleComponent
|
||||
try {
|
||||
const request = new ProviderUserBulkRequest(filteredUsers.map((user) => user.id));
|
||||
const response = this.apiService.postManyProviderUserReinvite(this.providerId, request);
|
||||
// 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.showBulkStatus(
|
||||
users,
|
||||
filteredUsers,
|
||||
|
||||
@@ -51,6 +51,8 @@ export class SetupComponent implements OnInit {
|
||||
this.i18nService.t("emergencyInviteAcceptFailed"),
|
||||
{ timeout: 10000 },
|
||||
);
|
||||
// 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(["/"]);
|
||||
return;
|
||||
}
|
||||
@@ -62,10 +64,14 @@ export class SetupComponent implements OnInit {
|
||||
try {
|
||||
const provider = await this.apiService.getProvider(this.providerId);
|
||||
if (provider.name != 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.router.navigate(["/providers", provider.id], { replaceUrl: true });
|
||||
}
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
// 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(["/"]);
|
||||
}
|
||||
});
|
||||
@@ -92,6 +98,8 @@ export class SetupComponent implements OnInit {
|
||||
this.platformUtilsService.showToast("success", null, this.i18nService.t("providerSetup"));
|
||||
await this.syncService.fullSync(true);
|
||||
|
||||
// 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(["/providers", provider.id]);
|
||||
} catch (e) {
|
||||
this.validationService.showError(e);
|
||||
|
||||
@@ -196,6 +196,8 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
...prevTasks[organizationId],
|
||||
...newlyCompletedOrgTasks,
|
||||
};
|
||||
// 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.stateService.setSMOnboardingTasks({
|
||||
...prevTasks,
|
||||
[organizationId]: nextOrgTasks,
|
||||
@@ -304,6 +306,8 @@ export class OverviewComponent implements OnInit, OnDestroy {
|
||||
|
||||
protected hideOnboarding() {
|
||||
this.showOnboarding = false;
|
||||
// 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.saveCompletedTasks(this.organizationId, {
|
||||
importSecrets: true,
|
||||
createSecret: true,
|
||||
|
||||
@@ -82,6 +82,8 @@ export class ProjectDialogComponent implements OnInit {
|
||||
const projectView = this.getProjectView();
|
||||
if (this.data.operation === OperationType.Add) {
|
||||
const newProject = await this.createProject(projectView);
|
||||
// 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(["sm", this.data.organizationId, "projects", newProject.id]);
|
||||
} else {
|
||||
projectView.id = this.data.projectId;
|
||||
|
||||
@@ -38,6 +38,8 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy {
|
||||
}),
|
||||
),
|
||||
catchError(() => {
|
||||
// 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(["/sm", this.organizationId, "projects"]);
|
||||
return EMPTY;
|
||||
}),
|
||||
@@ -124,6 +126,8 @@ export class ProjectPeopleComponent implements OnInit, OnDestroy {
|
||||
this.currentAccessPolicies = convertToAccessPolicyItemViews(peoplePoliciesViews);
|
||||
|
||||
if (showAccessRemovalWarning) {
|
||||
// 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(["sm", this.organizationId, "projects"]);
|
||||
}
|
||||
this.platformUtilsService.showToast(
|
||||
|
||||
@@ -57,6 +57,8 @@ export class ProjectComponent implements OnInit, OnDestroy {
|
||||
this.project$ = combineLatest([this.route.params, currentProjectEdited]).pipe(
|
||||
switchMap(([params, _]) => this.projectService.getByProjectId(params.projectId)),
|
||||
catchError(() => {
|
||||
// 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(["/sm", this.organizationId, "projects"]).then(() => {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
|
||||
@@ -212,6 +212,8 @@ export class SecretDialogComponent implements OnInit {
|
||||
);
|
||||
|
||||
// If the secret is deleted, chain close this dialog after the delete dialog
|
||||
// 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
|
||||
lastValueFrom(dialogRef.closed).then(
|
||||
(closeData) => closeData !== undefined && this.dialogRef.close(),
|
||||
);
|
||||
|
||||
@@ -47,6 +47,8 @@ export class ServiceAccountDialogComponent {
|
||||
|
||||
async ngOnInit() {
|
||||
if (this.data.operation == OperationType.Edit) {
|
||||
// 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.loadData();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,8 @@ export class ServiceAccountPeopleComponent implements OnInit, OnDestroy {
|
||||
}),
|
||||
),
|
||||
catchError(() => {
|
||||
// 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(["/sm", this.organizationId, "service-accounts"]);
|
||||
return EMPTY;
|
||||
}),
|
||||
@@ -196,6 +198,8 @@ export class ServiceAccountPeopleComponent implements OnInit, OnDestroy {
|
||||
selectedPolicies: ApItemValueType[],
|
||||
): Promise<void> {
|
||||
if (showAccessRemovalWarning) {
|
||||
// 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(["sm", this.organizationId, "service-accounts"]);
|
||||
} else if (
|
||||
this.accessPolicySelectorService.isAccessRemoval(currentAccessPolicies, selectedPolicies)
|
||||
|
||||
@@ -43,6 +43,8 @@ export class ServiceAccountComponent implements OnInit, OnDestroy {
|
||||
),
|
||||
),
|
||||
catchError(() => {
|
||||
// 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(["/sm", this.organizationId, "service-accounts"]).then(() => {
|
||||
this.platformUtilsService.showToast(
|
||||
"error",
|
||||
|
||||
@@ -141,6 +141,8 @@ export class SecretsListComponent implements OnDestroy {
|
||||
secretService: SecretService,
|
||||
) {
|
||||
const value = secretService.getBySecretId(id).then((secret) => secret.value);
|
||||
// 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
|
||||
SecretsListComponent.copyToClipboardAsync(value, platformUtilsService).then(() => {
|
||||
platformUtilsService.showToast(
|
||||
"success",
|
||||
|
||||
@@ -14,4 +14,6 @@ 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 });
|
||||
|
||||
Reference in New Issue
Block a user