diff --git a/__tests__/hooks/use-display-currency.spec.tsx b/__tests__/hooks/use-display-currency.spec.tsx index 7a523ce582..3d3511a6d7 100644 --- a/__tests__/hooks/use-display-currency.spec.tsx +++ b/__tests__/hooks/use-display-currency.spec.tsx @@ -127,12 +127,11 @@ const wrapWithMocks = (mocks) => - ({ children }: PropsWithChildren) => - ( - - {children} - - ) + ({ children }: PropsWithChildren) => ( + + {children} + + ) describe("usePriceConversion", () => { describe("testing moneyAmountToMajorUnitOrSats", () => { diff --git a/__tests__/payment-details/amount-lightning-payment-details.spec.ts b/__tests__/payment-details/amount-lightning-payment-details.spec.ts index 21f7d0bfad..d29365ae95 100644 --- a/__tests__/payment-details/amount-lightning-payment-details.spec.ts +++ b/__tests__/payment-details/amount-lightning-payment-details.spec.ts @@ -163,7 +163,7 @@ describe("amount lightning payment details", () => { const paymentDetails = createAmountLightningPaymentDetails(defaultParams) const senderSpecifiedMemo = "sender memo" if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set") - + const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo) expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo) }) @@ -174,7 +174,9 @@ describe("amount lightning payment details", () => { currency: WalletCurrency.Btc, id: "newtestwallet", } - const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor) + const newPaymentDetails = paymentDetails.setSendingWalletDescriptor( + sendingWalletDescriptor, + ) expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor) }) }) diff --git a/__tests__/payment-details/amount-onchain.spec.ts b/__tests__/payment-details/amount-onchain.spec.ts index 17d881d71c..ee070904b3 100644 --- a/__tests__/payment-details/amount-onchain.spec.ts +++ b/__tests__/payment-details/amount-onchain.spec.ts @@ -169,7 +169,7 @@ describe("no amount onchain payment details", () => { const paymentDetails = createAmountOnchainPaymentDetails(defaultParams) const senderSpecifiedMemo = "sender memo" if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set") - + const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo) expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo) }) @@ -180,7 +180,9 @@ describe("no amount onchain payment details", () => { currency: WalletCurrency.Btc, id: "newtestwallet", } - const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor) + const newPaymentDetails = paymentDetails.setSendingWalletDescriptor( + sendingWalletDescriptor, + ) expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor) }) }) diff --git a/__tests__/payment-details/intraledger-payment-details.spec.ts b/__tests__/payment-details/intraledger-payment-details.spec.ts index 65e2cc4404..7941adf050 100644 --- a/__tests__/payment-details/intraledger-payment-details.spec.ts +++ b/__tests__/payment-details/intraledger-payment-details.spec.ts @@ -144,7 +144,7 @@ describe("intraledger payment details", () => { const paymentDetails = createIntraledgerPaymentDetails(defaultParams) const senderSpecifiedMemo = "sender memo" if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set") - + const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo) expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo) }) @@ -168,7 +168,9 @@ describe("intraledger payment details", () => { currency: WalletCurrency.Btc, id: "newtestwallet", } - const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor) + const newPaymentDetails = paymentDetails.setSendingWalletDescriptor( + sendingWalletDescriptor, + ) expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor) }) }) diff --git a/__tests__/payment-details/lnurl-payment-details.spec.ts b/__tests__/payment-details/lnurl-payment-details.spec.ts index 2c4d17f83e..ed77de17ef 100644 --- a/__tests__/payment-details/lnurl-payment-details.spec.ts +++ b/__tests__/payment-details/lnurl-payment-details.spec.ts @@ -239,7 +239,9 @@ describe("lnurl payment details", () => { currency: WalletCurrency.Btc, id: "newtestwallet", } - const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor) + const newPaymentDetails = paymentDetails.setSendingWalletDescriptor( + sendingWalletDescriptor, + ) expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor) }) }) diff --git a/__tests__/payment-details/no-amount-lightning-payment-details.spec.ts b/__tests__/payment-details/no-amount-lightning-payment-details.spec.ts index 6ed8fee618..a74b47c4f5 100644 --- a/__tests__/payment-details/no-amount-lightning-payment-details.spec.ts +++ b/__tests__/payment-details/no-amount-lightning-payment-details.spec.ts @@ -191,7 +191,7 @@ describe("no amount lightning payment details", () => { const paymentDetails = createNoAmountLightningPaymentDetails(defaultParams) const senderSpecifiedMemo = "sender memo" if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set") - + const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo) expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo) }) @@ -215,7 +215,9 @@ describe("no amount lightning payment details", () => { currency: WalletCurrency.Btc, id: "newtestwallet", } - const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor) + const newPaymentDetails = paymentDetails.setSendingWalletDescriptor( + sendingWalletDescriptor, + ) expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor) }) }) diff --git a/__tests__/payment-details/no-amount-onchain.spec.ts b/__tests__/payment-details/no-amount-onchain.spec.ts index b8e48d7729..4d40f2dbc6 100644 --- a/__tests__/payment-details/no-amount-onchain.spec.ts +++ b/__tests__/payment-details/no-amount-onchain.spec.ts @@ -188,7 +188,7 @@ describe("no amount lightning payment details", () => { const paymentDetails = createNoAmountOnchainPaymentDetails(defaultParams) const senderSpecifiedMemo = "sender memo" if (!paymentDetails.canSetMemo) throw new Error("Memo is unable to be set") - + const newPaymentDetails = paymentDetails.setMemo(senderSpecifiedMemo) expect(newPaymentDetails.memo).toEqual(senderSpecifiedMemo) }) @@ -212,7 +212,9 @@ describe("no amount lightning payment details", () => { currency: WalletCurrency.Btc, id: "newtestwallet", } - const newPaymentDetails = paymentDetails.setSendingWalletDescriptor(sendingWalletDescriptor) + const newPaymentDetails = paymentDetails.setSendingWalletDescriptor( + sendingWalletDescriptor, + ) expect(newPaymentDetails.sendingWalletDescriptor).toEqual(sendingWalletDescriptor) }) }) diff --git a/app/components/transaction-item/index.types.d.ts b/app/components/transaction-item/index.types.d.ts index 557a5f3766..b6df411f02 100644 --- a/app/components/transaction-item/index.types.d.ts +++ b/app/components/transaction-item/index.types.d.ts @@ -5,24 +5,24 @@ type DeepPartialPrimitive = Primitive | Date | RegExp export type DeepPartial = T extends DeepPartialPrimitive ? T : T extends Map - ? DeepPartialMap - : T extends ReadonlyMap - ? DeepPartialReadonlyMap - : T extends Set - ? DeepPartialSet - : T extends ReadonlySet - ? DeepPartialReadonlySet - : T extends (...args: unknown[]) => unknown - ? T | undefined - : T extends object - ? T extends ReadonlyArray - ? TItem[] extends T - ? readonly TItem[] extends T - ? ReadonlyArray> - : Array> - : DeepPartialObject - : DeepPartialObject - : unknown + ? DeepPartialMap + : T extends ReadonlyMap + ? DeepPartialReadonlyMap + : T extends Set + ? DeepPartialSet + : T extends ReadonlySet + ? DeepPartialReadonlySet + : T extends (...args: unknown[]) => unknown + ? T | undefined + : T extends object + ? T extends ReadonlyArray + ? TItem[] extends T + ? readonly TItem[] extends T + ? ReadonlyArray> + : Array> + : DeepPartialObject + : DeepPartialObject + : unknown export type DeepPartialObject = { [K in keyof T]?: DeepPartial } diff --git a/app/components/transaction-item/transaction-item.tsx b/app/components/transaction-item/transaction-item.tsx index cf3cefa4bb..b2d47cca34 100644 --- a/app/components/transaction-item/transaction-item.tsx +++ b/app/components/transaction-item/transaction-item.tsx @@ -124,8 +124,8 @@ const TransactionItem: React.FC = ({ const amountStyle = isPending ? styles.pending : isReceive - ? styles.receive - : styles.send + ? styles.receive + : styles.send const walletCurrency = tx.settlementCurrency as WalletCurrency diff --git a/app/hooks/use-display-currency.ts b/app/hooks/use-display-currency.ts index 8474b1a570..e4fc5ae763 100644 --- a/app/hooks/use-display-currency.ts +++ b/app/hooks/use-display-currency.ts @@ -123,10 +123,13 @@ export const useDisplayCurrency = () => { const displayCurrencyDictionary = useMemo(() => { const currencyList = dataCurrencyList?.currencyList || [] - return currencyList.reduce((acc, currency) => { - acc[currency.id] = currency - return acc - }, {} as Record) + return currencyList.reduce( + (acc, currency) => { + acc[currency.id] = currency + return acc + }, + {} as Record, + ) }, [dataCurrencyList?.currencyList]) const displayCurrencyInfo = diff --git a/app/screens/earns-screen/earns-quiz.tsx b/app/screens/earns-screen/earns-quiz.tsx index dda450ff3d..3699106f1b 100644 --- a/app/screens/earns-screen/earns-quiz.tsx +++ b/app/screens/earns-screen/earns-quiz.tsx @@ -283,8 +283,8 @@ export const EarnQuiz = ({ route }: Props) => { return recordedAnswer.indexOf(i) === -1 ? styles.quizButtonStyle : i === 0 - ? styles.quizCorrectButtonStyle - : styles.quizWrongButtonStyle + ? styles.quizCorrectButtonStyle + : styles.quizWrongButtonStyle } let j: ZeroTo2 = 0 diff --git a/app/screens/send-bitcoin-screen/send-bitcoin-confirmation-screen.tsx b/app/screens/send-bitcoin-screen/send-bitcoin-confirmation-screen.tsx index 1d8bababeb..5f66ab3795 100644 --- a/app/screens/send-bitcoin-screen/send-bitcoin-confirmation-screen.tsx +++ b/app/screens/send-bitcoin-screen/send-bitcoin-confirmation-screen.tsx @@ -351,8 +351,8 @@ const SendBitcoinConfirmationScreen: React.FC = ({ route }) => { {hideAmount ? "****" : sendingWalletDescriptor.currency === WalletCurrency.Btc - ? btcWalletText - : usdWalletText} + ? btcWalletText + : usdWalletText} diff --git a/app/screens/send-bitcoin-screen/send-bitcoin-details-screen.tsx b/app/screens/send-bitcoin-screen/send-bitcoin-details-screen.tsx index c88aa767cb..f130c82ec9 100644 --- a/app/screens/send-bitcoin-screen/send-bitcoin-details-screen.tsx +++ b/app/screens/send-bitcoin-screen/send-bitcoin-details-screen.tsx @@ -529,8 +529,8 @@ const SendBitcoinDetailsScreen: React.FC = ({ route }) => { {hideAmount ? "****" : sendingWalletDescriptor.currency === WalletCurrency.Btc - ? btcWalletText - : usdWalletText} + ? btcWalletText + : usdWalletText} diff --git a/package.json b/package.json index f79106ec37..c56c1c0bd8 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "yalc:check": "yalc check", "update-translations": "yarn typesafe-i18n && yarn typesafe-i18n:export", "typesafe-i18n": "typesafe-i18n --no-watch", - "typesafe-i18n:export": "ts-node --cwdMode utils/export-language.ts", + "typesafe-i18n:export": "node utils/export-language.mjs", "fonts": "npx react-native-asset", "apk:debug": "cd android && ./gradlew assembleDebug", "start:appium": "appium", diff --git a/utils/export-language.ts b/utils/export-language.mjs similarity index 75% rename from utils/export-language.ts rename to utils/export-language.mjs index 10da0e843d..e2909238d7 100644 --- a/utils/export-language.ts +++ b/utils/export-language.mjs @@ -1,14 +1,13 @@ import fs from "fs" -import { BaseTranslation } from "typesafe-i18n" +import path from "path" +import { fileURLToPath } from "url" import { readTranslationFromDisk } from "typesafe-i18n/exporter" +// Getting the directory name from the URL of the current module +const __dirname = path.dirname(fileURLToPath(import.meta.url)) const DEFAULT_RAW_EXPORT_PATH = `${__dirname}/../app/i18n/raw-i18n` -const writeToFile = async ( - translation: BaseTranslation, - locale: string, - directory: string, -) => { +const writeToFile = async (translation, locale, directory) => { const filePath = `${directory}/${locale}.json` const data = JSON.stringify(translation, null, 4) + "\n" fs.writeFile(filePath, data, (err) => { @@ -19,10 +18,7 @@ const writeToFile = async ( }) } -const exportTranslationsForLocale = async ( - locale: string, - directory: string, -): Promise => { +const exportTranslationsForLocale = async (locale, directory) => { const mapping = await readTranslationFromDisk(locale) const translation = Array.isArray(mapping.translations) ? mapping.translations[0]