From 17e0fe785dfcd2fff568714f3dbdb56899e5dca4 Mon Sep 17 00:00:00 2001 From: yofukashino Date: Tue, 22 Oct 2024 03:45:13 +0530 Subject: [PATCH] prettier --- src/renderer/apis/settings.ts | 4 ++-- src/renderer/coremods/commands/commands.ts | 8 ++++---- src/renderer/coremods/commands/index.ts | 6 +++--- src/renderer/coremods/settings/pages/Updater.tsx | 5 ++--- src/renderer/modules/i18n.ts | 4 ++-- src/renderer/modules/webpack/get-modules.ts | 2 +- src/renderer/modules/webpack/helpers.ts | 10 +++++----- src/renderer/util.ts | 13 ++++++------- 8 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/renderer/apis/settings.ts b/src/renderer/apis/settings.ts index 2cdfd9a51..93708dd52 100644 --- a/src/renderer/apis/settings.ts +++ b/src/renderer/apis/settings.ts @@ -57,8 +57,8 @@ export class SettingsManager, D extends ke ): K extends D ? NonNullable : F extends null | undefined - ? T[K] | undefined - : NonNullable | F { + ? T[K] | undefined + : NonNullable | F { if (typeof this.#settings === "undefined") { throw new Error(`Settings not loaded for namespace ${this.namespace}`); } diff --git a/src/renderer/coremods/commands/commands.ts b/src/renderer/coremods/commands/commands.ts index 7377fe0f0..7665c1f12 100644 --- a/src/renderer/coremods/commands/commands.ts +++ b/src/renderer/coremods/commands/commands.ts @@ -351,8 +351,8 @@ export function loadCommands(): void { listType === "enabled" ? enabledString : listType === "disabled" - ? disabledString - : `${enabledString}\n\n${disabledString}`; + ? disabledString + : `${enabledString}\n\n${disabledString}`; return { send, @@ -383,8 +383,8 @@ export function loadCommands(): void { listType === "enabled" ? enabledString : listType === "disabled" - ? disabledString - : `${enabledString}\n\n${disabledString}`; + ? disabledString + : `${enabledString}\n\n${disabledString}`; return { send, diff --git a/src/renderer/coremods/commands/index.ts b/src/renderer/coremods/commands/index.ts index 8d0fa9dc4..c492911ed 100644 --- a/src/renderer/coremods/commands/index.ts +++ b/src/renderer/coremods/commands/index.ts @@ -223,13 +223,13 @@ async function injectApplicationCommandSearchStore(): Promise { ); if (!commandAndSectionsArray.length) return; if ( - !commandAndSectionsArray.every( - (commandAndSection) => res?.some((section) => section.id === commandAndSection.section.id), + !commandAndSectionsArray.every((commandAndSection) => + res.some((section) => section.id === commandAndSection.section.id), ) ) { const sectionsToAdd = commandAndSectionsArray .map((commandAndSection) => commandAndSection.section) - .filter((section) => res?.some((existingSections) => section.id === existingSections.id)); + .filter((section) => res.some((existingSections) => section.id === existingSections.id)); res.push(...sectionsToAdd); } return res; diff --git a/src/renderer/coremods/settings/pages/Updater.tsx b/src/renderer/coremods/settings/pages/Updater.tsx index f56d2b97d..9473d39c7 100644 --- a/src/renderer/coremods/settings/pages/Updater.tsx +++ b/src/renderer/coremods/settings/pages/Updater.tsx @@ -22,9 +22,8 @@ const logger = Logger.coremod("Settings:Updater"); export const Updater = (): React.ReactElement => { const [checking, setChecking] = React.useState(false); - const [updatesAvailable, setUpdatesAvailable] = React.useState< - Array - >(getAvailableUpdates()); + const [updatesAvailable, setUpdatesAvailable] = + React.useState>(getAvailableUpdates()); const [updatePromises, setUpdatePromises] = React.useState>>({}); const [didInstallAll, setDidInstallAll] = React.useState(false); const [lastChecked, setLastChecked] = useSettingArray(updaterSettings, "lastChecked"); diff --git a/src/renderer/modules/i18n.ts b/src/renderer/modules/i18n.ts index aeed2a512..6cd03a033 100644 --- a/src/renderer/modules/i18n.ts +++ b/src/renderer/modules/i18n.ts @@ -13,10 +13,10 @@ export function load(): void { i18n.on("locale", (newLocale: string) => { locale = newLocale; - i18n.loadPromise.then(addRepluggedStrings)!; + i18n.loadPromise.then(addRepluggedStrings); }); - i18n.loadPromise.then(addRepluggedStrings)!; + i18n.loadPromise.then(addRepluggedStrings); addRepluggedStrings(); } diff --git a/src/renderer/modules/webpack/get-modules.ts b/src/renderer/modules/webpack/get-modules.ts index a3cc21e10..b46c71b1e 100644 --- a/src/renderer/modules/webpack/get-modules.ts +++ b/src/renderer/modules/webpack/get-modules.ts @@ -78,7 +78,7 @@ export function getExportsForProps( if ( props.every((p) => options?.byPrototype - ? (exported?.prototype as Record)?.[p] + ? (exported.prototype as Record)[p] : p in (exported as Record), ) ) { diff --git a/src/renderer/modules/webpack/helpers.ts b/src/renderer/modules/webpack/helpers.ts index 6ce06dfcd..61d5914bd 100644 --- a/src/renderer/modules/webpack/helpers.ts +++ b/src/renderer/modules/webpack/helpers.ts @@ -110,8 +110,8 @@ export function getByProps( const raw = typeof args[0] === "string" ? false : (args[1] as GetModuleOptions | undefined)?.raw; const byPrototype = - typeof args[0] === "string" ? false : (args[1] as ByPropsOptions)?.byPrototype; - + typeof args[0] === "string" ? false : (args[1] as ByPropsOptions).byPrototype; + const result = typeof args.at(-1) === "object" ? getModule(filters.byProps(...props, { byPrototype }), args.at(-1) as GetModuleOptions) @@ -156,9 +156,9 @@ export async function waitForProps( ): Promise> { const props = (typeof args[0] === "string" ? args : args[0]) as P[]; const raw = typeof args[0] === "string" ? false : (args[1] as WaitForOptions | undefined)?.raw; - const byPrototype = - typeof args[0] === "string" ? false : (args[1] as ByPropsOptions)?.byPrototype; - + const byPrototype = + typeof args[0] === "string" ? false : (args[1] as ByPropsOptions).byPrototype; + const result = await (typeof args.at(-1) === "object" ? waitForModule(filters.byProps(...props, { byPrototype }), args.at(-1) as WaitForOptions) : waitForModule(filters.byProps(...props, { byPrototype }))); diff --git a/src/renderer/util.ts b/src/renderer/util.ts index 34f9a8312..acdfdbb72 100644 --- a/src/renderer/util.ts +++ b/src/renderer/util.ts @@ -197,8 +197,8 @@ export function useSetting< value: K extends D ? NonNullable : F extends null | undefined - ? T[K] | undefined - : NonNullable | F; + ? T[K] | undefined + : NonNullable | F; onChange: (newValue: ValType) => void; } { const initial = settings.get(key, fallback); @@ -237,8 +237,8 @@ export function useSettingArray< K extends D ? NonNullable : F extends null | undefined - ? T[K] | undefined - : NonNullable | F, + ? T[K] | undefined + : NonNullable | F, (newValue: ValType) => void, ] { const { value, onChange } = useSetting(settings, key, fallback); @@ -256,9 +256,8 @@ type UnionToIntersection = (U extends never ? never : (k: U) => void) extends type ObjectType = Record; -type ExtractObjectType = O extends Array - ? UnionToIntersection - : never; +type ExtractObjectType = + O extends Array ? UnionToIntersection : never; export function virtualMerge(...objects: O): ExtractObjectType { const fallback = {};