Conform to no-floating-promises (#27561)

pull/27566/head
Michael Telatynski 2024-06-12 17:17:29 +01:00 committed by GitHub
parent 9039e70990
commit a0eb94704e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 31 additions and 31 deletions

View File

@ -88,6 +88,7 @@ module.exports = {
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-member-accessibility": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-floating-promises": "off",
},
},
],

View File

@ -180,7 +180,7 @@ async function start(): Promise<void> {
// error handling begins here
// ##########################
if (!acceptBrowser) {
await new Promise<void>((resolve) => {
await new Promise<void>((resolve, reject) => {
logger.error("Browser is missing required features.");
// take to a different landing page to AWOOOOOGA at the user
showIncompatibleBrowser(() => {
@ -189,7 +189,7 @@ async function start(): Promise<void> {
}
logger.log("User accepts the compatibility risks.");
resolve();
});
}).catch(reject);
});
}

View File

@ -138,7 +138,7 @@ export async function loadLanguage(): Promise<void> {
}
export async function loadTheme(): Promise<void> {
setTheme();
return setTheme();
}
export async function loadApp(fragParams: {}): Promise<void> {

View File

@ -177,17 +177,17 @@ const setupCompleted = (async (): Promise<string | void> => {
}
}
await widgetApi!.transport.reply(ev.detail, response);
widgetApi!.transport.reply(ev.detail, response);
});
};
handleAction(ElementWidgetActions.JoinCall, async ({ audioInput, videoInput }) => {
joinConference(audioInput as string | null, videoInput as string | null);
void joinConference(audioInput as string | null, videoInput as string | null);
});
handleAction(ElementWidgetActions.HangupCall, async ({ force }) => {
if (force === true) {
meetApi?.dispose();
notifyHangup();
void notifyHangup();
meetApi = undefined;
closeConference();
} else {
@ -297,7 +297,7 @@ function toggleConferenceVisibility(inConference: boolean): void {
function skipToJitsiSplashScreen(): void {
// really just a function alias for self-documenting code
joinConference();
void joinConference();
}
/**
@ -500,8 +500,8 @@ const onVideoConferenceJoined = (): void => {
if (widgetApi) {
// ignored promise because we don't care if it works
// noinspection JSIgnoredPromiseFromCall
widgetApi.setAlwaysOnScreen(true);
widgetApi.transport.send(ElementWidgetActions.JoinCall, {});
void widgetApi.setAlwaysOnScreen(true);
void widgetApi.transport.send(ElementWidgetActions.JoinCall, {});
}
// Video rooms should start in tile mode
@ -509,7 +509,7 @@ const onVideoConferenceJoined = (): void => {
};
const onVideoConferenceLeft = (): void => {
notifyHangup();
void notifyHangup();
meetApi = undefined;
};
@ -517,7 +517,7 @@ const onErrorOccurred = ({ error }: Parameters<ExternalAPIEventCallbacks["errorO
if (error.isFatal) {
// We got disconnected. Since Jitsi Meet might send us back to the
// prejoin screen, we're forced to act as if we hung up entirely.
notifyHangup(error.message);
void notifyHangup(error.message);
meetApi = undefined;
closeConference();
}
@ -525,7 +525,7 @@ const onErrorOccurred = ({ error }: Parameters<ExternalAPIEventCallbacks["errorO
const onAudioMuteStatusChanged = ({ muted }: AudioMuteStatusChangedEvent): void => {
const action = muted ? ElementWidgetActions.MuteAudio : ElementWidgetActions.UnmuteAudio;
widgetApi?.transport.send(action, {});
void widgetApi?.transport.send(action, {});
};
const onVideoMuteStatusChanged = ({ muted }: VideoMuteStatusChangedEvent): void => {
@ -535,15 +535,15 @@ const onVideoMuteStatusChanged = ({ muted }: VideoMuteStatusChangedEvent): void
// otherwise the React SDK will mistakenly think the user turned off
// their video by hand
setTimeout(() => {
if (meetApi) widgetApi?.transport.send(ElementWidgetActions.MuteVideo, {});
if (meetApi) void widgetApi?.transport.send(ElementWidgetActions.MuteVideo, {});
}, 200);
} else {
widgetApi?.transport.send(ElementWidgetActions.UnmuteVideo, {});
void widgetApi?.transport.send(ElementWidgetActions.UnmuteVideo, {});
}
};
const updateParticipants = (): void => {
widgetApi?.transport.send(ElementWidgetActions.CallParticipants, {
void widgetApi?.transport.send(ElementWidgetActions.CallParticipants, {
participants: meetApi?.getParticipantsInfo(),
});
};

View File

@ -120,4 +120,4 @@ async function initPage(): Promise<void> {
}
}
initPage();
void initPage();

View File

@ -167,15 +167,14 @@ export default class ElectronPlatform extends VectorBasePlatform {
});
});
window.electron.on("openDesktopCapturerSourcePicker", () => {
window.electron.on("openDesktopCapturerSourcePicker", async () => {
const { finished } = Modal.createDialog(DesktopCapturerSourcePicker);
finished.then(([source]) => {
// getDisplayMedia promise does not return if no dummy is passed here as source
this.ipc.call("callDisplayMediaCallback", source ?? { id: "", name: "", thumbnailURL: "" });
});
const [source] = await finished;
// getDisplayMedia promise does not return if no dummy is passed here as source
await this.ipc.call("callDisplayMediaCallback", source ?? { id: "", name: "", thumbnailURL: "" });
});
this.ipc.call("startSSOFlow", this.ssoID);
void this.ipc.call("startSSOFlow", this.ssoID);
BreadcrumbsStore.instance.on(UPDATE_EVENT, this.onBreadcrumbsUpdate);
}
@ -195,7 +194,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
),
initial: getInitialLetter(r.name),
}));
this.ipc.call("breadcrumbs", rooms);
void this.ipc.call("breadcrumbs", rooms);
};
private onUpdateDownloaded = async (ev: Event, { releaseNotes, releaseName }: SquirrelUpdate): Promise<void> => {
@ -261,7 +260,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
const handler = notification.onclick as Function;
notification.onclick = (): void => {
handler?.();
this.ipc.call("focusWindow");
void this.ipc.call("focusWindow");
};
return notification;
@ -399,7 +398,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
public navigateForwardBack(back: boolean): void {
this.ipc.call(back ? "navigateBack" : "navigateForward");
void this.ipc.call(back ? "navigateBack" : "navigateForward");
}
public overrideBrowserShortcuts(): boolean {

View File

@ -113,10 +113,10 @@ export default class WebPlatform extends VectorBasePlatform {
// annoyingly, the latest spec says this returns a
// promise, but this is only supported in Chrome 46
// and Firefox 47, so adapt the callback API.
return new Promise(function (resolve) {
return new Promise(function (resolve, reject) {
window.Notification.requestPermission((result) => {
resolve(result);
});
}).catch(reject);
});
}
@ -148,7 +148,7 @@ export default class WebPlatform extends VectorBasePlatform {
// Ideally, loading an old copy would be impossible with the
// cache-control: nocache HTTP header set, but Firefox doesn't always obey it :/
console.log("startUpdater, current version is " + getNormalizedAppVersion(WebPlatform.VERSION));
this.pollForUpdate((version: string, newVersion: string) => {
void this.pollForUpdate((version: string, newVersion: string) => {
const query = parseQs(location);
if (query.updated) {
console.log("Update reloaded but still on an old version, stopping");
@ -207,7 +207,7 @@ export default class WebPlatform extends VectorBasePlatform {
public startUpdateCheck(): void {
super.startUpdateCheck();
this.pollForUpdate(showUpdateToast, hideUpdateToast).then((updateState) => {
void this.pollForUpdate(showUpdateToast, hideUpdateToast).then((updateState) => {
dis.dispatch<CheckUpdatesPayload>({
action: Action.CheckUpdates,
...updateState,

View File

@ -35,7 +35,7 @@ export function initRageshake(): Promise<void> {
// we manually check persistence for rageshakes ourselves
const prom = rageshake.init(/*setUpPersistence=*/ false);
prom.then(
() => {
async () => {
logger.log("Initialised rageshake.");
logger.log(
"To fix line numbers in Chrome: " +
@ -48,7 +48,7 @@ export function initRageshake(): Promise<void> {
rageshake.flush();
});
rageshake.cleanup();
await rageshake.cleanup();
},
(err) => {
logger.error("Failed to initialise rageshake: " + err);