From 0ecb9495bc32003b4563dc89450f541ea840745d Mon Sep 17 00:00:00 2001 From: stefanhall Date: Sun, 5 Nov 2023 11:38:46 +1300 Subject: [PATCH] Formatting fix - apply yarn lint --fix to ynab5 files --- .../src/server/importers/ynab5-types.d.ts | 2 +- .../loot-core/src/server/importers/ynab5.ts | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/loot-core/src/server/importers/ynab5-types.d.ts b/packages/loot-core/src/server/importers/ynab5-types.d.ts index 45a63c44bd1..c96d06a093e 100644 --- a/packages/loot-core/src/server/importers/ynab5-types.d.ts +++ b/packages/loot-core/src/server/importers/ynab5-types.d.ts @@ -25,7 +25,7 @@ export namespace YNAB5 { id: string; name: string; deleted: boolean; - transfer_acct?: string + transfer_acct?: string; } interface CategoryGroup { diff --git a/packages/loot-core/src/server/importers/ynab5.ts b/packages/loot-core/src/server/importers/ynab5.ts index f2a899c630c..8641d82cb22 100644 --- a/packages/loot-core/src/server/importers/ynab5.ts +++ b/packages/loot-core/src/server/importers/ynab5.ts @@ -9,7 +9,6 @@ import * as monthUtils from '../../shared/months'; import { sortByKey, groupBy } from '../../shared/util'; import { YNAB5 } from './ynab5-types'; -import Payee = YNAB5.Payee; function amountFromYnab(amount: number) { // ynabs multiplies amount by 1000 and actual by 100 @@ -144,9 +143,12 @@ async function importTransactions( let transactionsGrouped = groupBy(data.transactions, 'account_id'); let subtransactionsGrouped = groupBy(data.subtransactions, 'transaction_id'); - const payeesByTransferAcct = payees.filter((payee: Payee) => payee?.transfer_acct) - .map((payee: Payee) => [payee.transfer_acct, payee]) - const payeeTransferAcctHashMap = new Map(payeesByTransferAcct); + const payeesByTransferAcct = payees + .filter((payee: YNAB5.Payee) => payee?.transfer_acct) + .map((payee: YNAB5.Payee) => [payee.transfer_acct, payee]); + const payeeTransferAcctHashMap = new Map( + payeesByTransferAcct, + ); // Go ahead and generate ids for all of the transactions so we can // reliably resolve transfers @@ -185,8 +187,12 @@ async function importTransactions( ? subtransactions.map(subtrans => { let payee = null; if (subtrans.transfer_account_id) { - const mappedTransferAccountId = entityIdMap.get(subtrans.transfer_account_id); - payee = payeeTransferAcctHashMap.get(mappedTransferAccountId)?.id; + const mappedTransferAccountId = entityIdMap.get( + subtrans.transfer_account_id, + ); + payee = payeeTransferAcctHashMap.get( + mappedTransferAccountId, + )?.id; } return {