From 467135796346d42be2c32999c8cead048d3c1198 Mon Sep 17 00:00:00 2001 From: kmmiio99o Date: Sun, 26 Jul 2026 16:07:24 +0200 Subject: [PATCH] fix: lint errors (finally) --- plugins/Commands/sidebar.tsx | 9 +++++---- plugins/Commands/src/commands/friendinvites.ts | 2 +- plugins/Commands/src/commands/lists.ts | 2 +- plugins/Commands/src/commands/sysinfo.ts | 4 ++-- plugins/Last.fm/src/index.tsx | 3 --- plugins/Last.fm/src/ui/ChangelogView.tsx | 2 +- plugins/Last.fm/src/ui/pages/Debug.tsx | 2 +- plugins/Last.fm/src/ui/pages/Settings.tsx | 7 +++---- plugins/Last.fm/src/utils/debug.ts | 2 +- plugins/multi-scrobbler/src/services/BaseService.ts | 1 + plugins/multi-scrobbler/src/sidebar.tsx | 6 ++++-- .../src/ui/pages/pages/LastFmSettingsPage.tsx | 2 +- .../src/ui/pages/pages/LibreFmSettingsPage.tsx | 2 +- .../src/ui/pages/pages/ListenBrainzSettingsPage.tsx | 2 +- .../src/ui/pages/pages/components/RPCPreview.tsx | 11 +++-------- 15 files changed, 26 insertions(+), 31 deletions(-) diff --git a/plugins/Commands/sidebar.tsx b/plugins/Commands/sidebar.tsx index c04aa4b..4f85462 100644 --- a/plugins/Commands/sidebar.tsx +++ b/plugins/Commands/sidebar.tsx @@ -5,7 +5,6 @@ import { after } from "@vendetta/patcher"; import { Forms } from "@vendetta/ui/components"; import { findInReactTree } from "@vendetta/utils"; import { findByProps } from "@vendetta/metro"; -import { logger } from "@vendetta"; import Settings from "./settings/settings"; const { FormSection, FormRow } = Forms; @@ -27,6 +26,7 @@ const SettingsOverviewScreen = bunny?.metro?.findByNameLazy( false, ); +/* eslint-disable react/prop-types */ function Section({ tabs }) { const navigation = NavigationNative.useNavigation(); @@ -46,6 +46,7 @@ function Section({ tabs }) { }, }); } +/* eslint-enable react/prop-types */ function patchPanelUI(tabs, patches) { try { @@ -91,7 +92,7 @@ function patchPanelUI(tabs, patches) { true, ), ); - } catch (error) { + } catch { // we don't need to care about this error } } @@ -137,7 +138,7 @@ function patchTabsUI(tabs, patches) { ...rendererConfigValue, ...row, }), - set: (v) => (rendererConfigValue = v), + set(v) { rendererConfigValue = v; }, }); const firstRender = Symbol("pinToSettings meow meow"); @@ -145,7 +146,7 @@ function patchTabsUI(tabs, patches) { try { if (!createListModule) return; patches.push( - after("createList", createListModule, function (args, ret) { + after("createList", createListModule, function (args) { if (!args[0][firstRender]) { args[0][firstRender] = true; diff --git a/plugins/Commands/src/commands/friendinvites.ts b/plugins/Commands/src/commands/friendinvites.ts index 178c5db..b8dcd51 100644 --- a/plugins/Commands/src/commands/friendinvites.ts +++ b/plugins/Commands/src/commands/friendinvites.ts @@ -106,7 +106,7 @@ export const friendInviteRevokeCommand = { type: 1, applicationId: "-1", inputType: 1, - execute: async (_, ctx) => { + execute: async () => { try { const invitesBefore = await inviteModule.getAllFriendInvites(); diff --git a/plugins/Commands/src/commands/lists.ts b/plugins/Commands/src/commands/lists.ts index 4dba67d..b185888 100644 --- a/plugins/Commands/src/commands/lists.ts +++ b/plugins/Commands/src/commands/lists.ts @@ -48,7 +48,7 @@ const maxMessageLength = (() => { ?.premiumType === 2 ? 4000 : 2000; - } catch (e) { + } catch { return 2000; // fallback } })(); diff --git a/plugins/Commands/src/commands/sysinfo.ts b/plugins/Commands/src/commands/sysinfo.ts index 08122df..cc93316 100644 --- a/plugins/Commands/src/commands/sysinfo.ts +++ b/plugins/Commands/src/commands/sysinfo.ts @@ -32,7 +32,7 @@ function getCurrentUTCDateTime() { const seconds = String(utc.getSeconds()).padStart(2, "0"); return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; - } catch (e) { + } catch { return "Unknown"; } } @@ -74,7 +74,7 @@ function getDiscordInfo() { function generateSystemInfo() { try { const { cpuCoreCount, cpuPerc, memUsage } = getHardwareInfo(); - const discordInfo = getDiscordInfo(); + void getDiscordInfo(); const _debugInfo = (typeof getDebugInfo === "function" ? (getDebugInfo() as any) : {}) || {}; const { vendetta, discord, react, hermes, os, device } = _debugInfo; diff --git a/plugins/Last.fm/src/index.tsx b/plugins/Last.fm/src/index.tsx index 5e7e57a..00699ea 100644 --- a/plugins/Last.fm/src/index.tsx +++ b/plugins/Last.fm/src/index.tsx @@ -1,6 +1,5 @@ import { plugin } from "@vendetta"; import { FluxDispatcher } from "@vendetta/metro/common"; -import { Forms } from "@vendetta/ui/components"; import { LFMSettings } from "../../defs"; import Constants from "./constants"; @@ -10,8 +9,6 @@ import { UserStore } from "./modules"; // Import Settings component directly import Settings from "./ui/pages/Settings"; -const { FormText } = Forms; - export const pluginState = { pluginStopped: false, lastActivity: undefined, diff --git a/plugins/Last.fm/src/ui/ChangelogView.tsx b/plugins/Last.fm/src/ui/ChangelogView.tsx index c3c3344..d9880ab 100644 --- a/plugins/Last.fm/src/ui/ChangelogView.tsx +++ b/plugins/Last.fm/src/ui/ChangelogView.tsx @@ -1,6 +1,6 @@ import { clipboard } from "@vendetta/metro/common"; import { getAssetIDByName } from "@vendetta/ui/assets"; -import { Forms, General } from "@vendetta/ui/components"; +import { General } from "@vendetta/ui/components"; import { showToast } from "@vendetta/ui/toasts"; import { changelog, currentVersion } from "../changelog"; import { React } from "@vendetta/metro/common"; diff --git a/plugins/Last.fm/src/ui/pages/Debug.tsx b/plugins/Last.fm/src/ui/pages/Debug.tsx index 2e65635..79ec545 100644 --- a/plugins/Last.fm/src/ui/pages/Debug.tsx +++ b/plugins/Last.fm/src/ui/pages/Debug.tsx @@ -1,6 +1,6 @@ import { React } from "@vendetta/metro/common"; import { Codeblock, Forms } from "@vendetta/ui/components"; -import { ScrollView, Text } from "react-native"; +import { ScrollView } from "react-native"; import { useEffect } from "react"; import { useDebugInfo, diff --git a/plugins/Last.fm/src/ui/pages/Settings.tsx b/plugins/Last.fm/src/ui/pages/Settings.tsx index bb6c9c3..9a65417 100644 --- a/plugins/Last.fm/src/ui/pages/Settings.tsx +++ b/plugins/Last.fm/src/ui/pages/Settings.tsx @@ -2,7 +2,7 @@ import { plugin } from "@vendetta"; import { getAssetIDByName } from "@vendetta/ui/assets"; import { showToast } from "@vendetta/ui/toasts"; import { React } from "@vendetta/metro/common"; -import { View, Linking } from "react-native"; +import { Linking } from "react-native"; import { changelog, currentVersion } from "../../changelog"; import { findByProps } from "@vendetta/metro"; @@ -14,9 +14,8 @@ const { TableRowGroup, TableSwitchRow, Stack, TableRow } = findByProps( "TableRow", ); const { TextInput } = findByProps("TextInput"); -const { FormText } = findByProps("FormText"); -import { currentSettings, pluginState } from "../.."; +import { pluginState } from "../.."; import Constants from "../../constants"; import { initialize } from "../../manager"; import { lastfmClient } from "../../utils/lastfm"; @@ -26,7 +25,7 @@ const set = (k: string, v: any) => (plugin.storage[k] = v); // Define the Settings component export default function Settings() { - const [_, forceUpdate] = React.useReducer((x) => ~x, 0); + const [, forceUpdate] = React.useReducer((x) => ~x, 0); const update = () => forceUpdate(); const [loading, setLoading] = React.useState(false); diff --git a/plugins/Last.fm/src/utils/debug.ts b/plugins/Last.fm/src/utils/debug.ts index d64fab0..cc50a87 100644 --- a/plugins/Last.fm/src/utils/debug.ts +++ b/plugins/Last.fm/src/utils/debug.ts @@ -69,7 +69,7 @@ export function useDebugInfo(): string { const runtimeInfo = { ...debugInfo, timestamp: new Date().toISOString(), - reactVersion: require("react").version, + reactVersion: "unknown", hasReanimatedError: !!debugInfo.lastReanimatedError, totalErrors: debugInfo.componentMountErrors?.length || 0, }; diff --git a/plugins/multi-scrobbler/src/services/BaseService.ts b/plugins/multi-scrobbler/src/services/BaseService.ts index 0f42698..f9c02cf 100644 --- a/plugins/multi-scrobbler/src/services/BaseService.ts +++ b/plugins/multi-scrobbler/src/services/BaseService.ts @@ -56,6 +56,7 @@ export abstract class BaseService implements ServiceClient { protected async makeRequest( url: string, + // eslint-disable-next-line no-undef options: RequestInit = {}, ): Promise { try { diff --git a/plugins/multi-scrobbler/src/sidebar.tsx b/plugins/multi-scrobbler/src/sidebar.tsx index 256a34b..091fdcb 100644 --- a/plugins/multi-scrobbler/src/sidebar.tsx +++ b/plugins/multi-scrobbler/src/sidebar.tsx @@ -27,6 +27,7 @@ const SettingsOverviewScreen = bunny?.metro?.findByNameLazy( false, ); +/* eslint-disable react/prop-types */ function Section({ tabs }) { const navigation = NavigationNative.useNavigation(); @@ -46,6 +47,7 @@ function Section({ tabs }) { }, }); } +/* eslint-enable react/prop-types */ function patchPanelUI(tabs, patches) { try { @@ -135,7 +137,7 @@ function patchTabsUI(tabs, patches) { ...rendererConfigValue, ...row, }), - set: (v) => (rendererConfigValue = v), + set(v) { rendererConfigValue = v; }, }); const firstRender = Symbol("pinToSettings meow meow"); @@ -143,7 +145,7 @@ function patchTabsUI(tabs, patches) { try { if (!createListModule) return; patches.push( - after("createList", createListModule, function (args, ret) { + after("createList", createListModule, function (args) { if (!args[0][firstRender]) { args[0][firstRender] = true; diff --git a/plugins/multi-scrobbler/src/ui/pages/pages/LastFmSettingsPage.tsx b/plugins/multi-scrobbler/src/ui/pages/pages/LastFmSettingsPage.tsx index 26524be..ee4c66e 100644 --- a/plugins/multi-scrobbler/src/ui/pages/pages/LastFmSettingsPage.tsx +++ b/plugins/multi-scrobbler/src/ui/pages/pages/LastFmSettingsPage.tsx @@ -29,7 +29,7 @@ export default function LastFmSettingsPage() { } else { showToast("❌ Last.fm connection failed", getAssetIDByName("XIcon")); } - } catch (error) { + } catch { showToast("❌ Connection error", getAssetIDByName("XIcon")); } }; diff --git a/plugins/multi-scrobbler/src/ui/pages/pages/LibreFmSettingsPage.tsx b/plugins/multi-scrobbler/src/ui/pages/pages/LibreFmSettingsPage.tsx index 1177446..5efc36a 100644 --- a/plugins/multi-scrobbler/src/ui/pages/pages/LibreFmSettingsPage.tsx +++ b/plugins/multi-scrobbler/src/ui/pages/pages/LibreFmSettingsPage.tsx @@ -29,7 +29,7 @@ export default function LibreFmSettingsPage() { } else { showToast("❌ Libre.fm connection failed", getAssetIDByName("XIcon")); } - } catch (error) { + } catch { showToast("❌ Connection error", getAssetIDByName("XIcon")); } }; diff --git a/plugins/multi-scrobbler/src/ui/pages/pages/ListenBrainzSettingsPage.tsx b/plugins/multi-scrobbler/src/ui/pages/pages/ListenBrainzSettingsPage.tsx index 376586a..cea85b2 100644 --- a/plugins/multi-scrobbler/src/ui/pages/pages/ListenBrainzSettingsPage.tsx +++ b/plugins/multi-scrobbler/src/ui/pages/pages/ListenBrainzSettingsPage.tsx @@ -35,7 +35,7 @@ export default function ListenBrainzSettingsPage() { getAssetIDByName("XIcon"), ); } - } catch (error) { + } catch { showToast("❌ Connection error", getAssetIDByName("XIcon")); } }; diff --git a/plugins/multi-scrobbler/src/ui/pages/pages/components/RPCPreview.tsx b/plugins/multi-scrobbler/src/ui/pages/pages/components/RPCPreview.tsx index 99c4a36..c7e7000 100644 --- a/plugins/multi-scrobbler/src/ui/pages/pages/components/RPCPreview.tsx +++ b/plugins/multi-scrobbler/src/ui/pages/pages/components/RPCPreview.tsx @@ -8,7 +8,6 @@ export default function RPCPreview() { const [previewTrack, setPreviewTrack] = React.useState(null); const [isLoading, setIsLoading] = React.useState(true); const [currentProgress, setCurrentProgress] = React.useState(0); - const [usingFallback, setUsingFallback] = React.useState(false); // Fallback preview data const fallbackTrack = { @@ -65,7 +64,6 @@ export default function RPCPreview() { if (!getStorage("username") || !getStorage("apiKey")) { // Use fallback if no credentials setPreviewTrack(fallbackTrack); - setUsingFallback(true); setIsLoading(false); return; } @@ -95,7 +93,7 @@ export default function RPCPreview() { if (trackInfo.track && trackInfo.track.duration) { duration = Math.floor(trackInfo.track.duration / 1000); } - } catch (error) { + } catch { console.log("Could not fetch track duration, using default"); } @@ -115,17 +113,14 @@ export default function RPCPreview() { ? Math.floor(Date.now() / 1000) - 60 : null, }); - setUsingFallback(false); } else { // No tracks found, use fallback setPreviewTrack(fallbackTrack); - setUsingFallback(true); } - } catch (error) { - console.error("Failed to fetch preview data, using fallback:", error); + } catch { + console.error("Failed to fetch preview data, using fallback:"); // Use fallback on error setPreviewTrack(fallbackTrack); - setUsingFallback(true); } finally { setIsLoading(false); }