From f9673b1a5a9d1b1461b014f19c89a544cb275228 Mon Sep 17 00:00:00 2001 From: caduHD4 Date: Sun, 21 Sep 2025 18:14:35 -0300 Subject: [PATCH] fix: adjusting lint formatting --- .../game-context-menu/game-context-menu.tsx | 23 ++++-- .../game-context-menu/use-game-actions.ts | 76 ++++++++++++++----- .../game-details/game-details.context.tsx | 23 ++++-- 3 files changed, 89 insertions(+), 33 deletions(-) diff --git a/src/renderer/src/components/game-context-menu/game-context-menu.tsx b/src/renderer/src/components/game-context-menu/game-context-menu.tsx index f772e46e..bb341a3a 100644 --- a/src/renderer/src/components/game-context-menu/game-context-menu.tsx +++ b/src/renderer/src/components/game-context-menu/game-context-menu.tsx @@ -18,7 +18,7 @@ import { ContextMenu, ContextMenuItemData, ContextMenuProps } from ".."; import { ConfirmModal } from "@renderer/components/confirm-modal/confirm-modal"; import { useGameActions } from ".."; -interface GameContextMenuProps extends Omit { +interface GameContextMenuProps extends Omit { game: LibraryGame; } @@ -29,7 +29,8 @@ export function GameContextMenu({ onClose, }: GameContextMenuProps) { const { t } = useTranslation("game_details"); - const [showConfirmRemoveLibrary, setShowConfirmRemoveLibrary] = useState(false); + const [showConfirmRemoveLibrary, setShowConfirmRemoveLibrary] = + useState(false); const [showConfirmRemoveFiles, setShowConfirmRemoveFiles] = useState(false); const { canPlay, @@ -54,14 +55,22 @@ export function GameContextMenu({ id: "play", label: canPlay ? t("play") : t("download"), icon: canPlay ? : , - onClick: handlePlayGame, + onClick: () => { + void handlePlayGame(); + }, disabled: isDeleting, }, { id: "favorite", label: game.favorite ? t("remove_from_favorites") : t("add_to_favorites"), - icon: game.favorite ? : , - onClick: handleToggleFavorite, + icon: game.favorite ? ( + + ) : ( + + ), + onClick: () => { + void handleToggleFavorite(); + }, disabled: isDeleting, }, ...(game.executablePath @@ -181,7 +190,9 @@ export function GameContextMenu({ visible={visible} position={position} onClose={onClose} - className={!game.executablePath ? "context-menu--game-not-installed" : undefined} + className={ + !game.executablePath ? "context-menu--game-not-installed" : undefined + } /> { if (!canPlay) { @@ -37,17 +39,25 @@ export function useGameActions(game: LibraryGame) { if (location.pathname === path) { try { window.dispatchEvent( - new CustomEvent("hydra:openRepacks", { detail: { objectId: game.objectId } }) + new CustomEvent("hydra:openRepacks", { + detail: { objectId: game.objectId }, + }) ); - } catch (e) {} + } catch (e) { + void e; + } } else { navigate(path, { state: { openRepacks: true } }); try { window.dispatchEvent( - new CustomEvent("hydra:openRepacks", { detail: { objectId: game.objectId } }) + new CustomEvent("hydra:openRepacks", { + detail: { objectId: game.objectId }, + }) ); - } catch (e) {} + } catch (e) { + void e; + } } return; } @@ -76,10 +86,16 @@ export function useGameActions(game: LibraryGame) { } updateLibrary(); try { - window.dispatchEvent(new CustomEvent("hydra:game-favorite-toggled", { detail: { shop: game.shop, objectId: game.objectId } })); - } catch (e) {} + window.dispatchEvent( + new CustomEvent("hydra:game-favorite-toggled", { + detail: { shop: game.shop, objectId: game.objectId }, + }) + ); + } catch (e) { + void e; + } } catch (error) { - showErrorToast(t("failed_update_favorites")); + showErrorToast(t("failed_update_favorites")); logger.error("Failed to toggle favorite", error); } }; @@ -91,7 +107,7 @@ export function useGameActions(game: LibraryGame) { game.objectId, location ); - + if (success) { showSuccessToast(t("create_shortcut_success")); } else { @@ -138,9 +154,12 @@ export function useGameActions(game: LibraryGame) { try { window.dispatchEvent( - new CustomEvent("hydra:openRepacks", { detail: { objectId: game.objectId } }) + new CustomEvent("hydra:openRepacks", { + detail: { objectId: game.objectId }, + }) ); } catch (e) { + void e; } }; @@ -154,9 +173,12 @@ export function useGameActions(game: LibraryGame) { try { window.dispatchEvent( - new CustomEvent("hydra:openGameOptions", { detail: { objectId: game.objectId } }) + new CustomEvent("hydra:openGameOptions", { + detail: { objectId: game.objectId }, + }) ); } catch (e) { + void e; } }; @@ -179,8 +201,14 @@ export function useGameActions(game: LibraryGame) { updateLibrary(); showSuccessToast(t("game_removed_from_library")); try { - window.dispatchEvent(new CustomEvent("hydra:game-removed-from-library", { detail: { shop: game.shop, objectId: game.objectId } })); - } catch (e) {} + window.dispatchEvent( + new CustomEvent("hydra:game-removed-from-library", { + detail: { shop: game.shop, objectId: game.objectId }, + }) + ); + } catch (e) { + void e; + } } catch (error) { showErrorToast(t("failed_remove_from_library")); logger.error("Failed to remove from library", error); @@ -193,8 +221,14 @@ export function useGameActions(game: LibraryGame) { updateLibrary(); showSuccessToast(t("files_removed_success")); try { - window.dispatchEvent(new CustomEvent("hydra:game-files-removed", { detail: { shop: game.shop, objectId: game.objectId } })); - } catch (e) {} + window.dispatchEvent( + new CustomEvent("hydra:game-files-removed", { + detail: { shop: game.shop, objectId: game.objectId }, + }) + ); + } catch (e) { + void e; + } } catch (error) { showErrorToast(t("failed_remove_files")); logger.error("Failed to remove files", error); @@ -219,4 +253,4 @@ export function useGameActions(game: LibraryGame) { handleRemoveFiles, handleOpenGameOptions, }; -} \ No newline at end of file +} diff --git a/src/renderer/src/context/game-details/game-details.context.tsx b/src/renderer/src/context/game-details/game-details.context.tsx index edfc503b..d83d9494 100644 --- a/src/renderer/src/context/game-details/game-details.context.tsx +++ b/src/renderer/src/context/game-details/game-details.context.tsx @@ -182,7 +182,7 @@ export function GameDetailsContextProvider({ if (abortController.signal.aborted) return; setAchievements(achievements); }) - .catch(() => {}); + .catch(() => void 0); } }, [ updateGame, @@ -204,12 +204,15 @@ export function GameDetailsContextProvider({ }, [objectId, gameTitle, dispatch]); useEffect(() => { - const state: any = (location && (location.state as any)) || {}; + const state = + (location && (location.state as Record)) || {}; if (state.openRepacks) { setShowRepacksModal(true); try { window.history.replaceState({}, document.title, location.pathname); - } catch (_e) {} + } catch (_e) { + void _e; + } } }, [location]); @@ -239,6 +242,7 @@ export function GameDetailsContextProvider({ setShowRepacksModal(true); } } catch (e) { + void e; } }; @@ -257,24 +261,31 @@ export function GameDetailsContextProvider({ setShowGameOptionsModal(true); } } catch (e) { + void e; } }; window.addEventListener("hydra:openGameOptions", handler as EventListener); return () => { - window.removeEventListener("hydra:openGameOptions", handler as EventListener); + window.removeEventListener( + "hydra:openGameOptions", + handler as EventListener + ); }; }, [objectId]); useEffect(() => { - const state: any = (location && (location.state as any)) || {}; + const state = + (location && (location.state as Record)) || {}; if (state.openGameOptions) { setShowGameOptionsModal(true); try { window.history.replaceState({}, document.title, location.pathname); - } catch (_e) {} + } catch (_e) { + void _e; + } } }, [location]);