mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
style: add no-misused-promises rule (#3547)
Co-authored-by: Peng Xiao <pengxiao@outlook.com>
This commit is contained in:
@@ -115,7 +115,11 @@ function startPollingSecondaryDB(db: WorkspaceSQLiteDB) {
|
||||
const secondaryDB = new SecondaryWorkspaceSQLiteDB(path, db);
|
||||
return new Observable<SecondaryWorkspaceSQLiteDB>(subscriber => {
|
||||
subscriber.next(secondaryDB);
|
||||
return () => secondaryDB.destroy();
|
||||
return () => {
|
||||
secondaryDB.destroy().catch(err => {
|
||||
subscriber.error(err);
|
||||
});
|
||||
};
|
||||
});
|
||||
}),
|
||||
switchMap(secondaryDB => {
|
||||
|
||||
@@ -38,7 +38,7 @@ app.on('second-instance', () => {
|
||||
);
|
||||
});
|
||||
|
||||
app.on('open-url', async (_, _url) => {
|
||||
app.on('open-url', (_, _url) => {
|
||||
// todo: handle `affine://...` urls
|
||||
});
|
||||
|
||||
@@ -54,7 +54,11 @@ app.on('window-all-closed', () => {
|
||||
/**
|
||||
* @see https://www.electronjs.org/docs/v14-x-y/api/app#event-activate-macos Event: 'activate'
|
||||
*/
|
||||
app.on('activate', restoreOrCreateWindow);
|
||||
app.on('activate', () => {
|
||||
restoreOrCreateWindow().catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Create app window when background process will be ready
|
||||
|
||||
@@ -34,7 +34,7 @@ export function getGoogleOauthCode() {
|
||||
logger.error('Failed to open external url', e);
|
||||
reject(e);
|
||||
});
|
||||
const handleOpenUrl = async (_: any, url: string) => {
|
||||
const handleOpenUrl = (_: any, url: string) => {
|
||||
const mainWindow = BrowserWindow.getAllWindows().find(
|
||||
w => !w.isDestroyed()
|
||||
);
|
||||
|
||||
@@ -99,7 +99,9 @@ export const registerUpdater = async () => {
|
||||
});
|
||||
autoUpdater.forceDevUpdateConfig = isDev;
|
||||
|
||||
app.on('activate', async () => {
|
||||
await checkForUpdates(false);
|
||||
app.on('activate', () => {
|
||||
checkForUpdates(false).catch(err => {
|
||||
console.error(err);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
@@ -19,10 +19,15 @@ const mainThread = AsyncCall<{
|
||||
channel: new MessageEventChannel(parentPort),
|
||||
});
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
globalThis.console.log = mainThread.log;
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
globalThis.console.error = mainThread.log;
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
globalThis.console.info = mainThread.log;
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
globalThis.console.debug = mainThread.log;
|
||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||
globalThis.console.warn = mainThread.log;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
|
||||
Reference in New Issue
Block a user