From 0f13ad09fefdef8fea0818eb39c1ca6d06a07642 Mon Sep 17 00:00:00 2001 From: Marco Rodolfi Date: Fri, 9 Aug 2024 09:49:54 +0200 Subject: [PATCH] Linting cleanup --- .../src/components/modals/WarnThirdParty.tsx | 2 +- .../settings/pages/developer/index.tsx | 4 +- .../settings/pages/general/StoreSelect.tsx | 2 +- frontend/src/utils/TranslationHelper.tsx | 42 +++++++++++-------- frontend/src/utils/globalTypes.ts | 6 +-- 5 files changed, 31 insertions(+), 25 deletions(-) diff --git a/frontend/src/components/modals/WarnThirdParty.tsx b/frontend/src/components/modals/WarnThirdParty.tsx index a6a4c3f6..e7ff4561 100644 --- a/frontend/src/components/modals/WarnThirdParty.tsx +++ b/frontend/src/components/modals/WarnThirdParty.tsx @@ -2,8 +2,8 @@ import { ConfirmModal } from '@decky/ui'; import { FC, useEffect, useState } from 'react'; import { FaExclamationTriangle } from 'react-icons/fa'; -import TranslationHelper, { TranslationClass } from '../../utils/TranslationHelper'; import { WarnThirdPartyType } from '../../utils/globalTypes'; +import TranslationHelper, { TranslationClass } from '../../utils/TranslationHelper'; interface WarnThirdPartyProps { seconds?: number; diff --git a/frontend/src/components/settings/pages/developer/index.tsx b/frontend/src/components/settings/pages/developer/index.tsx index f828b39e..e5f35546 100644 --- a/frontend/src/components/settings/pages/developer/index.tsx +++ b/frontend/src/components/settings/pages/developer/index.tsx @@ -7,7 +7,7 @@ import { Navigation, TextField, Toggle, - showModal + showModal, } from '@decky/ui'; import { useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; @@ -16,11 +16,11 @@ import { FaFileArchive, FaLink, FaReact, FaSteamSymbol, FaTerminal } from 'react import { setShouldConnectToReactDevTools, setShowValveInternal } from '../../../../developer'; import Logger from '../../../../logger'; import { installFromURL } from '../../../../store'; +import { WarnThirdPartyType } from '../../../../utils/globalTypes'; import { useSetting } from '../../../../utils/hooks/useSetting'; import { getSetting } from '../../../../utils/settings'; import { FileSelectionType } from '../../../modals/filepicker'; import WarnThirdParty from '../../../modals/WarnThirdParty'; -import { WarnThirdPartyType } from '../../../../utils/globalTypes'; import RemoteDebuggingSettings from '../general/RemoteDebugging'; const logger = new Logger('DeveloperIndex'); diff --git a/frontend/src/components/settings/pages/general/StoreSelect.tsx b/frontend/src/components/settings/pages/general/StoreSelect.tsx index 7e92e76b..80bc4930 100644 --- a/frontend/src/components/settings/pages/general/StoreSelect.tsx +++ b/frontend/src/components/settings/pages/general/StoreSelect.tsx @@ -5,9 +5,9 @@ import { FaShapes } from 'react-icons/fa'; import Logger from '../../../../logger'; import { Store } from '../../../../store'; +import { WarnThirdPartyType } from '../../../../utils/globalTypes'; import { useSetting } from '../../../../utils/hooks/useSetting'; import WarnThirdParty from '../../../modals/WarnThirdParty'; -import { WarnThirdPartyType } from '../../../../utils/globalTypes'; const logger = new Logger('StoreSelect'); diff --git a/frontend/src/utils/TranslationHelper.tsx b/frontend/src/utils/TranslationHelper.tsx index 37f2f488..c499f39d 100644 --- a/frontend/src/utils/TranslationHelper.tsx +++ b/frontend/src/utils/TranslationHelper.tsx @@ -1,9 +1,9 @@ import { FC } from 'react'; import { Translation } from 'react-i18next'; -import { WarnThirdPartyType } from './globalTypes'; import Logger from '../logger'; import { InstallType } from '../plugin'; +import { WarnThirdPartyType } from './globalTypes'; export enum TranslationClass { PLUGIN_LOADER = 'PluginLoader', @@ -22,7 +22,13 @@ interface TranslationHelperProps { const logger = new Logger('TranslationHelper'); -const TranslationHelper: FC = ({ transClass, transText, i18nArgs = null, installType = 0, warnType = WarnThirdPartyType.REPO }) => { +const TranslationHelper: FC = ({ + transClass, + transText, + i18nArgs = null, + installType = 0, + warnType = WarnThirdPartyType.REPO, +}) => { return ( {(t, {}) => { @@ -50,25 +56,25 @@ const TranslationHelper: FC = ({ transClass, transText, return i18nArgs ? t(TranslationClass.DEVELOPER + '.' + transText, i18nArgs) : t(TranslationClass.DEVELOPER + '.' + transText); - //Handle different messages in different class cases - case TranslationClass.WARN_THIRD_PARTY: - //Needed only for title and description - if (!transText.startsWith('button')) { + //Handle different messages in different class cases + case TranslationClass.WARN_THIRD_PARTY: + //Needed only for title and description + if (!transText.startsWith('button')) { switch (warnType) { - case WarnThirdPartyType.REPO: - return i18nArgs - ? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_repo', i18nArgs) - : t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_repo'); - case WarnThirdPartyType.ZIP: - return i18nArgs - ? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_zip', i18nArgs) - : t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_zip'); + case WarnThirdPartyType.REPO: + return i18nArgs + ? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_repo', i18nArgs) + : t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_repo'); + case WarnThirdPartyType.ZIP: + return i18nArgs + ? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_zip', i18nArgs) + : t(TranslationClass.WARN_THIRD_PARTY + '.' + transText + '_zip'); } - } else { + } else { return i18nArgs - ? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText, i18nArgs) - : t(TranslationClass.WARN_THIRD_PARTY + '.' + transText); - } + ? t(TranslationClass.WARN_THIRD_PARTY + '.' + transText, i18nArgs) + : t(TranslationClass.WARN_THIRD_PARTY + '.' + transText); + } default: logger.error('We should never fall in the default case!'); return ''; diff --git a/frontend/src/utils/globalTypes.ts b/frontend/src/utils/globalTypes.ts index 8f1a1fa0..26f7d1ae 100644 --- a/frontend/src/utils/globalTypes.ts +++ b/frontend/src/utils/globalTypes.ts @@ -1,4 +1,4 @@ export enum WarnThirdPartyType { - REPO = 0, - ZIP = 1, - } \ No newline at end of file + REPO = 0, + ZIP = 1, +}