Fix @typescript-eslint/no-floating-promises errors

This commit is contained in:
Labhansh Agrawal 2021-03-28 22:12:20 +05:30
parent b9aa271bfc
commit 76912a3d27
13 changed files with 27 additions and 23 deletions

View file

@ -104,7 +104,6 @@
"@typescript-eslint/ban-types": "off",
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/no-misused-promises": "off",
"@typescript-eslint/no-unnecessary-type-assertion": "off",
"@typescript-eslint/no-unsafe-assignment": "off",

View file

@ -26,7 +26,7 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
focusedWindow?.rpc.emit('termgroup close req');
},
'window:preferences': () => {
openConfig();
void openConfig();
},
'editor:clearBuffer': (focusedWindow) => {
focusedWindow?.rpc.emit('session clear req');
@ -118,7 +118,7 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
focusedWindow?.rpc.emit('session search close');
},
'cli:install': () => {
installCLI(true);
void installCLI(true);
},
'window:hamburgerMenu': () => {
if (process.platform !== 'darwin' && ['', true].includes(getConfig().showHamburgerMenu)) {

View file

@ -59,9 +59,14 @@ const _watch = () => {
app.on('before-quit', (e) => {
if (Object.keys(_watcher.getWatched()).length > 0) {
e.preventDefault();
_watcher.close().then(() => {
app.quit();
});
_watcher
.close()
.catch((err) => {
console.warn(err);
})
.finally(() => {
app.quit();
});
}
});
};

View file

@ -127,7 +127,7 @@ app.on('ready', () =>
const hwin = newWindow({width, height, x: startX, y: startY}, cfg, fn);
windowSet.add(hwin);
hwin.loadURL(url);
void hwin.loadURL(url);
// the window can be closed by the browser process itself
hwin.on('close', () => {
@ -191,7 +191,7 @@ app.on('ready', () =>
console.log('Removing Hyper from default client for ssh:// protocol');
app.removeAsDefaultProtocolClient('ssh');
}
installCLI(false);
void installCLI(false);
}
})
.catch((err) => {

View file

@ -51,7 +51,7 @@ export const createMenu = (
.map(([type, count]) => type + (count > 1 ? ` (${count})` : ''))
.join(', ');
dialog.showMessageBox({
void dialog.showMessageBox({
title: `About ${appName}`,
message: `${appName} ${appVersion} (${updateChannel})`,
detail: `Renderers: ${renderers}\nPlugins: ${pluginList}\n\nCreated by Guillermo Rauch\nCopyright © 2020 Vercel, Inc.`,

View file

@ -9,7 +9,7 @@ export default (commands: Record<string, string>, showAbout: () => void): MenuIt
{
label: `${app.name} Website`,
click() {
shell.openExternal('https://hyper.is');
void shell.openExternal('https://hyper.is');
}
},
{
@ -60,7 +60,7 @@ ${JSON.stringify(getPlugins(), null, 2)}
const issueURL = `https://github.com/vercel/hyper/issues/new?body=${encodeURIComponent(body)}`;
const copyAndSend = () => {
clipboard.writeText(body);
shell.openExternal(
void shell.openExternal(
`https://github.com/vercel/hyper/issues/new?body=${encodeURIComponent(
'<!-- We have written the needed data into your clipboard because it was too large to send. ' +
'Please paste. -->\n'
@ -70,7 +70,7 @@ ${JSON.stringify(getPlugins(), null, 2)}
if (!focusedWindow) {
copyAndSend();
} else if (issueURL.length > 6144) {
dialog
void dialog
.showMessageBox(focusedWindow, {
message:
'There is too much data to send to GitHub directly. The data will be copied to the clipboard, ' +
@ -84,7 +84,7 @@ ${JSON.stringify(getPlugins(), null, 2)}
}
});
} else {
shell.openExternal(issueURL);
void shell.openExternal(issueURL);
}
}
}

View file

@ -213,7 +213,7 @@ function syncPackageJSON() {
}
function alert(message: string) {
dialog.showMessageBox({
void dialog.showMessageBox({
message,
buttons: ['Ok']
});

View file

@ -206,7 +206,7 @@ export function newWindow(
setRendererType(uid, type);
});
rpc.on('open external', ({url}) => {
shell.openExternal(url);
void shell.openExternal(url);
});
rpc.on('open context menu', (selection) => {
const {createWindow} = app;
@ -277,7 +277,7 @@ export function newWindow(
const protocol = typeof url === 'string' && parseUrl(url).protocol;
if (protocol === 'http:' || protocol === 'https:') {
event.preventDefault();
shell.openExternal(url);
void shell.openExternal(url);
}
});

View file

@ -61,7 +61,7 @@ async function init() {
export default (win: BrowserWindow) => {
if (!isInit) {
init();
void init();
}
const {rpc} = win;

View file

@ -157,7 +157,7 @@ args.command(
(name, args_) => {
const pluginName = args_[0];
assertPluginName(pluginName);
open(`http://ghub.io/${pluginName}`, {wait: false});
void open(`http://ghub.io/${pluginName}`, {wait: false});
process.exit(0);
},
['d', 'h', 'home']

View file

@ -51,7 +51,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
key="link"
style={{color: '#fff'}}
onClick={(ev) => {
window.require('electron').shell.openExternal(ev.currentTarget.href);
void window.require('electron').shell.openExternal(ev.currentTarget.href);
ev.preventDefault();
}}
href={this.props.messageURL}
@ -78,7 +78,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
<a
style={{color: '#000'}}
onClick={(ev) => {
window.require('electron').shell.openExternal(ev.currentTarget.href);
void window.require('electron').shell.openExternal(ev.currentTarget.href);
ev.preventDefault();
}}
href={`https://github.com/vercel/hyper/releases/tag/${this.props.updateVersion}`}
@ -106,7 +106,7 @@ export default class Notifications extends React.PureComponent<NotificationsProp
fontWeight: 'bold'
}}
onClick={(ev) => {
window.require('electron').shell.openExternal(ev.currentTarget.href);
void window.require('electron').shell.openExternal(ev.currentTarget.href);
ev.preventDefault();
}}
href={this.props.updateReleaseUrl!}

View file

@ -158,7 +158,7 @@ export default class Term extends React.PureComponent<TermProps> {
this.term.loadAddon(
new WebLinksAddon(
(event: MouseEvent | undefined, uri: string) => {
if (shallActivateWebLink(event)) shell.openExternal(uri);
if (shallActivateWebLink(event)) void shell.openExternal(uri);
},
{
// prevent default electron link handling to allow selection, e.g. via double-click

View file

@ -39,7 +39,7 @@ const fetchFileData = (configData: configOptions) => {
return;
}
getBase64FileData(configInfo.bellSoundURL).then((base64FileData) => {
void getBase64FileData(configInfo.bellSoundURL).then((base64FileData) => {
// prepend "base64," to the result of this method in order for this to work properly within xterm.js
const bellSound = !base64FileData ? null : 'base64,' + base64FileData;
configInfo.bellSound = bellSound;