From 4db0a0ac0ca70631a7dd3dd93b7d71e68610435a Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 1 Jul 2021 09:16:49 +0100 Subject: [PATCH] Make eslint happy --- .eslintrc.js | 23 ++++++++++++++++++----- src/preload.ts | 14 ++++++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index b6f9c72..d603b79 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,7 +1,5 @@ module.exports = { - plugins: [ - "matrix-org", - ], + plugins: ["matrix-org"], extends: [ "plugin:matrix-org/javascript", ], @@ -19,5 +17,20 @@ module.exports = { "indent": "off", "prefer-promise-reject-errors": "off", "no-async-promise-executor": "off", - } -} + }, + overrides: [{ + files: ["src/**/*.{ts,tsx}"], + extends: [ + "plugin:matrix-org/typescript", + "plugin:matrix-org/react", + ], + rules: { + // Things we do that break the ideal style + "prefer-promise-reject-errors": "off", + "quotes": "off", + + // We disable this while we're transitioning + "@typescript-eslint/no-explicit-any": "off", + }, + }], +}; diff --git a/src/preload.ts b/src/preload.ts index 491e8b9..9726872 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -36,26 +36,32 @@ const CHANNELS = [ "userDownloadOpen", ]; +interface ISource { + id: string; + name: string; + thumbnailURL: string; +} + contextBridge.exposeInMainWorld( "electron", { - on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void) { + on(channel: string, listener: (event: IpcRendererEvent, ...args: any[]) => void): void { if (!CHANNELS.includes(channel)) { console.error(`Unknown IPC channel ${channel} ignored`); return; } ipcRenderer.on(channel, listener); }, - send(channel: string, ...args: any[]) { + send(channel: string, ...args: any[]): void { if (!CHANNELS.includes(channel)) { console.error(`Unknown IPC channel ${channel} ignored`); return; } ipcRenderer.send(channel, ...args); }, - async getDesktopCapturerSources(options: SourcesOptions) { + async getDesktopCapturerSources(options: SourcesOptions): Promise { const sources = await desktopCapturer.getSources(options); - const desktopCapturerSources = []; + const desktopCapturerSources: ISource[] = []; for (const source of sources) { desktopCapturerSources.push({