From 180059b022b78649e27ddca2455f96d6f1fa03dd Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Sun, 19 Apr 2026 13:35:42 -0400 Subject: [PATCH] eslint --- eslint.config.mjs | 1 + src/api/Settings.ts | 10 +- .../settings/tabs/changelog/index.tsx | 38 +++---- .../tabs/plugins/ContributorModal.tsx | 32 +++--- .../channelTabs/components/ChannelTab.tsx | 20 ++-- .../customFolderIcons/components.tsx | 6 +- src/equicordplugins/equicordToolbox/menu.tsx | 4 +- .../iconViewer/components/IconsTab.tsx | 2 +- .../moreStickers/components/misc.tsx | 2 +- .../richPresence/SettingsPanel.tsx | 16 +-- .../richPresence/services/jellyfin.ts | 10 +- .../components/SettingsTab.tsx | 102 +++++++++--------- .../components/UserpluginInstallButton.tsx | 30 +++--- src/plugins/noBlockedMessages/index.ts | 4 +- .../reviewDB/components/ReviewComponent.tsx | 18 +--- .../shikiCodeblocks.desktop/settings.ts | 2 +- src/plugins/showAllMessageButtons/index.ts | 4 +- src/plugins/userMessagesPronouns/settings.ts | 2 +- src/shared/SettingsStore.ts | 20 ++-- src/utils/types.ts | 20 ++-- 20 files changed, 166 insertions(+), 177 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index c0602e84e..a42f71ee6 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -87,6 +87,7 @@ export default defineConfig( "@stylistic/object-curly-spacing": ["error", "always"], "@stylistic/spaced-comment": ["error", "always", { "markers": ["!"] }], "@stylistic/no-extra-semi": "error", + "@stylistic/indent": ["error", 4, { "SwitchCase": 1 }], "no-multiple-empty-lines": ["error", { "max": 1, "maxBOF": 0, "maxEOF": 0 }], // TS Rules diff --git a/src/api/Settings.ts b/src/api/Settings.ts index 1951a2a3e..015ce78a7 100644 --- a/src/api/Settings.ts +++ b/src/api/Settings.ts @@ -384,9 +384,9 @@ type UseSettings = ResolveUseSettings[keyof T]; type ResolveUseSettings = { [Key in keyof T]: Key extends string - ? T[Key] extends Record - // @ts-expect-error "Type instantiation is excessively deep and possibly infinite" - ? `${Key}.*` | (ResolveUseSettings extends Record ? `${Key}.${ResolveUseSettings[keyof T[Key]]}` : never) - : Key - : never; + ? T[Key] extends Record + // @ts-expect-error "Type instantiation is excessively deep and possibly infinite" + ? `${Key}.*` | (ResolveUseSettings extends Record ? `${Key}.${ResolveUseSettings[keyof T[Key]]}` : never) + : Key + : never; }; diff --git a/src/components/settings/tabs/changelog/index.tsx b/src/components/settings/tabs/changelog/index.tsx index 29723bfe8..2ba4f2900 100644 --- a/src/components/settings/tabs/changelog/index.tsx +++ b/src/components/settings/tabs/changelog/index.tsx @@ -181,26 +181,26 @@ function UpdateLogCard({ {log.newSettings && getNewSettingsSize(log.newSettings) > 0 && ( -
- - {t("vencord.settings.changelog.updateCard.newSettings")} - -
- {getNewSettingsEntries(log.newSettings).map( - ([pluginName, settings]) => - settings.map(setting => ( - - {pluginName}.{setting} - - )), - )} -
+
+ + {t("vencord.settings.changelog.updateCard.newSettings")} + +
+ {getNewSettingsEntries(log.newSettings).map( + ([pluginName, settings]) => + settings.map(setting => ( + + {pluginName}.{setting} + + )), + )}
- )} +
+ )} {log.commits.length > 0 && (
diff --git a/src/components/settings/tabs/plugins/ContributorModal.tsx b/src/components/settings/tabs/plugins/ContributorModal.tsx index d20916487..38b48c9bd 100644 --- a/src/components/settings/tabs/plugins/ContributorModal.tsx +++ b/src/components/settings/tabs/plugins/ContributorModal.tsx @@ -79,22 +79,22 @@ function ContributorModal({ user }: { user: User; }) { {user.username}
- {plugins.length ? ( - - - This person has {ContributedHyperLink} to some plugins! - - - ) : ( - - - This person has not made any plugins. They likely {ContributedHyperLink} - to Equicord in other ways! - - - )} + {plugins.length ? ( + + + This person has {ContributedHyperLink} to some plugins! + + + ) : ( + + + This person has not made any plugins. They likely {ContributedHyperLink} + to Equicord in other ways! + + + )} {!!plugins.length && (
diff --git a/src/equicordplugins/channelTabs/components/ChannelTab.tsx b/src/equicordplugins/channelTabs/components/ChannelTab.tsx index 5660eec76..8223a72e5 100644 --- a/src/equicordplugins/channelTabs/components/ChannelTab.tsx +++ b/src/equicordplugins/channelTabs/components/ChannelTab.tsx @@ -471,16 +471,16 @@ export default function ChannelTab(props: ChannelTabsProps & { index: number; }) const hasActiveQuests = activeQuestIntervals.size > 0; return
setIsHovered(true)} diff --git a/src/equicordplugins/customFolderIcons/components.tsx b/src/equicordplugins/customFolderIcons/components.tsx index b5feb52a7..6143e8f05 100644 --- a/src/equicordplugins/customFolderIcons/components.tsx +++ b/src/equicordplugins/customFolderIcons/components.tsx @@ -116,9 +116,9 @@ export function makeContextItem(a: folderProp) { ); }, - { - modalKey: "custom-folder-icon" - }); + { + modalKey: "custom-folder-icon" + }); }} /> ); } diff --git a/src/equicordplugins/equicordToolbox/menu.tsx b/src/equicordplugins/equicordToolbox/menu.tsx index 2d1f1553c..54c93ecc5 100644 --- a/src/equicordplugins/equicordToolbox/menu.tsx +++ b/src/equicordplugins/equicordToolbox/menu.tsx @@ -45,7 +45,7 @@ export function buildPluginMenuEntries(includeEmpty = false) { const sortedPlugins = useMemo(() => Object.values(plugins).sort((a, b) => a.name.localeCompare(b.name)), - [] + [] ); const candidates = useMemo(() => @@ -57,7 +57,7 @@ export function buildPluginMenuEntries(includeEmpty = false) { const name = p.name.toLowerCase(); return name.includes(lowerSearch); }), - [lowerSearch] + [lowerSearch] ); return ( diff --git a/src/equicordplugins/iconViewer/components/IconsTab.tsx b/src/equicordplugins/iconViewer/components/IconsTab.tsx index ca06e9797..df63e0b1b 100644 --- a/src/equicordplugins/iconViewer/components/IconsTab.tsx +++ b/src/equicordplugins/iconViewer/components/IconsTab.tsx @@ -79,7 +79,7 @@ function IconsTab() { const filteredIcons = useMemo(() => Object.entries(icons).filter(([name, Icon]) => searchMatch(search, name, Icon, searchByFunction)), - [icons, search, searchByFunction] + [icons, search, searchByFunction] ); const iconsToLoad = 120; diff --git a/src/equicordplugins/moreStickers/components/misc.tsx b/src/equicordplugins/moreStickers/components/misc.tsx index bca8f2990..647459204 100644 --- a/src/equicordplugins/moreStickers/components/misc.tsx +++ b/src/equicordplugins/moreStickers/components/misc.tsx @@ -34,7 +34,7 @@ const noDrag = { }; const StickerPackMetadata = ({ meta, hoveredStickerPackId, setHoveredStickerPackId, refreshStickerPackMetas }: - { meta: StickerPackMeta, [key: string]: any; } +{ meta: StickerPackMeta, [key: string]: any; } ) => { return (
- { setValue(v); settings.store.gr_refreshInterval = v; }} - onValueRender={v => `${v}s`} - stickToMarkers - /> - + { setValue(v); settings.store.gr_refreshInterval = v; }} + onValueRender={v => `${v}s`} + stickToMarkers + /> + ); } diff --git a/src/equicordplugins/richPresence/services/jellyfin.ts b/src/equicordplugins/richPresence/services/jellyfin.ts index ae4dc8f5d..3774cc45f 100644 --- a/src/equicordplugins/richPresence/services/jellyfin.ts +++ b/src/equicordplugins/richPresence/services/jellyfin.ts @@ -44,11 +44,11 @@ async function fetchMediaData(): Promise { const contentType = res.headers.get("content-type") ?? ""; if (!contentType.includes("application/json")) { - if (!hasShownError) { - logger.error("Jellyfin returned non-JSON response. Check your server URL and API key."); - showToast("Jellyfin returned an invalid response. Your API key may be wrong.", "failure", { duration: 15000 }); - hasShownError = true; - } + if (!hasShownError) { + logger.error("Jellyfin returned non-JSON response. Check your server URL and API key."); + showToast("Jellyfin returned an invalid response. Your API key may be wrong.", "failure", { duration: 15000 }); + hasShownError = true; + } return null; } diff --git a/src/equicordplugins/userpluginInstaller.dev/components/SettingsTab.tsx b/src/equicordplugins/userpluginInstaller.dev/components/SettingsTab.tsx index 0bc5a1c53..2f064b382 100644 --- a/src/equicordplugins/userpluginInstaller.dev/components/SettingsTab.tsx +++ b/src/equicordplugins/userpluginInstaller.dev/components/SettingsTab.tsx @@ -251,61 +251,61 @@ function UserPluginsTab() { {Object.keys( pluginsWithUpdates, ).includes(plugin.directory!) && ( - - )} + cancelText: "Later", + onConfirm() { + plugin.usesNative + ? relaunch() + : window.location.reload(); + }, + }); + } catch (e: any) { + if ( + e + .toString() + .includes( + "silentStop", + ) + ) + return; + Alerts.show({ + title: "Update error", + body: e.toString(), + }); + } + }} + > + Update + + )}
diff --git a/src/plugins/noBlockedMessages/index.ts b/src/plugins/noBlockedMessages/index.ts index 4b6b312e4..9de03a4de 100644 --- a/src/plugins/noBlockedMessages/index.ts +++ b/src/plugins/noBlockedMessages/index.ts @@ -273,8 +273,8 @@ export default definePlugin({ const hide = !this.keepSuppressedMessage(message.author.id) || ( message.interaction && !this.keepSuppressedMessage((message.interaction as any).user.id) ) || ( - prefixCMDReference && !this.keepSuppressedMessage(prefixCMDReference.author.id) - ); + prefixCMDReference && !this.keepSuppressedMessage(prefixCMDReference.author.id) + ); return { suppressed, hide }; } catch (e) { new Logger("NoBlockedMessages").error("Failed to check if message is blocked or ignored:", e); diff --git a/src/plugins/reviewDB/components/ReviewComponent.tsx b/src/plugins/reviewDB/components/ReviewComponent.tsx index c920c75c4..50de79078 100644 --- a/src/plugins/reviewDB/components/ReviewComponent.tsx +++ b/src/plugins/reviewDB/components/ReviewComponent.tsx @@ -1,19 +1,7 @@ /* - * Vencord, a modification for Discord's desktop app - * Copyright (c) 2022 Vendicated and contributors - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * Vencord, a Discord client mod + * Copyright (c) 2026 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later */ import { Auth, getToken } from "@plugins/reviewDB/auth"; diff --git a/src/plugins/shikiCodeblocks.desktop/settings.ts b/src/plugins/shikiCodeblocks.desktop/settings.ts index dab08373c..b8dc82174 100644 --- a/src/plugins/shikiCodeblocks.desktop/settings.ts +++ b/src/plugins/shikiCodeblocks.desktop/settings.ts @@ -20,8 +20,8 @@ import { definePluginSettings } from "@api/Settings"; import { disableStyle, enableStyle } from "@api/Styles"; import { parseUrl } from "@utils/misc"; import { wordsFromPascal, wordsToTitle } from "@utils/text"; -import { OptionType } from "@utils/types"; import { t } from "@utils/translation"; +import { OptionType } from "@utils/types"; import { shiki } from "./api/shiki"; import { themes } from "./api/themes"; diff --git a/src/plugins/showAllMessageButtons/index.ts b/src/plugins/showAllMessageButtons/index.ts index 92c1479f8..fa79d7b37 100644 --- a/src/plugins/showAllMessageButtons/index.ts +++ b/src/plugins/showAllMessageButtons/index.ts @@ -5,7 +5,7 @@ */ import { definePluginSettings } from "@api/Settings"; -import { Devs } from "@utils/constants"; +import { Devs, EquicordDevs } from "@utils/constants"; import definePlugin, { OptionType } from "@utils/types"; import { MessageActions, PinActions } from "@webpack/common"; @@ -26,7 +26,7 @@ export default definePlugin({ name: "ShowAllMessageButtons", description: "Always show all message buttons no matter if you are holding the shift key or not.", tags: ["Chat", "Utility"], - authors: [Devs.Nuckyz], + authors: [Devs.Nuckyz, EquicordDevs.mochienya], settings, patches: [ diff --git a/src/plugins/userMessagesPronouns/settings.ts b/src/plugins/userMessagesPronouns/settings.ts index e7d44d6a4..15d5f28e7 100644 --- a/src/plugins/userMessagesPronouns/settings.ts +++ b/src/plugins/userMessagesPronouns/settings.ts @@ -17,8 +17,8 @@ */ import { definePluginSettings } from "@api/Settings"; -import { OptionType } from "@utils/types"; import { t } from "@utils/translation"; +import { OptionType } from "@utils/types"; export const enum PronounsFormat { Lowercase = "LOWERCASE", diff --git a/src/shared/SettingsStore.ts b/src/shared/SettingsStore.ts index 5aaf12d04..0743827d7 100644 --- a/src/shared/SettingsStore.ts +++ b/src/shared/SettingsStore.ts @@ -12,16 +12,16 @@ export const SYM_GET_RAW_TARGET = Symbol("SettingsStore.getRawTarget"); // Resolves a possibly nested prop in the form of "some.nested.prop" to type of T.some.nested.prop type ResolvePropDeep = P extends `${infer Pre}.*` ? - Pre extends keyof T - ? T[Pre][keyof T[Pre]] - : any - : P extends `${infer Pre}.${infer Suf}` - ? Pre extends keyof T - ? ResolvePropDeep - : any - : P extends keyof T - ? T[P] - : any; + Pre extends keyof T + ? T[Pre][keyof T[Pre]] + : any + : P extends `${infer Pre}.${infer Suf}` + ? Pre extends keyof T + ? ResolvePropDeep + : any + : P extends keyof T + ? T[P] + : any; interface SettingsStoreOptions { readOnly?: boolean; diff --git a/src/utils/types.ts b/src/utils/types.ts index c33114a5c..204828658 100644 --- a/src/utils/types.ts +++ b/src/utils/types.ts @@ -278,7 +278,7 @@ export const enum OptionType { export type SettingsDefinition = Record; export type SettingsChecks = { [K in keyof D]?: D[K] extends PluginSettingComponentDef ? IsDisabled> : - (IsDisabled> & IsValid, DefinedSettings>); + (IsDisabled> & IsValid, DefinedSettings>); }; export type PluginSettingDef = @@ -398,13 +398,13 @@ export interface PluginSettingComponentDef { /** Maps a `PluginSettingDef` to its value type */ type PluginSettingType = O extends PluginSettingStringDef ? string : O extends PluginSettingNumberDef ? number : - O extends PluginSettingBigIntDef ? BigInt : - O extends PluginSettingBooleanDef ? boolean : - O extends PluginSettingSelectDef ? O["options"][number]["value"] : - O extends PluginSettingSliderDef ? number : - O extends PluginSettingComponentDef ? O extends { default: infer Default; } ? Default : any : - O extends PluginSettingCustomDef ? O extends { default: infer Default; } ? Default : any : - never; + O extends PluginSettingBigIntDef ? BigInt : + O extends PluginSettingBooleanDef ? boolean : + O extends PluginSettingSelectDef ? O["options"][number]["value"] : + O extends PluginSettingSliderDef ? number : + O extends PluginSettingComponentDef ? O extends { default: infer Default; } ? Default : any : + O extends PluginSettingCustomDef ? O extends { default: infer Default; } ? Default : any : + never; type PluginSettingDefaultType = O extends PluginSettingSelectDef ? ( O["options"] extends { default?: boolean; }[] ? O["options"][number]["value"] : undefined @@ -470,8 +470,8 @@ export type PluginOptionCustom = PluginSettingCustomDef & Pick any>> = { [key in keyof PluginExports]: PluginExports[key] extends (event: Electron.IpcMainInvokeEvent, ...args: infer Args) => infer Return - ? (...args: Args) => Return extends Promise ? Return : Promise - : never; + ? (...args: Args) => Return extends Promise ? Return : Promise + : never; }; export type AllOrNothing = T | { [K in keyof T]?: never; };