1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03: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

@@ -105,16 +105,22 @@ describe("Org Domain API Service", () => {
it("getAllByOrgId retrieves all org domains and calls orgDomainSvc replace", () => {
apiService.send.mockResolvedValue(mockedGetAllByOrgIdResponse);
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(0);
const orgDomainSvcReplaceSpy = jest.spyOn(orgDomainService, "replace");
// 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
orgDomainApiService
.getAllByOrgId("fakeOrgId")
.then((orgDomainResponses: Array<OrganizationDomainResponse>) => {
expect(orgDomainResponses).toHaveLength(3);
expect(orgDomainSvcReplaceSpy).toHaveBeenCalled();
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(3);
});
});
@@ -122,16 +128,22 @@ describe("Org Domain API Service", () => {
it("getByOrgIdAndOrgDomainId retrieves single org domain and calls orgDomainSvc upsert", () => {
apiService.send.mockResolvedValue(mockedOrgDomainServerResponse);
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(0);
const orgDomainSvcUpsertSpy = jest.spyOn(orgDomainService, "upsert");
// 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
orgDomainApiService
.getByOrgIdAndOrgDomainId("fakeOrgId", "fakeDomainId")
.then((orgDomain: OrganizationDomainResponse) => {
expect(orgDomain.id).toEqual(mockedOrgDomainServerResponse.id);
expect(orgDomainSvcUpsertSpy).toHaveBeenCalled();
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(1);
});
});
@@ -139,16 +151,22 @@ describe("Org Domain API Service", () => {
it("post success should call orgDomainSvc upsert", () => {
apiService.send.mockResolvedValue(mockedOrgDomainServerResponse);
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(0);
const orgDomainSvcUpsertSpy = jest.spyOn(orgDomainService, "upsert");
// 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
orgDomainApiService
.post("fakeOrgId", mockedOrgDomainResponse)
.then((orgDomain: OrganizationDomainResponse) => {
expect(orgDomain.id).toEqual(mockedOrgDomainServerResponse.id);
expect(orgDomainSvcUpsertSpy).toHaveBeenCalled();
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(1);
});
});
@@ -156,16 +174,22 @@ describe("Org Domain API Service", () => {
it("verify success should call orgDomainSvc upsert", () => {
apiService.send.mockResolvedValue(mockedOrgDomainServerResponse);
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(0);
const orgDomainSvcUpsertSpy = jest.spyOn(orgDomainService, "upsert");
// 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
orgDomainApiService
.verify("fakeOrgId", "fakeOrgId")
.then((orgDomain: OrganizationDomainResponse) => {
expect(orgDomain.id).toEqual(mockedOrgDomainServerResponse.id);
expect(orgDomainSvcUpsertSpy).toHaveBeenCalled();
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(1);
});
});
@@ -173,12 +197,18 @@ describe("Org Domain API Service", () => {
it("delete success should call orgDomainSvc delete", () => {
apiService.send.mockResolvedValue(true);
orgDomainService.upsert([mockedOrgDomainResponse]);
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(1);
const orgDomainSvcDeleteSpy = jest.spyOn(orgDomainService, "delete");
// 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
orgDomainApiService.delete("fakeOrgId", "fakeOrgId").then(() => {
expect(orgDomainSvcDeleteSpy).toHaveBeenCalled();
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(0);
});
});

View File

@@ -76,6 +76,8 @@ describe("Org Domain Service", () => {
it("orgDomains$ public observable exists and instantiates w/ empty array", () => {
expect(orgDomainService.orgDomains$).toBeDefined();
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toEqual([]);
});
@@ -84,10 +86,14 @@ describe("Org Domain Service", () => {
orgDomainService.replace(newOrgDomains);
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toEqual(newOrgDomains);
orgDomainService.clearCache();
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toEqual([]);
});
@@ -132,10 +138,14 @@ describe("Org Domain Service", () => {
verifiedDate: null as 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(2);
orgDomainService.upsert([newOrgDomain]);
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(3);
expect(orgDomainService.get(newOrgDomain.id)).toEqual(newOrgDomain);
@@ -148,14 +158,20 @@ describe("Org Domain Service", () => {
mockedExtraOrgDomainResponse,
];
orgDomainService.replace(orgDomains);
// 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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(3);
orgDomainService.delete([mockedUnverifiedOrgDomainResponse.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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(2);
expect(orgDomainService.get(mockedUnverifiedOrgDomainResponse.id)).toEqual(undefined);
orgDomainService.delete([mockedVerifiedOrgDomainResponse.id, mockedExtraOrgDomainResponse.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
expect(lastValueFrom(orgDomainService.orgDomains$)).resolves.toHaveLength(0);
expect(orgDomainService.get(mockedVerifiedOrgDomainResponse.id)).toEqual(undefined);
expect(orgDomainService.get(mockedExtraOrgDomainResponse.id)).toEqual(undefined);

View File

@@ -154,6 +154,8 @@ describe("Organization Service", () => {
});
it("does not exist", async () => {
// 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
organizationService.delete("1");
expect(stateService.getOrganizations).toHaveBeenCalledTimes(2);

View File

@@ -202,6 +202,8 @@ describe("accountService", () => {
});
it("should throw if the account does not exist", () => {
// 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
expect(sut.switchAccount("unknown" as UserId)).rejects.toThrowError("Account does not exist");
});
});

View File

@@ -39,12 +39,16 @@ export class AnonymousHubService implements AnonymousHubServiceAbstraction {
this.anonHubConnection.start().catch((error) => this.logService.error(error));
this.anonHubConnection.on("AuthRequestResponseRecieved", (data: 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.ProcessNotification(new NotificationResponse(data));
});
}
stopHubConnection() {
if (this.anonHubConnection) {
// 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.anonHubConnection.stop();
}
}

View File

@@ -150,6 +150,8 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction {
private handleKeyConnectorError(e: any) {
this.logService.error(e);
if (this.logoutCallback != 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.logoutCallback(false);
}
throw new Error("Key Connector error");

View File

@@ -181,11 +181,19 @@ export class CryptoService implements CryptoServiceAbstraction {
async clearStoredUserKey(keySuffix: KeySuffixOptions, userId?: UserId): Promise<void> {
if (keySuffix === KeySuffixOptions.Auto) {
// 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.setUserKeyAutoUnlock(null, { userId: userId });
// 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.clearDeprecatedKeys(KeySuffixOptions.Auto, userId);
}
if (keySuffix === KeySuffixOptions.Pin) {
// 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.setPinKeyEncryptedUserKeyEphemeral(null, { userId: userId });
// 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.clearDeprecatedKeys(KeySuffixOptions.Pin, userId);
}
}
@@ -351,6 +359,8 @@ export class CryptoService implements CryptoServiceAbstraction {
orgs: ProfileOrganizationResponse[] = [],
providerOrgs: ProfileProviderOrganizationResponse[] = [],
): Promise<void> {
// 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.activeUserEncryptedOrgKeysState.update((_) => {
const encOrgKeyData: { [orgId: string]: EncryptedOrganizationKeyData } = {};
@@ -411,6 +421,8 @@ export class CryptoService implements CryptoServiceAbstraction {
}
async setProviderKeys(providers: ProfileProviderResponse[]): Promise<void> {
// 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.activeUserEncryptedProviderKeysState.update((_) => {
const encProviderKeys: { [providerId: ProviderId]: EncryptedString } = {};

View File

@@ -382,6 +382,8 @@ describe("DefaultActiveUserState", () => {
await changeActiveUser(undefined);
// Act
// 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
expect(async () => await userState.update(() => null)).rejects.toThrow(
"No active user at this time.",
);
@@ -619,6 +621,8 @@ describe("DefaultActiveUserState", () => {
expect(diskStorageService["updatesSubject"]["observers"]).toHaveLength(1);
// Still be listening to storage updates
// 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
diskStorageService.save(userKey, newData);
await awaitAsync(); // storage updates are behind a promise
expect(sub2Emissions).toEqual([null, newData]);

View File

@@ -340,6 +340,8 @@ describe("DefaultGlobalState", () => {
expect(diskStorageService["updatesSubject"]["observers"]).toHaveLength(1);
// Still be listening to storage updates
// 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
diskStorageService.save(globalKey, newData);
await awaitAsync(); // storage updates are behind a promise
expect(sub2Emissions).toEqual([null, newData]);
@@ -362,6 +364,8 @@ describe("DefaultGlobalState", () => {
const emissions = trackEmissions(globalState.state$);
await awaitAsync();
// 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
diskStorageService.save(globalKey, newData);
await awaitAsync();

View File

@@ -392,6 +392,8 @@ describe("DefaultSingleUserState", () => {
expect(diskStorageService["updatesSubject"]["observers"]).toHaveLength(1);
// Still be listening to storage updates
// 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
diskStorageService.save(userKey, newData);
await awaitAsync(); // storage updates are behind a promise
expect(sub2Emissions).toEqual([null, newData]);
@@ -414,6 +416,8 @@ describe("DefaultSingleUserState", () => {
const emissions = trackEmissions(userState.state$);
await awaitAsync();
// 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
diskStorageService.save(userKey, newData);
await awaitAsync();

View File

@@ -19,6 +19,8 @@ describe("getStoredValue", () => {
});
it("should deserialize", async () => {
// 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
storageService.save(key, value);
const result = await getStoredValue(key, storageService, deserializer);
@@ -32,6 +34,8 @@ describe("getStoredValue", () => {
});
it("should not deserialize", async () => {
// 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
storageService.save(key, value);
const result = await getStoredValue(key, storageService, deserializer);
@@ -40,6 +44,8 @@ describe("getStoredValue", () => {
});
it("should convert undefined to null", async () => {
// 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
storageService.save(key, undefined);
const result = await getStoredValue(key, storageService, deserializer);

View File

@@ -14,6 +14,8 @@ export class AvatarUpdateService implements AvatarUpdateServiceAbstraction {
private apiService: ApiService,
private stateService: StateService,
) {
// 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.loadColorFromState();
}
@@ -26,6 +28,8 @@ export class AvatarUpdateService implements AvatarUpdateServiceAbstraction {
pushUpdate(color: string | null): Promise<ProfileResponse | void> {
return this.apiService.putAvatar(new UpdateAvatarRequest(color)).then((response) => {
// 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.setAvatarColor(response.avatarColor);
this._avatarUpdate$.next(response.avatarColor);
});

View File

@@ -19,6 +19,8 @@ export class EventUploadService implements EventUploadServiceAbstraction {
this.inited = true;
if (checkOnInterval) {
// 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.uploadEvents();
setInterval(() => this.uploadEvents(), 60 * 1000); // check every 60 seconds
}
@@ -43,6 +45,8 @@ export class EventUploadService implements EventUploadServiceAbstraction {
});
try {
await this.apiService.postEventsCollect(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.clearEvents(userId);
} catch (e) {
this.logService.error(e);

View File

@@ -43,6 +43,8 @@ export class NotificationsService implements NotificationsServiceAbstraction {
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.init();
});
}
@@ -84,6 +86,8 @@ export class NotificationsService implements NotificationsServiceAbstraction {
});
this.signalrConnection.onclose(() => {
this.connected = 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.reconnect(true);
});
this.inited = true;
@@ -172,6 +176,8 @@ export class NotificationsService implements NotificationsServiceAbstraction {
break;
case NotificationType.LogOut:
if (isAuthenticated) {
// 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.logoutCallback(true);
}
break;

View File

@@ -47,6 +47,8 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction {
}
startCheck() {
// 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.checkVaultTimeout();
setInterval(() => this.checkVaultTimeout(), 10 * 1000); // check every 10 seconds
}

View File

@@ -36,6 +36,7 @@ export async function migrate(
await storageService.save("stateVersion", CURRENT_VERSION);
return;
}
await MigrationBuilder.create()
.with(MinVersionMigrator)
.with(FixPremiumMigrator, 2, 3)

View File

@@ -14,6 +14,8 @@ export class RemoveEverBeenUnlockedMigrator extends Migrator<3, 4> {
}
}
// 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
Promise.all(accounts.map(({ userId, account }) => removeEverBeenUnlocked(userId, account)));
}

View File

@@ -31,6 +31,8 @@ export class AddKeyTypeToOrgKeysMigrator extends Migrator<4, 5> {
await helper.set(userId, account);
}
// 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
Promise.all(accounts.map(({ userId, account }) => updateOrgKey(userId, account)));
}
@@ -53,6 +55,8 @@ export class AddKeyTypeToOrgKeysMigrator extends Migrator<4, 5> {
await helper.set(userId, account);
}
// 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
Promise.all(accounts.map(async ({ userId, account }) => updateOrgKey(userId, account)));
}

View File

@@ -110,6 +110,8 @@ describe("SendService", () => {
});
it("returns null if there are no sends", async () => {
// 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
sendService.replace(null);
const newUserKey = new SymmetricCryptoKey(new Uint8Array(32)) as UserKey;
@@ -157,6 +159,8 @@ describe("SendService", () => {
});
it("does not exist", async () => {
// 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
sendService.delete("1");
expect(stateService.getEncryptedSends).toHaveBeenCalledTimes(2);

View File

@@ -160,6 +160,8 @@ describe("Cipher Service", () => {
const spy = jest
.spyOn(apiService, "postCipherAdmin")
.mockImplementation(() => Promise.resolve<any>(cipherObj));
// 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
cipherService.createWithServer(cipherObj, true);
const expectedObj = new CipherCreateRequest(cipherObj);
@@ -171,6 +173,8 @@ describe("Cipher Service", () => {
const spy = jest
.spyOn(apiService, "postCipher")
.mockImplementation(() => Promise.resolve<any>(cipherObj));
// 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
cipherService.createWithServer(cipherObj, true);
const expectedObj = new CipherRequest(cipherObj);
@@ -183,6 +187,8 @@ describe("Cipher Service", () => {
const spy = jest
.spyOn(apiService, "postCipherCreate")
.mockImplementation(() => Promise.resolve<any>(cipherObj));
// 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
cipherService.createWithServer(cipherObj);
const expectedObj = new CipherCreateRequest(cipherObj);
@@ -194,6 +200,8 @@ describe("Cipher Service", () => {
const spy = jest
.spyOn(apiService, "postCipher")
.mockImplementation(() => Promise.resolve<any>(cipherObj));
// 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
cipherService.createWithServer(cipherObj);
const expectedObj = new CipherRequest(cipherObj);
@@ -207,6 +215,8 @@ describe("Cipher Service", () => {
const spy = jest
.spyOn(apiService, "putCipherAdmin")
.mockImplementation(() => Promise.resolve<any>(cipherObj));
// 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
cipherService.updateWithServer(cipherObj, true, true);
const expectedObj = new CipherRequest(cipherObj);
@@ -219,6 +229,8 @@ describe("Cipher Service", () => {
const spy = jest
.spyOn(apiService, "putCipher")
.mockImplementation(() => Promise.resolve<any>(cipherObj));
// 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
cipherService.updateWithServer(cipherObj);
const expectedObj = new CipherRequest(cipherObj);
@@ -231,6 +243,8 @@ describe("Cipher Service", () => {
const spy = jest
.spyOn(apiService, "putPartialCipher")
.mockImplementation(() => Promise.resolve<any>(cipherObj));
// 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
cipherService.updateWithServer(cipherObj);
const expectedObj = new CipherPartialRequest(cipherObj);

View File

@@ -163,6 +163,8 @@ export class FolderService implements InternalFolderServiceAbstraction {
}
}
if (updates.length > 0) {
// 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.cipherService.upsert(updates);
}
}

View File

@@ -331,6 +331,8 @@ export class SyncService implements SyncServiceAbstraction {
await this.keyConnectorService.setConvertAccountRequired(true);
this.messagingService.send("convertAccountToKeyConnector");
} else {
// 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.keyConnectorService.removeConvertAccountRequired();
}
}