mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-11 18:41:47 +00:00
fix: apply fix from eslint
This commit is contained in:
@ -34,11 +34,12 @@ const createContext = (
|
||||
win.webContents.send(event, ...args);
|
||||
},
|
||||
handle: (event: string, listener: CallableFunction) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-return,@typescript-eslint/no-unsafe-call
|
||||
ipcMain.handle(event, (_, ...args: unknown[]) => listener(...args));
|
||||
},
|
||||
on: (event: string, listener: CallableFunction) => {
|
||||
ipcMain.on(event, (_, ...args: unknown[]) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
listener(...args);
|
||||
});
|
||||
},
|
||||
@ -75,11 +76,11 @@ export const forceUnloadMainPlugin = async (
|
||||
);
|
||||
return;
|
||||
} else {
|
||||
console.log(
|
||||
LoggerPrefix,
|
||||
t('common.console.plugins.unload-failed', { pluginName: id }),
|
||||
);
|
||||
return Promise.reject();
|
||||
const message = t('common.console.plugins.unload-failed', {
|
||||
pluginName: id,
|
||||
});
|
||||
console.log(LoggerPrefix, message);
|
||||
return Promise.reject(new Error(message));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(
|
||||
@ -87,7 +88,7 @@ export const forceUnloadMainPlugin = async (
|
||||
t('common.console.plugins.unload-failed', { pluginName: id }),
|
||||
);
|
||||
console.trace(err);
|
||||
return Promise.reject(err);
|
||||
return Promise.reject(err as Error);
|
||||
}
|
||||
};
|
||||
|
||||
@ -111,11 +112,11 @@ export const forceLoadMainPlugin = async (
|
||||
) {
|
||||
loadedPluginMap[id] = plugin;
|
||||
} else {
|
||||
console.log(
|
||||
LoggerPrefix,
|
||||
t('common.console.plugins.load-failed', { pluginName: id }),
|
||||
);
|
||||
return Promise.reject();
|
||||
const message = t('common.console.plugins.load-failed', {
|
||||
pluginName: id,
|
||||
});
|
||||
console.log(LoggerPrefix, message);
|
||||
return Promise.reject(new Error(message));
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(
|
||||
@ -123,7 +124,7 @@ export const forceLoadMainPlugin = async (
|
||||
t('common.console.plugins.initialize-failed', { pluginName: id }),
|
||||
);
|
||||
console.trace(err);
|
||||
return Promise.reject(err);
|
||||
return Promise.reject(err as Error);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -18,7 +18,8 @@ const loadedPluginMap: Record<
|
||||
export const createContext = <Config extends PluginConfig>(
|
||||
id: string,
|
||||
): RendererContext<Config> => ({
|
||||
getConfig: async () => window.ipcRenderer.invoke('ytmd:get-config', id),
|
||||
getConfig: async () =>
|
||||
window.ipcRenderer.invoke('ytmd:get-config', id) as Promise<Config>,
|
||||
setConfig: async (newConfig) => {
|
||||
await window.ipcRenderer.invoke('ytmd:set-config', id, newConfig);
|
||||
},
|
||||
@ -30,6 +31,7 @@ export const createContext = <Config extends PluginConfig>(
|
||||
window.ipcRenderer.invoke(event, ...args),
|
||||
on: (event: string, listener: CallableFunction) => {
|
||||
window.ipcRenderer.on(event, (_, ...args: unknown[]) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||
listener(...args);
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user