From bf1d220ced5c13cc4a9ab766d0b6b3d6708aa9dd Mon Sep 17 00:00:00 2001 From: Matiss Janis Aboltins Date: Tue, 10 Mar 2026 18:06:50 +0000 Subject: [PATCH] [AI] Lint: fix typescript/unbound-method problems (#7163) * [AI] Refactor modal components and server modules Made-with: Cursor * Release notes --- .oxlintrc.json | 4 ++++ packages/crdt/src/crdt/timestamp.test.ts | 4 ++-- .../components/banksync/EditSyncAccount.tsx | 10 +++++----- .../modals/AccountAutocompleteModal.tsx | 6 +++--- .../src/components/modals/AccountMenuModal.tsx | 4 ++-- .../modals/BudgetAutomationsModal.tsx | 11 +++++++---- .../components/modals/BudgetPageMenuModal.tsx | 4 ++-- .../modals/CategoryAutocompleteModal.tsx | 6 +++--- .../modals/CategoryGroupAutocompleteModal.tsx | 6 +++--- .../modals/CategoryGroupMenuModal.tsx | 6 +++--- .../components/modals/CategoryMenuModal.tsx | 4 ++-- .../components/modals/CloseAccountModal.tsx | 10 +++++----- .../modals/ConfirmCategoryDeleteModal.tsx | 6 +++--- .../components/modals/ConfirmDeleteModal.tsx | 8 ++++---- .../modals/ConfirmTransactionEditModal.tsx | 8 ++++---- .../modals/ConfirmUnlinkAccountModal.tsx | 8 ++++---- .../modals/ConvertToScheduleModal.tsx | 8 ++++---- .../modals/CopyWidgetToDashboardModal.tsx | 8 ++++---- .../src/components/modals/CoverModal.tsx | 6 +++--- .../components/modals/CreateAccountModal.tsx | 4 ++-- .../modals/CreateEncryptionKeyModal.tsx | 6 +++--- .../modals/CreateLocalAccountModal.tsx | 6 +++--- .../src/components/modals/EditFieldModal.tsx | 8 +++++--- .../src/components/modals/EditRuleModal.tsx | 8 ++++---- .../src/components/modals/EditUser.tsx | 6 +++--- .../modals/EnvelopeBalanceMenuModal.tsx | 4 ++-- .../modals/EnvelopeBudgetMenuModal.tsx | 6 +++--- .../modals/EnvelopeBudgetMonthMenuModal.tsx | 18 +++++++++--------- .../modals/EnvelopeBudgetSummaryModal.tsx | 6 +++--- .../modals/EnvelopeIncomeBalanceMenuModal.tsx | 4 ++-- .../modals/EnvelopeToBudgetMenuModal.tsx | 4 ++-- .../modals/FixEncryptionKeyModal.tsx | 8 ++++---- .../modals/GoCardlessExternalMsgModal.tsx | 4 ++-- .../modals/GoCardlessInitialiseModal.tsx | 6 +++--- .../components/modals/GoalTemplateModal.tsx | 4 ++-- .../src/components/modals/HoldBufferModal.tsx | 6 +++--- .../ImportTransactionsModal.tsx | 6 +++--- .../modals/KeyboardShortcutModal.tsx | 4 ++-- .../src/components/modals/LoadBackupModal.tsx | 4 ++-- .../src/components/modals/ManageRulesModal.tsx | 4 ++-- .../modals/MergeUnusedPayeesModal.tsx | 8 ++++---- .../src/components/modals/NotesModal.tsx | 6 +++--- .../components/modals/OpenIDEnableModal.tsx | 4 ++-- .../modals/OutOfSyncMigrationsModal.tsx | 4 ++-- .../components/modals/PasswordEnableModal.tsx | 4 ++-- .../modals/PayeeAutocompleteModal.tsx | 6 +++--- .../modals/PluggyAiInitialiseModal.tsx | 6 +++--- .../modals/ScheduledTransactionMenuModal.tsx | 4 ++-- .../modals/SelectLinkedAccountsModal.tsx | 4 ++-- .../modals/SimpleFinInitialiseModal.tsx | 6 +++--- .../src/components/modals/SingleInputModal.tsx | 8 +++++--- .../modals/TrackingBalanceMenuModal.tsx | 4 ++-- .../modals/TrackingBudgetMenuModal.tsx | 6 +++--- .../modals/TrackingBudgetMonthMenuModal.tsx | 16 ++++++++-------- .../modals/TrackingBudgetSummaryModal.tsx | 4 ++-- .../src/components/modals/TransferModal.tsx | 6 +++--- .../modals/UnmigrateBudgetAutomationsModal.tsx | 8 ++++---- .../manager/ConfirmChangeDocumentDir.tsx | 8 ++++---- .../modals/manager/DeleteFileModal.tsx | 8 ++++---- .../modals/manager/DuplicateFileModal.tsx | 6 +++--- .../modals/manager/FilesSettingsModal.tsx | 8 +++++--- .../modals/manager/ImportActualModal.tsx | 4 ++-- .../components/modals/manager/ImportModal.tsx | 4 ++-- .../modals/manager/ImportYNAB4Modal.tsx | 4 ++-- .../modals/manager/ImportYNAB5Modal.tsx | 4 ++-- .../src/components/payees/CategoryLearning.tsx | 4 ++-- .../components/schedules/DiscoverSchedules.tsx | 6 +++--- .../schedules/PostsOfflineNotification.tsx | 8 ++++---- .../components/schedules/ScheduleEditModal.tsx | 13 +++++++++---- .../src/components/schedules/ScheduleLink.tsx | 8 ++++---- .../components/schedules/UpcomingLength.tsx | 6 +++--- packages/desktop-client/src/i18n.test.ts | 12 ++++++------ .../src/platform/server/fs/index.electron.ts | 3 ++- packages/loot-core/src/server/api-models.ts | 7 +++++-- packages/loot-core/src/server/api.ts | 12 ++++++------ packages/loot-core/src/server/models.ts | 2 +- packages/loot-core/src/server/payees/app.ts | 4 ++-- packages/loot-core/src/server/reports/app.ts | 2 +- .../src/app-sync/services/files-service.js | 2 +- upcoming-release-notes/7163.md | 6 ++++++ 80 files changed, 263 insertions(+), 235 deletions(-) create mode 100644 upcoming-release-notes/7163.md diff --git a/.oxlintrc.json b/.oxlintrc.json index 9bc9841aa4..c51a563682 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -103,6 +103,10 @@ "typescript/no-duplicate-type-constituents": "off", "typescript/await-thenable": "error", "typescript/no-floating-promises": "warn", // TODO: covert to error + "typescript/require-array-sort-compare": "warn", // TODO: covert to error + "typescript/unbound-method": "error", + "typescript/no-for-in-array": "warn", // TODO: covert to error + "typescript/restrict-template-expressions": "warn", // TODO: covert to error // Import rules "import/consistent-type-specifier-style": "error", diff --git a/packages/crdt/src/crdt/timestamp.test.ts b/packages/crdt/src/crdt/timestamp.test.ts index 2ceffeac53..fe20ccf83b 100644 --- a/packages/crdt/src/crdt/timestamp.test.ts +++ b/packages/crdt/src/crdt/timestamp.test.ts @@ -121,12 +121,12 @@ describe('Timestamp', function () { it('should fail with counter overflow', function () { now = 40; for (let i = 0; i < 65536; i++) Timestamp.send(); - expect(Timestamp.send).toThrow(Timestamp.OverflowError); + expect(() => Timestamp.send()).toThrow(Timestamp.OverflowError); }); it('should fail with clock drift', function () { now = -(5 * 60 * 1000 + 1); - expect(Timestamp.send).toThrow(Timestamp.ClockDriftError); + expect(() => Timestamp.send()).toThrow(Timestamp.ClockDriftError); }); }); diff --git a/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx b/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx index 5a2ea59c1e..30a49cb770 100644 --- a/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx +++ b/packages/desktop-client/src/components/banksync/EditSyncAccount.tsx @@ -195,13 +195,13 @@ export function EditSyncAccount({ account }: EditSyncAccountProps) { name="synced-account-edit" containerProps={{ style: { width: 800 } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -246,20 +246,20 @@ export function EditSyncAccount({ account }: EditSyncAccountProps) { - - diff --git a/packages/desktop-client/src/components/modals/BudgetPageMenuModal.tsx b/packages/desktop-client/src/components/modals/BudgetPageMenuModal.tsx index df15a7888d..a9685bf823 100644 --- a/packages/desktop-client/src/components/modals/BudgetPageMenuModal.tsx +++ b/packages/desktop-client/src/components/modals/BudgetPageMenuModal.tsx @@ -33,11 +33,11 @@ export function BudgetPageMenuModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> defaultMenuItemStyle} diff --git a/packages/desktop-client/src/components/modals/CategoryAutocompleteModal.tsx b/packages/desktop-client/src/components/modals/CategoryAutocompleteModal.tsx index aa773d50a7..43327fc33d 100644 --- a/packages/desktop-client/src/components/modals/CategoryAutocompleteModal.tsx +++ b/packages/desktop-client/src/components/modals/CategoryAutocompleteModal.tsx @@ -54,7 +54,7 @@ export function CategoryAutocompleteModal({ }, }} > - {({ state: { close } }) => ( + {({ state }) => ( <> {isNarrowWidth && ( state.close()} style={{ color: theme.menuAutoCompleteText }} /> } @@ -94,7 +94,7 @@ export function CategoryAutocompleteModal({ closeOnSelect={closeOnSelect} clearOnSelect={clearOnSelect} showSplitOption={false} - onClose={close} + onClose={() => state.close()} {...defaultAutocompleteProps} onSelect={onSelect} categoryGroups={categoryGroups} diff --git a/packages/desktop-client/src/components/modals/CategoryGroupAutocompleteModal.tsx b/packages/desktop-client/src/components/modals/CategoryGroupAutocompleteModal.tsx index ad1d44b070..f6bc72bd78 100644 --- a/packages/desktop-client/src/components/modals/CategoryGroupAutocompleteModal.tsx +++ b/packages/desktop-client/src/components/modals/CategoryGroupAutocompleteModal.tsx @@ -54,7 +54,7 @@ export function CategoryGroupAutocompleteModal({ }, }} > - {({ state: { close } }) => ( + {({ state }) => ( <> {isNarrowWidth && ( state.close()} style={{ color: theme.menuAutoCompleteText }} /> } @@ -93,7 +93,7 @@ export function CategoryGroupAutocompleteModal({ closeOnBlur={false} closeOnSelect={closeOnSelect} clearOnSelect={clearOnSelect} - onClose={close} + onClose={() => state.close()} {...defaultAutocompleteProps} onSelect={onSelect} categoryGroups={categoryGroups} diff --git a/packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx b/packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx index 6c6d99480a..718e956fa6 100644 --- a/packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx +++ b/packages/desktop-client/src/components/modals/CategoryGroupMenuModal.tsx @@ -133,7 +133,7 @@ export function CategoryGroupMenuModal({ }, }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } - rightContent={} + rightContent={ state.close()} />} /> defaultMenuItemStyle} onApplyBudgetTemplatesInGroup={() => { _onApplyBudgetTemplatesInGroup(); - close(); + state.close(); showUndoNotification({ message: t('budget templates have been applied.'), }); diff --git a/packages/desktop-client/src/components/modals/CategoryMenuModal.tsx b/packages/desktop-client/src/components/modals/CategoryMenuModal.tsx index eb3f06b24c..d255f3efb3 100644 --- a/packages/desktop-client/src/components/modals/CategoryMenuModal.tsx +++ b/packages/desktop-client/src/components/modals/CategoryMenuModal.tsx @@ -86,7 +86,7 @@ export function CategoryMenuModal({ style: { height: '45vh' }, }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } - rightContent={} + rightContent={ state.close()} />} /> - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -164,7 +164,7 @@ export function CloseAccountModal({
{ if (onSubmit(e)) { - close(); + state.close(); } }} > @@ -286,7 +286,7 @@ export function CloseAccountModal({ id: account.id, forced: true, }); - close(); + state.close(); }} style={{ color: theme.errorText }} > @@ -311,7 +311,7 @@ export function CloseAccountModal({ marginRight: 10, height: isNarrowWidth ? styles.mobileMinHeight : undefined, }} - onPress={close} + onPress={() => state.close()} > Cancel diff --git a/packages/desktop-client/src/components/modals/ConfirmCategoryDeleteModal.tsx b/packages/desktop-client/src/components/modals/ConfirmCategoryDeleteModal.tsx index b67d261c7a..edeb2d2ab6 100644 --- a/packages/desktop-client/src/components/modals/ConfirmCategoryDeleteModal.tsx +++ b/packages/desktop-client/src/components/modals/ConfirmCategoryDeleteModal.tsx @@ -71,11 +71,11 @@ export function ConfirmCategoryDeleteModal({ name="confirm-category-delete" containerProps={{ style: { width: '30vw' } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {group ? ( @@ -177,7 +177,7 @@ export function ConfirmCategoryDeleteModal({ setError('required-transfer'); } else { onDelete(transferCategory); - close(); + state.close(); } }} > diff --git a/packages/desktop-client/src/components/modals/ConfirmDeleteModal.tsx b/packages/desktop-client/src/components/modals/ConfirmDeleteModal.tsx index e3adb860b4..41b0355d00 100644 --- a/packages/desktop-client/src/components/modals/ConfirmDeleteModal.tsx +++ b/packages/desktop-client/src/components/modals/ConfirmDeleteModal.tsx @@ -34,11 +34,11 @@ export function ConfirmDeleteModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {message} @@ -53,7 +53,7 @@ export function ConfirmDeleteModal({ marginRight: 10, ...narrowButtonStyle, }} - onPress={close} + onPress={() => state.close()} > Cancel @@ -63,7 +63,7 @@ export function ConfirmDeleteModal({ style={narrowButtonStyle} onPress={() => { onConfirm(); - close(); + state.close(); }} > Delete diff --git a/packages/desktop-client/src/components/modals/ConfirmTransactionEditModal.tsx b/packages/desktop-client/src/components/modals/ConfirmTransactionEditModal.tsx index c7bef8663b..a78b1141d1 100644 --- a/packages/desktop-client/src/components/modals/ConfirmTransactionEditModal.tsx +++ b/packages/desktop-client/src/components/modals/ConfirmTransactionEditModal.tsx @@ -40,11 +40,11 @@ export function ConfirmTransactionEditModal({ name="confirm-transaction-edit" containerProps={{ style: { width: '30vw' } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {confirmReason === 'batchDeleteWithReconciled' ? ( @@ -109,7 +109,7 @@ export function ConfirmTransactionEditModal({ ...narrowButtonStyle, }} onPress={() => { - close(); + state.close(); onCancel(); }} > @@ -124,7 +124,7 @@ export function ConfirmTransactionEditModal({ ...narrowButtonStyle, }} onPress={() => { - close(); + state.close(); onConfirm(); }} > diff --git a/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx b/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx index 0263437dd4..bb90da1d53 100644 --- a/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx +++ b/packages/desktop-client/src/components/modals/ConfirmUnlinkAccountModal.tsx @@ -30,11 +30,11 @@ export function ConfirmUnlinkAccountModal({ name="confirm-unlink-account" containerProps={{ style: { width: '30vw' } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -59,7 +59,7 @@ export function ConfirmUnlinkAccountModal({ justifyContent: 'flex-end', }} > - @@ -67,7 +67,7 @@ export function ConfirmUnlinkAccountModal({ variant="primary" onPress={() => { onUnlink(); - close(); + state.close(); }} > Unlink diff --git a/packages/desktop-client/src/components/modals/ConvertToScheduleModal.tsx b/packages/desktop-client/src/components/modals/ConvertToScheduleModal.tsx index febd4ebc27..6c8b5e9ba4 100644 --- a/packages/desktop-client/src/components/modals/ConvertToScheduleModal.tsx +++ b/packages/desktop-client/src/components/modals/ConvertToScheduleModal.tsx @@ -42,11 +42,11 @@ export function ConvertToScheduleModal({ name="convert-to-schedule" containerProps={{ style: { width: '30vw' } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -95,7 +95,7 @@ export function ConvertToScheduleModal({ ...(isNarrowWidth && { flex: 1 }), }} onPress={() => { - close(); + state.close(); onCancel?.(); }} > @@ -110,7 +110,7 @@ export function ConvertToScheduleModal({ ...(isNarrowWidth && { flex: 1 }), }} onPress={() => { - close(); + state.close(); onConfirm(); }} > diff --git a/packages/desktop-client/src/components/modals/CopyWidgetToDashboardModal.tsx b/packages/desktop-client/src/components/modals/CopyWidgetToDashboardModal.tsx index 9b953d3f3e..0135b5c08c 100644 --- a/packages/desktop-client/src/components/modals/CopyWidgetToDashboardModal.tsx +++ b/packages/desktop-client/src/components/modals/CopyWidgetToDashboardModal.tsx @@ -32,11 +32,11 @@ export function CopyWidgetToDashboardModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -45,7 +45,7 @@ export function CopyWidgetToDashboardModal({ items={items} onMenuSelect={item => { onSelect(item); - close(); + state.close(); }} /> ) : ( @@ -61,7 +61,7 @@ export function CopyWidgetToDashboardModal({ marginTop: 15, }} > - diff --git a/packages/desktop-client/src/components/modals/CoverModal.tsx b/packages/desktop-client/src/components/modals/CoverModal.tsx index a8578e6655..7d3300256e 100644 --- a/packages/desktop-client/src/components/modals/CoverModal.tsx +++ b/packages/desktop-client/src/components/modals/CoverModal.tsx @@ -98,11 +98,11 @@ export function CoverModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -148,7 +148,7 @@ export function CoverModal({ }} onPress={() => { _onSubmit(); - close(); + state.close(); }} > Transfer diff --git a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx index 8c67785d88..aeef079729 100644 --- a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx +++ b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx @@ -335,11 +335,11 @@ export function CreateAccountModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {upgradingAccountId == null && ( diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx b/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx index 6bbda48ddb..10d315595a 100644 --- a/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx +++ b/packages/desktop-client/src/components/modals/CreateEncryptionKeyModal.tsx @@ -71,13 +71,13 @@ export function CreateEncryptionKeyModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> { e.preventDefault(); - void onCreateKey(close); + void onCreateKey(() => state.close()); }} > diff --git a/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx index 2709041597..cfab6d88d7 100644 --- a/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx +++ b/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx @@ -83,13 +83,13 @@ export function CreateLocalAccountModal() { }; return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } - rightContent={} + rightContent={ state.close()} />} /> @@ -191,7 +191,7 @@ export function CreateLocalAccountModal() { )} - diff --git a/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx b/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx index 828704ace5..8e2779d56b 100644 --- a/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx +++ b/packages/desktop-client/src/components/modals/GoCardlessExternalMsgModal.tsx @@ -273,11 +273,11 @@ export function GoCardlessExternalMsgModal({ onClose={onClose} containerProps={{ style: { width: '30vw' } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> diff --git a/packages/desktop-client/src/components/modals/GoCardlessInitialiseModal.tsx b/packages/desktop-client/src/components/modals/GoCardlessInitialiseModal.tsx index e814ae5f62..5bdbbec615 100644 --- a/packages/desktop-client/src/components/modals/GoCardlessInitialiseModal.tsx +++ b/packages/desktop-client/src/components/modals/GoCardlessInitialiseModal.tsx @@ -83,11 +83,11 @@ export const GoCardlessInitialiseModal = ({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -142,7 +142,7 @@ export const GoCardlessInitialiseModal = ({ variant="primary" isLoading={isLoading} onPress={() => { - void onSubmit(close); + void onSubmit(() => state.close()); }} > Save and continue diff --git a/packages/desktop-client/src/components/modals/GoalTemplateModal.tsx b/packages/desktop-client/src/components/modals/GoalTemplateModal.tsx index 84e95f7fdb..b85d80fc04 100644 --- a/packages/desktop-client/src/components/modals/GoalTemplateModal.tsx +++ b/packages/desktop-client/src/components/modals/GoalTemplateModal.tsx @@ -17,11 +17,11 @@ export function GoalTemplateModal() { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> diff --git a/packages/desktop-client/src/components/modals/HoldBufferModal.tsx b/packages/desktop-client/src/components/modals/HoldBufferModal.tsx index 1aaa61a91a..2beb6a6408 100644 --- a/packages/desktop-client/src/components/modals/HoldBufferModal.tsx +++ b/packages/desktop-client/src/components/modals/HoldBufferModal.tsx @@ -41,11 +41,11 @@ export function HoldBufferModal({ onSubmit }: HoldBufferModalProps) { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {' '} @@ -64,7 +64,7 @@ export function HoldBufferModal({ onSubmit }: HoldBufferModalProps) { onUpdate={setAmount} onEnter={() => { _onSubmit(amount); - close(); + state.close(); }} /> diff --git a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.tsx b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.tsx index c42f70bf11..2c3d16064f 100644 --- a/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.tsx +++ b/packages/desktop-client/src/components/modals/ImportTransactionsModal/ImportTransactionsModal.tsx @@ -794,14 +794,14 @@ export function ImportTransactionsModal({ isLoading={loadingState === 'parsing'} containerProps={{ style: { width: 800 } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {error && !error.parsed && ( @@ -1133,7 +1133,7 @@ export function ImportTransactionsModal({ isDisabled={count === 0} isLoading={loadingState === 'importing'} onPress={() => { - void onImport(close); + void onImport(() => state.close()); }} > Import {{ count }} transactions diff --git a/packages/desktop-client/src/components/modals/KeyboardShortcutModal.tsx b/packages/desktop-client/src/components/modals/KeyboardShortcutModal.tsx index b4486fc30e..02298b066e 100644 --- a/packages/desktop-client/src/components/modals/KeyboardShortcutModal.tsx +++ b/packages/desktop-client/src/components/modals/KeyboardShortcutModal.tsx @@ -464,7 +464,7 @@ export function KeyboardShortcutModal() { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> ) : null } - rightContent={} + rightContent={ state.close()} />} /> - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> diff --git a/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx b/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx index 02d9b83bb1..2960e35618 100644 --- a/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx +++ b/packages/desktop-client/src/components/modals/MergeUnusedPayeesModal.tsx @@ -103,7 +103,7 @@ export function MergeUnusedPayeesModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( @@ -198,7 +198,7 @@ export function MergeUnusedPayeesModal({ style={{ marginRight: 10 }} onPress={() => { void onMerge(targetPayee); - close(); + state.close(); }} > Merge @@ -208,13 +208,13 @@ export function MergeUnusedPayeesModal({ style={{ marginRight: 10 }} onPress={() => { void onMergeAndCreateRule(targetPayee); - close(); + state.close(); }} > Merge and edit rule )} - diff --git a/packages/desktop-client/src/components/modals/NotesModal.tsx b/packages/desktop-client/src/components/modals/NotesModal.tsx index d10ca57ca7..acdd45779c 100644 --- a/packages/desktop-client/src/components/modals/NotesModal.tsx +++ b/packages/desktop-client/src/components/modals/NotesModal.tsx @@ -37,11 +37,11 @@ export function NotesModal({ id, name, onSave }: NotesModalProps) { style: { height: '50vh' }, }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> { _onSave(); - close(); + state.close(); }} > diff --git a/packages/desktop-client/src/components/modals/OpenIDEnableModal.tsx b/packages/desktop-client/src/components/modals/OpenIDEnableModal.tsx index eff81804f0..42c3d32765 100644 --- a/packages/desktop-client/src/components/modals/OpenIDEnableModal.tsx +++ b/packages/desktop-client/src/components/modals/OpenIDEnableModal.tsx @@ -67,11 +67,11 @@ export function OpenIDEnableModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> diff --git a/packages/desktop-client/src/components/modals/OutOfSyncMigrationsModal.tsx b/packages/desktop-client/src/components/modals/OutOfSyncMigrationsModal.tsx index a8145644ee..60e63c7be9 100644 --- a/packages/desktop-client/src/components/modals/OutOfSyncMigrationsModal.tsx +++ b/packages/desktop-client/src/components/modals/OutOfSyncMigrationsModal.tsx @@ -27,7 +27,7 @@ export function OutOfSyncMigrationsModal() { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } @@ -82,7 +82,7 @@ export function OutOfSyncMigrationsModal() { style={{ padding: '10px 30px', }} - onPress={() => closeBudgetAndModal(close)} + onPress={() => closeBudgetAndModal(() => state.close())} > Close Budget diff --git a/packages/desktop-client/src/components/modals/PasswordEnableModal.tsx b/packages/desktop-client/src/components/modals/PasswordEnableModal.tsx index 801ad1f4f5..0a331db6af 100644 --- a/packages/desktop-client/src/components/modals/PasswordEnableModal.tsx +++ b/packages/desktop-client/src/components/modals/PasswordEnableModal.tsx @@ -77,11 +77,11 @@ export function PasswordEnableModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> diff --git a/packages/desktop-client/src/components/modals/PayeeAutocompleteModal.tsx b/packages/desktop-client/src/components/modals/PayeeAutocompleteModal.tsx index defc7a862b..0d59cad6f0 100644 --- a/packages/desktop-client/src/components/modals/PayeeAutocompleteModal.tsx +++ b/packages/desktop-client/src/components/modals/PayeeAutocompleteModal.tsx @@ -51,7 +51,7 @@ export function PayeeAutocompleteModal({ }, }} > - {({ state: { close } }) => ( + {({ state }) => ( <> {isNarrowWidth && ( state.close()} style={{ color: theme.menuAutoCompleteText }} /> } @@ -75,7 +75,7 @@ export function PayeeAutocompleteModal({ focused embedded closeOnBlur={false} - onClose={close} + onClose={() => state.close()} onManagePayees={onManagePayees} showManagePayees={!isNarrowWidth} showMakeTransfer={!isNarrowWidth} diff --git a/packages/desktop-client/src/components/modals/PluggyAiInitialiseModal.tsx b/packages/desktop-client/src/components/modals/PluggyAiInitialiseModal.tsx index 5def5de3ac..ff2c01b381 100644 --- a/packages/desktop-client/src/components/modals/PluggyAiInitialiseModal.tsx +++ b/packages/desktop-client/src/components/modals/PluggyAiInitialiseModal.tsx @@ -101,11 +101,11 @@ export const PluggyAiInitialiseModal = ({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -180,7 +180,7 @@ export const PluggyAiInitialiseModal = ({ variant="primary" isLoading={isLoading} onPress={() => { - void onSubmit(close); + void onSubmit(() => state.close()); }} > Save and continue diff --git a/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsx b/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsx index c69d68800f..14aff3a5ff 100644 --- a/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsx +++ b/packages/desktop-client/src/components/modals/ScheduledTransactionMenuModal.tsx @@ -64,11 +64,11 @@ export function ScheduledTransactionMenuModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } - rightContent={} + rightContent={ state.close()} />} /> - {({ state: { close } }) => ( + {({ state }) => ( } + rightContent={ state.close()} />} /> - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -106,7 +106,7 @@ export const SimpleFinInitialiseModal = ({ autoFocus isLoading={isLoading} onPress={() => { - void onSubmit(close); + void onSubmit(() => state.close()); }} > Save and continue diff --git a/packages/desktop-client/src/components/modals/SingleInputModal.tsx b/packages/desktop-client/src/components/modals/SingleInputModal.tsx index 14922e43d1..050a570402 100644 --- a/packages/desktop-client/src/components/modals/SingleInputModal.tsx +++ b/packages/desktop-client/src/components/modals/SingleInputModal.tsx @@ -50,13 +50,15 @@ export function SingleInputModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> -
} /> +
state.close()} />} + /> { _onSubmit(e); - close(); + state.close(); }} > diff --git a/packages/desktop-client/src/components/modals/TrackingBalanceMenuModal.tsx b/packages/desktop-client/src/components/modals/TrackingBalanceMenuModal.tsx index 2d5b6c6dd8..9fd7ae7d69 100644 --- a/packages/desktop-client/src/components/modals/TrackingBalanceMenuModal.tsx +++ b/packages/desktop-client/src/components/modals/TrackingBalanceMenuModal.tsx @@ -47,11 +47,11 @@ export function TrackingBalanceMenuModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } - rightContent={} + rightContent={ state.close()} />} /> - {({ state: { close } }) => ( + {({ state }) => ( <> } - rightContent={} + rightContent={ state.close()} />} /> setAmountFocused(true)} onBlur={() => setAmountFocused(false)} - onEnter={close} + onEnter={() => state.close()} zeroSign="+" focusedStyle={{ width: 'auto', diff --git a/packages/desktop-client/src/components/modals/TrackingBudgetMonthMenuModal.tsx b/packages/desktop-client/src/components/modals/TrackingBudgetMonthMenuModal.tsx index 003b89d4ce..52e810cf5f 100644 --- a/packages/desktop-client/src/components/modals/TrackingBudgetMonthMenuModal.tsx +++ b/packages/desktop-client/src/components/modals/TrackingBudgetMonthMenuModal.tsx @@ -77,11 +77,11 @@ export function TrackingBudgetMonthMenuModal({ style: { height: '50vh' }, }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> defaultMenuItemStyle} onCopyLastMonthBudget={() => { onBudgetAction(month, 'copy-last'); - close(); + state.close(); showUndoNotification({ message: t( "{{displayMonth}} budgets have all been set to last month's budgeted amounts.", @@ -178,7 +178,7 @@ export function TrackingBudgetMonthMenuModal({ }} onSetBudgetsToZero={() => { onBudgetAction(month, 'set-zero'); - close(); + state.close(); showUndoNotification({ message: t( '{{displayMonth}} budgets have all been set to zero.', @@ -188,18 +188,18 @@ export function TrackingBudgetMonthMenuModal({ }} onSetMonthsAverage={numberOfMonths => { onBudgetAction(month, `set-${numberOfMonths}-avg`); - close(); + state.close(); showUndoNotification({ message: `${displayMonth} budgets have all been set to ${numberOfMonths === 12 ? 'yearly' : `${numberOfMonths} month`} average.`, }); }} onCheckTemplates={() => { onBudgetAction(month, 'check-templates'); - close(); + state.close(); }} onApplyBudgetTemplates={() => { onBudgetAction(month, 'apply-goal-template'); - close(); + state.close(); showUndoNotification({ message: t( '{{displayMonth}} budget templates have been applied.', @@ -209,7 +209,7 @@ export function TrackingBudgetMonthMenuModal({ }} onOverwriteWithBudgetTemplates={() => { onBudgetAction(month, 'overwrite-goal-template'); - close(); + state.close(); showUndoNotification({ message: t( '{{displayMonth}} budget templates have been overwritten.', diff --git a/packages/desktop-client/src/components/modals/TrackingBudgetSummaryModal.tsx b/packages/desktop-client/src/components/modals/TrackingBudgetSummaryModal.tsx index 5033984944..543782b094 100644 --- a/packages/desktop-client/src/components/modals/TrackingBudgetSummaryModal.tsx +++ b/packages/desktop-client/src/components/modals/TrackingBudgetSummaryModal.tsx @@ -30,11 +30,11 @@ export function TrackingBudgetSummaryModal({ const currentMonth = monthUtils.currentMonth(); return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -139,7 +139,7 @@ export function TransferModal({ }} onPress={() => { _onSubmit(amount, toCategoryId); - close(); + state.close(); }} > Transfer diff --git a/packages/desktop-client/src/components/modals/UnmigrateBudgetAutomationsModal.tsx b/packages/desktop-client/src/components/modals/UnmigrateBudgetAutomationsModal.tsx index 35876b1377..012937e481 100644 --- a/packages/desktop-client/src/components/modals/UnmigrateBudgetAutomationsModal.tsx +++ b/packages/desktop-client/src/components/modals/UnmigrateBudgetAutomationsModal.tsx @@ -108,13 +108,13 @@ export function UnmigrateBudgetAutomationsModal({ style: { width: 850, height: 650, paddingBottom: 20 }, }} > - {({ state: { close } }) => ( + {({ state }) => ( } + rightContent={ state.close()} />} /> {rendered === null ? ( )} - @@ -202,7 +202,7 @@ export function ConfirmChangeDocumentDirModal({ fontSize: 14, alignSelf: 'center', }} - onPress={() => moveDirectory(close)} + onPress={() => moveDirectory(() => state.close())} > Change directory diff --git a/packages/desktop-client/src/components/modals/manager/DeleteFileModal.tsx b/packages/desktop-client/src/components/modals/manager/DeleteFileModal.tsx index ffcec9ba50..1891485d82 100644 --- a/packages/desktop-client/src/components/modals/manager/DeleteFileModal.tsx +++ b/packages/desktop-client/src/components/modals/manager/DeleteFileModal.tsx @@ -46,11 +46,11 @@ export function DeleteFileModal({ file }: DeleteFileModalProps) { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> Delete file from all devices @@ -176,7 +176,7 @@ export function DeleteFileModal({ file }: DeleteFileModalProps) { await dispatch(deleteBudget({ id: file.id })); setLoadingState(null); - close(); + state.close(); }} > Delete file locally diff --git a/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx b/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx index 901b13f9cc..9c957d6270 100644 --- a/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx +++ b/packages/desktop-client/src/components/modals/manager/DuplicateFileModal.tsx @@ -116,14 +116,14 @@ export function DuplicateFileModal({ return ( - {({ state: { close } }) => ( + {({ state }) => ( { - close(); + state.close(); if (onComplete) onComplete({ status: 'canceled' }); }} /> @@ -187,7 +187,7 @@ export function DuplicateFileModal({ diff --git a/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx b/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx index 17ccf0da29..6f0df26063 100644 --- a/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx +++ b/packages/desktop-client/src/components/modals/manager/ImportActualModal.tsx @@ -71,11 +71,11 @@ export function ImportActualModal() { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {error && ( diff --git a/packages/desktop-client/src/components/modals/manager/ImportModal.tsx b/packages/desktop-client/src/components/modals/manager/ImportModal.tsx index 0779721d98..ed44955fe2 100644 --- a/packages/desktop-client/src/components/modals/manager/ImportModal.tsx +++ b/packages/desktop-client/src/components/modals/manager/ImportModal.tsx @@ -57,11 +57,11 @@ export function ImportModal() { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {error && ( diff --git a/packages/desktop-client/src/components/modals/manager/ImportYNAB4Modal.tsx b/packages/desktop-client/src/components/modals/manager/ImportYNAB4Modal.tsx index c98e549fea..4df148241d 100644 --- a/packages/desktop-client/src/components/modals/manager/ImportYNAB4Modal.tsx +++ b/packages/desktop-client/src/components/modals/manager/ImportYNAB4Modal.tsx @@ -55,11 +55,11 @@ export function ImportYNAB4Modal() { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {error && ( diff --git a/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx b/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx index 555fcff340..6f7dfa8069 100644 --- a/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx +++ b/packages/desktop-client/src/components/modals/manager/ImportYNAB5Modal.tsx @@ -65,11 +65,11 @@ export function ImportYNAB5Modal() { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> {error && ( diff --git a/packages/desktop-client/src/components/payees/CategoryLearning.tsx b/packages/desktop-client/src/components/payees/CategoryLearning.tsx index 6300e0d0df..4a9608d6a0 100644 --- a/packages/desktop-client/src/components/payees/CategoryLearning.tsx +++ b/packages/desktop-client/src/components/payees/CategoryLearning.tsx @@ -23,11 +23,11 @@ export function CategoryLearning() { name="payee-category-learning" containerProps={{ style: { width: 600 } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> diff --git a/packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx b/packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx index 49bda607a8..7e477dfc84 100644 --- a/packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx +++ b/packages/desktop-client/src/components/schedules/DiscoverSchedules.tsx @@ -209,11 +209,11 @@ export function DiscoverSchedules() { name="schedules-discover" containerProps={{ style: { width: 850, height: 650 } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -248,7 +248,7 @@ export function DiscoverSchedules() { isDisabled={selectedInst.items.size === 0} onPress={() => { void onCreate(); - close(); + state.close(); }} > Create schedules diff --git a/packages/desktop-client/src/components/schedules/PostsOfflineNotification.tsx b/packages/desktop-client/src/components/schedules/PostsOfflineNotification.tsx index 7b077b75f0..6264cad050 100644 --- a/packages/desktop-client/src/components/schedules/PostsOfflineNotification.tsx +++ b/packages/desktop-client/src/components/schedules/PostsOfflineNotification.tsx @@ -47,11 +47,11 @@ export function PostsOfflineNotification() { return ( - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -91,7 +91,7 @@ export function PostsOfflineNotification() { gap={10} style={{ marginTop: 20, justifyContent: 'flex-end' }} > - - diff --git a/packages/desktop-client/src/components/schedules/ScheduleLink.tsx b/packages/desktop-client/src/components/schedules/ScheduleLink.tsx index bf31c40918..1582d302d3 100644 --- a/packages/desktop-client/src/components/schedules/ScheduleLink.tsx +++ b/packages/desktop-client/src/components/schedules/ScheduleLink.tsx @@ -83,11 +83,11 @@ export function ScheduleLink({ }, }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> { - close(); + state.close(); void onCreate(); }} > @@ -149,7 +149,7 @@ export function ScheduleLink({ minimal onSelect={id => { void onSelect(id); - close(); + state.close(); }} schedules={schedules} statuses={statuses} diff --git a/packages/desktop-client/src/components/schedules/UpcomingLength.tsx b/packages/desktop-client/src/components/schedules/UpcomingLength.tsx index bb0d4b9e1c..111f55109a 100644 --- a/packages/desktop-client/src/components/schedules/UpcomingLength.tsx +++ b/packages/desktop-client/src/components/schedules/UpcomingLength.tsx @@ -75,11 +75,11 @@ export function UpcomingLength() { name="schedules-upcoming-length" containerProps={{ style: { width: 600 } }} > - {({ state: { close } }) => ( + {({ state }) => ( <> } + rightContent={ state.close()} />} /> @@ -128,7 +128,7 @@ export function UpcomingLength() { isDisabled={!saveActive} onPress={() => { saveUpcomingLength(); - close(); + state.close(); }} type="submit" variant="primary" diff --git a/packages/desktop-client/src/i18n.test.ts b/packages/desktop-client/src/i18n.test.ts index c433a8d3c6..37bf209a1d 100644 --- a/packages/desktop-client/src/i18n.test.ts +++ b/packages/desktop-client/src/i18n.test.ts @@ -35,7 +35,7 @@ describe('setI18NextLanguage', () => { setI18NextLanguage(''); - expect(i18n.changeLanguage).toHaveBeenCalledWith('uk'); + expect(vi.mocked(i18n).changeLanguage).toHaveBeenCalledWith('uk'); }); test('should set the provided language if it is available', () => { @@ -43,7 +43,7 @@ describe('setI18NextLanguage', () => { setI18NextLanguage(language); - expect(i18n.changeLanguage).toHaveBeenCalledWith(language); + expect(vi.mocked(i18n).changeLanguage).toHaveBeenCalledWith(language); }); test('should fallback to English if the provided language is unavailable', () => { @@ -54,7 +54,7 @@ describe('setI18NextLanguage', () => { expect(console.info).toHaveBeenCalledWith( 'Unknown locale unknown, falling back to en', ); - expect(i18n.changeLanguage).toHaveBeenCalledWith('en'); + expect(vi.mocked(i18n).changeLanguage).toHaveBeenCalledWith('en'); }); test('should successfully use a language with a region code if it is known', () => { @@ -62,7 +62,7 @@ describe('setI18NextLanguage', () => { setI18NextLanguage(language); - expect(i18n.changeLanguage).toHaveBeenCalledWith(language); + expect(vi.mocked(i18n).changeLanguage).toHaveBeenCalledWith(language); }); test('should fallback to base language if the provided language has an unknown region code', () => { @@ -73,7 +73,7 @@ describe('setI18NextLanguage', () => { expect(console.info).toHaveBeenCalledWith( 'Unknown locale uk-ZZ, falling back to uk-zz', ); - expect(i18n.changeLanguage).toHaveBeenCalledWith('uk'); + expect(vi.mocked(i18n).changeLanguage).toHaveBeenCalledWith('uk'); }); test('should fallback to lowercase language if the provided language has uppercase letters', () => { @@ -84,6 +84,6 @@ describe('setI18NextLanguage', () => { expect(console.info).toHaveBeenCalledWith( 'Unknown locale EN, falling back to en', ); - expect(i18n.changeLanguage).toHaveBeenCalledWith('en'); + expect(vi.mocked(i18n).changeLanguage).toHaveBeenCalledWith('en'); }); }); diff --git a/packages/loot-core/src/platform/server/fs/index.electron.ts b/packages/loot-core/src/platform/server/fs/index.electron.ts index e0f5798014..185c309d02 100644 --- a/packages/loot-core/src/platform/server/fs/index.electron.ts +++ b/packages/loot-core/src/platform/server/fs/index.electron.ts @@ -49,7 +49,8 @@ export const demoBudgetPath: typeof T.demoBudgetPath = path.join( 'demo-budget', ); -export const join: typeof T.join = path.join; +export const join: typeof T.join = (...args: Parameters) => + path.join(...args); export const basename: typeof T.basename = filepath => path.basename(filepath); diff --git a/packages/loot-core/src/server/api-models.ts b/packages/loot-core/src/server/api-models.ts index 832965459b..43ff9044da 100644 --- a/packages/loot-core/src/server/api-models.ts +++ b/packages/loot-core/src/server/api-models.ts @@ -88,14 +88,17 @@ export const categoryGroupModel = { name: group.name, is_income: group.is_income ? true : false, hidden: group.hidden ? true : false, - categories: group.categories?.map(categoryModel.toExternal) || [], + categories: + group.categories?.map(cat => categoryModel.toExternal(cat)) || [], }; }, fromExternal(group: APICategoryGroupEntity) { const result = { ...group } as unknown as CategoryGroupEntity; if ('categories' in group && group.categories) { - result.categories = group.categories.map(categoryModel.fromExternal); + result.categories = group.categories.map(cat => + categoryModel.fromExternal(cat), + ); } return result; }, diff --git a/packages/loot-core/src/server/api.ts b/packages/loot-core/src/server/api.ts index f5fa407b47..8b6ce30690 100644 --- a/packages/loot-core/src/server/api.ts +++ b/packages/loot-core/src/server/api.ts @@ -632,14 +632,14 @@ handlers['api/categories-get'] = async function ({ checkFileOpen(); const result = await handlers['get-categories'](); return grouped - ? result.grouped.map(categoryGroupModel.toExternal) - : result.list.map(categoryModel.toExternal); + ? result.grouped.map(group => categoryGroupModel.toExternal(group)) + : result.list.map(category => categoryModel.toExternal(category)); }; handlers['api/category-groups-get'] = async function () { checkFileOpen(); const groups = await handlers['get-category-groups'](); - return groups.map(categoryGroupModel.toExternal); + return groups.map(group => categoryGroupModel.toExternal(group)); }; handlers['api/category-group-create'] = withMutation(async function ({ @@ -706,13 +706,13 @@ handlers['api/category-delete'] = withMutation(async function ({ handlers['api/common-payees-get'] = async function () { checkFileOpen(); const payees = await handlers['common-payees-get'](); - return payees.map(payeeModel.toExternal); + return payees.map(payee => payeeModel.toExternal(payee)); }; handlers['api/payees-get'] = async function () { checkFileOpen(); const payees = await handlers['payees-get'](); - return payees.map(payeeModel.toExternal); + return payees.map(payee => payeeModel.toExternal(payee)); }; handlers['api/payee-create'] = withMutation(async function ({ payee }) { @@ -743,7 +743,7 @@ handlers['api/payees-merge'] = withMutation(async function ({ handlers['api/tags-get'] = async function () { checkFileOpen(); const tags = await handlers['tags-get'](); - return tags.map(tagModel.toExternal); + return tags.map(tag => tagModel.toExternal(tag)); }; handlers['api/tag-create'] = withMutation(async function ({ tag }) { diff --git a/packages/loot-core/src/server/models.ts b/packages/loot-core/src/server/models.ts index 829f6a43fc..c07476b04b 100644 --- a/packages/loot-core/src/server/models.ts +++ b/packages/loot-core/src/server/models.ts @@ -156,7 +156,7 @@ export const categoryGroupModel = { ...categoryGroupEntity, categories: categories .filter(category => category.cat_group === categoryGroup.id) - .map(categoryModel.fromDb), + .map(c => categoryModel.fromDb(c)), }; }, }; diff --git a/packages/loot-core/src/server/payees/app.ts b/packages/loot-core/src/server/payees/app.ts index d73c73e70d..d04d2bd909 100644 --- a/packages/loot-core/src/server/payees/app.ts +++ b/packages/loot-core/src/server/payees/app.ts @@ -60,12 +60,12 @@ async function createPayee({ name }: { name: PayeeEntity['name'] }) { async function getCommonPayees(): Promise { // TODO: Update to an AQL query. Server must return AQL entities not the raw DB data. - return (await db.getCommonPayees()).map(payeeModel.fromDb); + return (await db.getCommonPayees()).map(p => payeeModel.fromDb(p)); } async function getPayees(): Promise { // TODO: Update to an AQL query. Server must return AQL entities not the raw DB data. - return (await db.getPayees()).map(payeeModel.fromDb); + return (await db.getPayees()).map(p => payeeModel.fromDb(p)); } async function getOrphanedPayees(): Promise>> { diff --git a/packages/loot-core/src/server/reports/app.ts b/packages/loot-core/src/server/reports/app.ts index 5d0ad04fff..d3993bb18e 100644 --- a/packages/loot-core/src/server/reports/app.ts +++ b/packages/loot-core/src/server/reports/app.ts @@ -97,7 +97,7 @@ async function getReports() { const { data }: { data: CustomReportData[] } = await aqlQuery( q('custom_reports').select('*'), ); - return sort(data.map(reportModel.toJS)); + return sort(data.map(r => reportModel.toJS(r))); } async function reportNameExists( diff --git a/packages/sync-server/src/app-sync/services/files-service.js b/packages/sync-server/src/app-sync/services/files-service.js index 3138180a73..242dd90ad6 100644 --- a/packages/sync-server/src/app-sync/services/files-service.js +++ b/packages/sync-server/src/app-sync/services/files-service.js @@ -142,7 +142,7 @@ class FilesService { WHERE files.deleted = 0 LIMIT ?`, [userId, userId, limit], ) - ).map(this.validate); + ).map(item => this.validate(item)); } findUsersWithAccess(fileId) { diff --git a/upcoming-release-notes/7163.md b/upcoming-release-notes/7163.md new file mode 100644 index 0000000000..ce8c187ea2 --- /dev/null +++ b/upcoming-release-notes/7163.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [MatissJanis] +--- + +Lint: fix typescript/unbound-method issues