Linting fixes.

This commit is contained in:
Patrick Fic
2025-03-28 15:58:38 -07:00
parent bf3f0205d6
commit ce6e9873a0
10 changed files with 69 additions and 72 deletions

View File

@@ -1,3 +1,5 @@
/* eslint-disable react/prop-types */
//TODO: remove eslint-disable
import { Button, Result } from "antd";
import { FallbackProps } from "react-error-boundary";
import { useTranslation } from "react-i18next";

View File

@@ -1,6 +1,6 @@
import { auth } from "@renderer/util/firebase";
import type { FormProps } from "antd";
import { Alert, Button, Checkbox, Form, Input } from "antd";
import { Alert, Button, Form, Input } from "antd";
import log from "electron-log/renderer";
import { signInWithEmailAndPassword } from "firebase/auth";
import { useState } from "react";

View File

@@ -1,6 +1,5 @@
//Set up all of the IPC handlers.
import {
selectWatcherPolling,
setWatcherPolling,
updateAvailable,
updateChecking,
@@ -19,40 +18,29 @@ const dispatch = store.dispatch;
ipcRenderer.on(
ipcTypes.toRenderer.test,
(event: Electron.IpcRendererEvent, arg) => {
(_event: Electron.IpcRendererEvent, arg) => {
console.log("Received test message from main process");
console.log(arg);
},
);
ipcRenderer.on(
ipcTypes.toRenderer.user.getToken,
async (event: Electron.IpcRendererEvent, arg) => {
const token = await auth.currentUser?.getIdToken();
ipcRenderer.send(ipcTypes.toMain.user.getTokenResponse, token);
},
);
ipcRenderer.on(ipcTypes.toRenderer.user.getToken, async () => {
const token = await auth.currentUser?.getIdToken();
ipcRenderer.send(ipcTypes.toMain.user.getTokenResponse, token);
});
ipcRenderer.on(
ipcTypes.toRenderer.watcher.started,
(event: Electron.IpcRendererEvent, arg) => {
console.log("Watcher has started");
console.log(arg);
dispatch(watcherStarted());
},
);
ipcRenderer.on(ipcTypes.toRenderer.watcher.started, () => {
console.log("Watcher has started");
dispatch(watcherStarted());
});
ipcRenderer.on(
ipcTypes.toRenderer.watcher.stopped,
(event: Electron.IpcRendererEvent, arg) => {
console.log("Watcher has stopped");
console.log(arg);
dispatch(watcherStopped());
},
);
ipcRenderer.on(ipcTypes.toRenderer.watcher.stopped, () => {
console.log("Watcher has stopped");
dispatch(watcherStopped());
});
ipcRenderer.on(
ipcTypes.toRenderer.watcher.error,
(event: Electron.IpcRendererEvent, error: string) => {
(_event: Electron.IpcRendererEvent, error: string) => {
console.log("Watcher has encountered an error");
console.log(error);
dispatch(watcherError(error));
@@ -60,33 +48,29 @@ ipcRenderer.on(
);
//Update Handlers
ipcRenderer.on(
ipcTypes.toRenderer.updates.checking,
(event: Electron.IpcRendererEvent) => {
console.log("Checking for updates...");
dispatch(updateChecking());
},
);
ipcRenderer.on(ipcTypes.toRenderer.updates.checking, () => {
console.log("Checking for updates...");
dispatch(updateChecking());
});
ipcRenderer.on(
ipcTypes.toRenderer.updates.available,
(event: Electron.IpcRendererEvent, arg) => {
dispatch(updateAvailable());
},
);
ipcRenderer.on(ipcTypes.toRenderer.updates.available, () => {
dispatch(updateAvailable());
});
ipcRenderer.on(
ipcTypes.toRenderer.updates.downloading,
(event: Electron.IpcRendererEvent, arg) => {
(_event: Electron.IpcRendererEvent, arg) => {
dispatch(updateProgress({ progress: arg.progress, speed: arg.speed }));
},
);
ipcRenderer.on(ipcTypes.toRenderer.updates.downloaded, () => {
dispatch(updateDownloaded());
});
ipcRenderer.on(
ipcTypes.toRenderer.updates.downloaded,
(event: Electron.IpcRendererEvent, arg) => {
dispatch(updateDownloaded());
ipcTypes.toRenderer.watcher.polling,
(_event: Electron.IpcRendererEvent, arg) => {
dispatch(
setWatcherPolling({ enabled: arg.enabled, interval: arg.interval }),
);
},
);
ipcRenderer.on(ipcTypes.toRenderer.watcher.polling, (event, arg) => {
dispatch(setWatcherPolling({ enabled: arg.enabled, interval: arg.interval }));
});

View File

@@ -1,3 +1,4 @@
// eslint-disable-all
import { createContext, useContext } from "react";
import { notification } from "antd";
@@ -10,6 +11,7 @@ const NotificationContext = createContext(null);
/**
* A custom hook to make usage easier in child components.
*/
// eslint-disable-next-line react-refresh/only-export-components, @typescript-eslint/explicit-function-return-type
export const useNotification = () => {
return useContext(NotificationContext);
};
@@ -20,7 +22,14 @@ export const useNotification = () => {
* - Render contextHolder somewhere high-level in your app (so the notifications mount properly).
* - Provide `api` via the NotificationContext.
*/
export const NotificationProvider = ({ children }) => {
interface NotificationProviderProps {
children?: React.ReactNode | React.ReactNode[];
}
export const NotificationProvider: React.FC<NotificationProviderProps> = ({
// eslint-disable-next-line react/prop-types
children, //TODO: Unable to resolve this. Adding an eslint disable.
}) => {
const [api, contextHolder] = notification.useNotification({
placement: "bottomRight",
bottom: 70,