feat: add new rule for floating promise (#2726)

Co-authored-by: Himself65 <himself65@outlook.com>
(cherry picked from commit bedf838fe5)
This commit is contained in:
Peng Xiao
2023-06-08 17:54:25 +08:00
committed by himself65
parent 336ff5220f
commit 9429018221
45 changed files with 221 additions and 134 deletions

View File

@@ -28,10 +28,12 @@ export const getExchangeTokenParams = (code: string) => {
};
export function getGoogleOauthCode() {
shell.openExternal(oauthEndpoint);
return new Promise<ReturnType<typeof getExchangeTokenParams>>(
(resolve, reject) => {
shell.openExternal(oauthEndpoint).catch(e => {
logger.error('Failed to open external url', e);
reject(e);
});
const handleOpenUrl = async (_: any, url: string) => {
const mainWindow = BrowserWindow.getAllWindows().find(
w => !w.isDestroyed()