Conform to no-floating-promises (#1725)

This commit is contained in:
Michael Telatynski 2024-06-12 17:17:24 +01:00 committed by GitHub
parent 5c23a23f39
commit 2018a51469
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 22 additions and 20 deletions

View file

@ -114,7 +114,7 @@ async function main(): Promise<number | undefined> {
return 1;
}
await new Promise<boolean>((resolve) => {
await new Promise<boolean>((resolve, reject) => {
const gpgProc = childProcess.execFile("gpg", ["--import"], (error) => {
if (error) {
console.log("Failed to import key", error);
@ -123,9 +123,11 @@ async function main(): Promise<number | undefined> {
}
resolve(!error);
});
fetch(PUB_KEY_URL).then((resp) => {
stream.pipeline(resp.body, gpgProc.stdin!);
});
fetch(PUB_KEY_URL)
.then((resp) => {
stream.pipeline(resp.body, gpgProc.stdin!).catch(reject);
})
.catch(reject);
});
return 0;
}

View file

@ -176,7 +176,7 @@ async function loadConfig(): Promise<void> {
global.vectorConfig = Object.assign(global.vectorConfig, localConfig);
} catch (e) {
if (e instanceof SyntaxError) {
dialog.showMessageBox({
void dialog.showMessageBox({
type: "error",
title: `Your ${global.vectorConfig.brand || "Element"} is misconfigured`,
message:
@ -292,7 +292,7 @@ const warnBeforeExit = (event: Event, input: Input): void => {
}
};
configureSentry();
void configureSentry();
// handle uncaught errors otherwise it displays
// stack traces in popup dialogs, which is terrible (which
@ -442,7 +442,7 @@ app.on("ready", async () => {
console.log('Auto update disabled via command line flag "--no-update"');
} else if (global.vectorConfig["update_base_url"]) {
console.log(`Starting auto update with base URL: ${global.vectorConfig["update_base_url"]}`);
updater.start(global.vectorConfig["update_base_url"]);
void updater.start(global.vectorConfig["update_base_url"]);
} else {
console.log("No update_base_url is defined: auto update is disabled");
}
@ -477,7 +477,7 @@ app.on("ready", async () => {
webgl: true,
},
});
global.mainWindow.loadURL("vector://vector/webapp/");
void global.mainWindow.loadURL("vector://vector/webapp/");
if (process.platform === "darwin") {
setupMacosTitleBar(global.mainWindow);

View file

@ -217,11 +217,11 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
label: r.initial,
backgroundColor: defaultColors[total % defaultColors.length],
click: (): void => {
global.mainWindow?.loadURL(`vector://vector/webapp/#/room/${r.roomId}`);
void global.mainWindow?.loadURL(`vector://vector/webapp/#/room/${r.roomId}`);
},
});
if (r.avatarUrl) {
fetch(r.avatarUrl)
void fetch(r.avatarUrl)
.then((resp) => {
if (!resp.ok) return;
return resp.arrayBuffer();

View file

@ -150,15 +150,15 @@ export function setupMacosTitleBar(window: BrowserWindow): void {
window.on("enter-full-screen", () => {
if (cssKey !== undefined) {
window.webContents.removeInsertedCSS(cssKey);
void window.webContents.removeInsertedCSS(cssKey);
}
});
window.on("leave-full-screen", () => {
applyStyling();
void applyStyling();
});
window.webContents.on("did-finish-load", () => {
if (!window.isFullScreen()) {
applyStyling();
void applyStyling();
}
});
}

View file

@ -50,7 +50,7 @@ function processUrl(url: string): void {
urlToLoad.hash = parsed.hash;
console.log("Opening URL: ", urlToLoad.href);
global.mainWindow.loadURL(urlToLoad.href);
void global.mainWindow.loadURL(urlToLoad.href);
}
function readStore(): Record<string, string> {

View file

@ -43,7 +43,7 @@ function checkSquirrelHooks(): boolean {
switch (cmd) {
case "--squirrel-install":
runUpdateExe(["--createShortcut=" + target]).then(() => app.quit());
void runUpdateExe(["--createShortcut=" + target]).then(() => app.quit());
return true;
case "--squirrel-updated":
@ -52,7 +52,7 @@ function checkSquirrelHooks(): boolean {
return true;
case "--squirrel-uninstall":
runUpdateExe(["--removeShortcut=" + target]).then(() => app.quit());
void runUpdateExe(["--removeShortcut=" + target]).then(() => app.quit());
return true;
default:

View file

@ -140,7 +140,7 @@ export function buildMenuTemplate(): Menu {
// XXX: vectorConfig won't have defaults applied to it so we need to duplicate them here
label: _t("common|brand_help", { brand: global.vectorConfig?.brand || "Element" }),
click(): void {
shell.openExternal(global.vectorConfig?.help_url || "https://element.io/help");
void shell.openExternal(global.vectorConfig?.help_url || "https://element.io/help");
},
},
],

View file

@ -53,7 +53,7 @@ function safeOpenURL(target: string): void {
// so we know the url parser has understood all the parts
// of the input string
const newTarget = url.format(parsedUrl);
shell.openExternal(newTarget);
void shell.openExternal(newTarget);
}
}
@ -169,7 +169,7 @@ function onLinkContextMenu(ev: Event, params: ContextMenuParams, webContents: We
}
} catch (err) {
console.error(err);
dialog.showMessageBox({
void dialog.showMessageBox({
type: "error",
title: _t("right_click_menu|save_image_as_error_title"),
message: _t("right_click_menu|save_image_as_error_description"),
@ -275,7 +275,7 @@ const userDownloadMap = new Map<number, string>(); // Map from id to path
ipcMain.on("userDownloadAction", function (ev: IpcMainEvent, { id, open = false }) {
const path = userDownloadMap.get(id);
if (open && path) {
shell.openPath(path);
void shell.openPath(path);
}
userDownloadMap.delete(id);
});