From f09f2dfe7b470e9f241baae71880bb02bdbcf03a Mon Sep 17 00:00:00 2001 From: Rich Howell <22135084+rich-howell@users.noreply.github.com> Date: Wed, 31 Aug 2022 19:10:01 +0100 Subject: [PATCH 1/9] Update bug-report.yml (#228) Added Mac OSX and updated description --- .github/ISSUE_TEMPLATE/bug-report.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 23cbc54..73ebbf1 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -65,10 +65,11 @@ body: id: operating-system attributes: label: Operating System - description: What version of our software are you running? + description: What operating system are you using? options: - Windows 11 - Windows 10 + - Mac OSX - Linux - Mobile Device - Other From 9e7f94a2370d28f5ae61ac4ea0ddbf0357932037 Mon Sep 17 00:00:00 2001 From: Jed Fox Date: Wed, 31 Aug 2022 17:38:16 -0400 Subject: [PATCH 2/9] Fix handling of -0 in budget summary (#229) * Fix handling of -0 in budget summary * Update based on review Co-Authored-By: Tom French <15848336+TomAFrench@users.noreply.github.com> --- .../src/components/budget/rollover/BudgetSummary.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/loot-design/src/components/budget/rollover/BudgetSummary.js b/packages/loot-design/src/components/budget/rollover/BudgetSummary.js index 7e02e95..160fa64 100644 --- a/packages/loot-design/src/components/budget/rollover/BudgetSummary.js +++ b/packages/loot-design/src/components/budget/rollover/BudgetSummary.js @@ -112,11 +112,9 @@ function TotalsList({ prevMonthName, collapsed }) { { - let n = parseInt(value); - n = isNaN(n) ? 0 : -n; - let v = format(n, 'financial'); - - return n > 0 ? '+' + v : n === 0 ? '-' + v : v; + let n = parseInt(value) || 0; + let v = format(Math.abs(n), 'financial'); + return n >= 0 ? '-' + v : '+' + v; }} style={[{ fontWeight: 600 }, styles.tnum]} /> From 4be86c3d42b0a8f1c5e0c6803524c4ffe6ac715b Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Wed, 31 Aug 2022 22:44:52 +0100 Subject: [PATCH 3/9] Revert "build: update yarn.lock" (#230) This reverts commit ae8ef2674fd781e99e76fa572715ef48cc1d5257. Revert "Merge pull request #204 from TomAFrench/yarn-workspace-dependencies" This reverts commit b0ed8d514995e0c87749ecf466191b21aca1c663, reversing changes made to 5505a1439a44885bace0ace229d0bf2b4f873225. --- packages/desktop-electron/package.json | 2 +- packages/import-ynab4/package.json | 2 +- packages/import-ynab5/package.json | 2 +- packages/loot-core/package.json | 6 +-- yarn.lock | 59 +++++++++++++++++++++----- 5 files changed, 54 insertions(+), 17 deletions(-) diff --git a/packages/desktop-electron/package.json b/packages/desktop-electron/package.json index 7e70c86..29df4a2 100644 --- a/packages/desktop-electron/package.json +++ b/packages/desktop-electron/package.json @@ -48,7 +48,7 @@ "electron-is-dev": "2.0.0", "electron-log": "4.3.2", "electron-updater": "4.3.8", - "loot-core": "workspace:*", + "loot-core": "*", "node-fetch": "^1.6.3", "node-ipc": "9.1.4" }, diff --git a/packages/import-ynab4/package.json b/packages/import-ynab4/package.json index e559193..138abc3 100644 --- a/packages/import-ynab4/package.json +++ b/packages/import-ynab4/package.json @@ -16,7 +16,7 @@ "bin": "./index.js", "homepage": "https://github.com/actualbudget/actual/tree/master/packages/import-ynab4#readme", "dependencies": { - "@actual-app/api": "workspace:*", + "@actual-app/api": "^1.0.0", "adm-zip": "^0.5.9", "date-fns": "2.0.0-alpha.27", "slash": "3.0.0", diff --git a/packages/import-ynab5/package.json b/packages/import-ynab5/package.json index 1c04a71..a15fe5f 100644 --- a/packages/import-ynab5/package.json +++ b/packages/import-ynab5/package.json @@ -16,7 +16,7 @@ "bin": "./index.js", "homepage": "https://github.com/actualbudget/actual/tree/master/packages/import-ynab5#readme", "dependencies": { - "@actual-app/api": "workspace:*", + "@actual-app/api": "^1.0.0", "date-fns": "2.0.0-alpha.27", "uuid": "3.3.2" } diff --git a/packages/loot-core/package.json b/packages/loot-core/package.json index 27d13ff..48b50c3 100644 --- a/packages/loot-core/package.json +++ b/packages/loot-core/package.json @@ -35,12 +35,12 @@ "md5": "^2.3.0", "mitt": "^2.1.0", "node-fetch": "^1.6.3", - "node-libofx": "workspace:*", + "node-libofx": "*", "regenerator-runtime": "^0.13.7" }, "devDependencies": { - "@actual-app/api": "workspace:*", - "@actual-app/import-ynab4": "workspace:*", + "@actual-app/api": "*", + "@actual-app/import-ynab4": "*", "@babel/core": "~7.14.3", "@types/jest": "^27.5.0", "adm-zip": "^0.5.9", diff --git a/yarn.lock b/yarn.lock index 4a6127f..5a65aa2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12,7 +12,7 @@ __metadata: languageName: node linkType: hard -"@actual-app/api@workspace:*, @actual-app/api@workspace:packages/api": +"@actual-app/api@*, @actual-app/api@workspace:packages/api": version: 0.0.0-use.local resolution: "@actual-app/api@workspace:packages/api" dependencies: @@ -22,11 +22,21 @@ __metadata: languageName: unknown linkType: soft -"@actual-app/import-ynab4@workspace:*, @actual-app/import-ynab4@workspace:packages/import-ynab4": +"@actual-app/api@npm:^1.0.0": + version: 1.1.3 + resolution: "@actual-app/api@npm:1.1.3" + dependencies: + node-ipc: 9.1.1 + uuid: 3.3.2 + checksum: e7fccff7583d64ac908eb7a7c93226200fd75af92b9fe9718b6e3fe0d004d92d79d87485e212b0d3d86cb685827e6733c939ece799156eea64db886bf1457a94 + languageName: node + linkType: hard + +"@actual-app/import-ynab4@*, @actual-app/import-ynab4@workspace:packages/import-ynab4": version: 0.0.0-use.local resolution: "@actual-app/import-ynab4@workspace:packages/import-ynab4" dependencies: - "@actual-app/api": "workspace:*" + "@actual-app/api": ^1.0.0 adm-zip: ^0.5.9 date-fns: 2.0.0-alpha.27 slash: 3.0.0 @@ -40,7 +50,7 @@ __metadata: version: 0.0.0-use.local resolution: "@actual-app/import-ynab5@workspace:packages/import-ynab5" dependencies: - "@actual-app/api": "workspace:*" + "@actual-app/api": ^1.0.0 date-fns: 2.0.0-alpha.27 uuid: 3.3.2 bin: @@ -4292,7 +4302,7 @@ __metadata: electron-notarize: 1.0.0 electron-rebuild: 2.3.5 electron-updater: 4.3.8 - loot-core: "workspace:*" + loot-core: "*" node-fetch: ^1.6.3 node-ipc: 9.1.4 languageName: unknown @@ -8809,7 +8819,7 @@ __metadata: languageName: node linkType: hard -"easy-stack@npm:^1.0.1": +"easy-stack@npm:^1.0.0, easy-stack@npm:^1.0.1": version: 1.0.1 resolution: "easy-stack@npm:1.0.1" checksum: 161a99e497b3857b0be4ec9e1ebbe90b241ea9d84702f9881b8e5b3f6822065b8c4e33436996935103e191bffba3607de70712a792f4d406a050def48c6bc381 @@ -13680,6 +13690,13 @@ jest-snapshot@test: languageName: node linkType: hard +"js-message@npm:1.0.5": + version: 1.0.5 + resolution: "js-message@npm:1.0.5" + checksum: fd2fc8837a88a115aa2fa859bf5c13d9b335fd7eeba8426c44da6eb006b04c52cfe6675b3c27d6b112ffc51dadb8bc51d58340c3a3aa5c555d7da6bdc72ce9c0 + languageName: node + linkType: hard + "js-message@npm:1.0.7": version: 1.0.7 resolution: "js-message@npm:1.0.7" @@ -13687,6 +13704,15 @@ jest-snapshot@test: languageName: node linkType: hard +"js-queue@npm:2.0.0": + version: 2.0.0 + resolution: "js-queue@npm:2.0.0" + dependencies: + easy-stack: ^1.0.0 + checksum: 8f8e589cc20fd3bc3067db73ecaac77b55411c3ac58fdd6882868924ee19ab4203d19e68d3ec680c5c8f5e8282e30dafa377014dbec05c3f2d33be4596f4fb65 + languageName: node + linkType: hard + "js-queue@npm:2.0.2": version: 2.0.2 resolution: "js-queue@npm:2.0.2" @@ -14515,12 +14541,12 @@ jest-snapshot@test: languageName: node linkType: hard -"loot-core@*, loot-core@workspace:*, loot-core@workspace:packages/loot-core": +"loot-core@*, loot-core@workspace:packages/loot-core": version: 0.0.0-use.local resolution: "loot-core@workspace:packages/loot-core" dependencies: - "@actual-app/api": "workspace:*" - "@actual-app/import-ynab4": "workspace:*" + "@actual-app/api": "*" + "@actual-app/import-ynab4": "*" "@babel/core": ~7.14.3 "@babel/register": ^7.12.10 "@jlongster/mixpanel": ^0.13.4 @@ -14561,7 +14587,7 @@ jest-snapshot@test: mockdate: ^3.0.5 murmurhash: ^0.0.2 node-fetch: ^1.6.3 - node-libofx: "workspace:*" + node-libofx: "*" npm-run-all: ^4.1.3 perf-deets: ^1.0.15 prettier: ^1.19.1 @@ -16070,6 +16096,17 @@ jest-snapshot@test: languageName: node linkType: hard +"node-ipc@npm:9.1.1": + version: 9.1.1 + resolution: "node-ipc@npm:9.1.1" + dependencies: + event-pubsub: 4.3.0 + js-message: 1.0.5 + js-queue: 2.0.0 + checksum: 2b66099d1976e4328d34ae7fec853d3969ca337b52b5aefb48ae1d19387c37d6716c2b98d4a4934ec24aa79f0441721961d6c1beb858c294ad6a7a97ddf5460d + languageName: node + linkType: hard + "node-ipc@npm:9.1.4": version: 9.1.4 resolution: "node-ipc@npm:9.1.4" @@ -16081,7 +16118,7 @@ jest-snapshot@test: languageName: node linkType: hard -"node-libofx@workspace:*, node-libofx@workspace:packages/node-libofx": +"node-libofx@*, node-libofx@workspace:packages/node-libofx": version: 0.0.0-use.local resolution: "node-libofx@workspace:packages/node-libofx" languageName: unknown From 0fcfffea57ea87c951d3356c74667df558e8abde Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Wed, 31 Aug 2022 22:46:28 +0100 Subject: [PATCH 4/9] refactor: create index.js for aql directory (#68) --- packages/loot-core/bin/profile-sql.js | 2 +- packages/loot-core/bin/sql-regenerate-views | 2 +- packages/loot-core/src/mocks/arbitrary-schema.js | 2 +- packages/loot-core/src/mocks/budget.js | 2 +- .../loot-core/src/server/accounts/export-to-csv.js | 2 +- .../loot-core/src/server/accounts/transaction-rules.js | 2 +- .../src/server/accounts/transaction-rules.test.js | 2 +- packages/loot-core/src/server/api.js | 2 +- packages/loot-core/src/server/aql/index.js | 10 ++++++++++ packages/loot-core/src/server/db/index.js | 4 ++-- packages/loot-core/src/server/main.js | 5 ++--- packages/loot-core/src/server/schedules/app.js | 2 +- packages/loot-core/src/server/schedules/app.test.js | 2 +- .../loot-core/src/server/schedules/find-schedules.js | 2 +- .../loot-core/src/server/spreadsheet/spreadsheet.js | 4 +--- packages/loot-core/src/server/sync/migrate.test.js | 3 +-- packages/loot-core/src/server/update.js | 3 +-- 17 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 packages/loot-core/src/server/aql/index.js diff --git a/packages/loot-core/bin/profile-sql.js b/packages/loot-core/bin/profile-sql.js index 4842025..a56f3f1 100755 --- a/packages/loot-core/bin/profile-sql.js +++ b/packages/loot-core/bin/profile-sql.js @@ -4,7 +4,7 @@ import os from 'os'; import * as sqlite from '../src/platform/server/sqlite'; import * as db from '../src/server/db'; import { batchMessages, setSyncingMode } from '../src/server/sync'; -import { runQuery } from '../src/server/aql/schema/run-query'; +import { runQuery } from '../src/server/aql'; import asyncStorage from '../src/platform/server/asyncStorage'; import { makeChild } from '../src/shared/transactions'; import q from '../src/shared/query'; diff --git a/packages/loot-core/bin/sql-regenerate-views b/packages/loot-core/bin/sql-regenerate-views index dd71b5f..eaa4906 100755 --- a/packages/loot-core/bin/sql-regenerate-views +++ b/packages/loot-core/bin/sql-regenerate-views @@ -1,5 +1,5 @@ #!/usr/bin/env actual-cli-runner.js -const { schema } = require('../src/server/aql/schema'); +const { schema } = require('../src/server/aql'); const table = process.argv[3]; if (table == null || table === 'transactions') { diff --git a/packages/loot-core/src/mocks/arbitrary-schema.js b/packages/loot-core/src/mocks/arbitrary-schema.js index 6b4d8d6..0f508f2 100644 --- a/packages/loot-core/src/mocks/arbitrary-schema.js +++ b/packages/loot-core/src/mocks/arbitrary-schema.js @@ -1,5 +1,5 @@ import fc from 'fast-check'; -import { schema } from '../server/aql/schema'; +import { schema } from '../server/aql'; import { addDays } from '../shared/months'; function typeArbitrary(typeDesc, name) { diff --git a/packages/loot-core/src/mocks/budget.js b/packages/loot-core/src/mocks/budget.js index 5e03bf4..3143be3 100644 --- a/packages/loot-core/src/mocks/budget.js +++ b/packages/loot-core/src/mocks/budget.js @@ -4,7 +4,7 @@ import * as budget from '../server/budget/base'; import * as db from '../server/db'; import * as prefs from '../server/prefs'; import * as budgetActions from '../server/budget/actions'; -import { runQuery as aqlQuery } from '../server/aql/schema/run-query'; +import { runQuery as aqlQuery } from '../server/aql'; import { batchMessages, setSyncingMode } from '../server/sync'; import { runHandler, runMutator } from '../server/mutators'; import { addTransactions } from '../server/accounts/sync'; diff --git a/packages/loot-core/src/server/accounts/export-to-csv.js b/packages/loot-core/src/server/accounts/export-to-csv.js index 64b9f6e..f58e468 100644 --- a/packages/loot-core/src/server/accounts/export-to-csv.js +++ b/packages/loot-core/src/server/accounts/export-to-csv.js @@ -1,5 +1,5 @@ import csvStringify from 'csv-stringify/lib/sync'; -import { runQuery as aqlQuery } from '../aql/schema/run-query'; +import { runQuery as aqlQuery } from '../aql'; import { integerToAmount } from '../../shared/util'; export async function exportToCSV( diff --git a/packages/loot-core/src/server/accounts/transaction-rules.js b/packages/loot-core/src/server/accounts/transaction-rules.js index 794f428..dab58d4 100644 --- a/packages/loot-core/src/server/accounts/transaction-rules.js +++ b/packages/loot-core/src/server/accounts/transaction-rules.js @@ -21,7 +21,7 @@ import { requiredFields, toDateRepr } from '../models'; import { currentDay } from '../../shared/months'; import { partitionByField, fastSetMerge } from '../../shared/util'; import { setSyncingMode, batchMessages } from '../sync'; -import { schemaConfig } from '../aql/schema'; +import { schemaConfig } from '../aql'; // TODO: Detect if it looks like the user is creating a rename rule // and prompt to create it in the pre phase instead diff --git a/packages/loot-core/src/server/accounts/transaction-rules.test.js b/packages/loot-core/src/server/accounts/transaction-rules.test.js index d35653c..e6dc3d4 100644 --- a/packages/loot-core/src/server/accounts/transaction-rules.test.js +++ b/packages/loot-core/src/server/accounts/transaction-rules.test.js @@ -14,7 +14,7 @@ import { migrateOldRules } from './transaction-rules'; import { loadMappings } from '../db/mappings'; -import { runQuery } from '../aql/schema/run-query'; +import { runQuery } from '../aql'; import q from '../../shared/query'; // TODO: write tests to make sure payee renaming is "pre" and category diff --git a/packages/loot-core/src/server/api.js b/packages/loot-core/src/server/api.js index 460fa58..2ca0b75 100644 --- a/packages/loot-core/src/server/api.js +++ b/packages/loot-core/src/server/api.js @@ -20,7 +20,7 @@ import { setSyncingMode, batchMessages } from './sync'; import { getClock } from './crdt'; import { runMutator } from './mutators'; import { integerToAmount } from '../shared/util'; -import { runQuery as aqlQuery } from './aql/schema/run-query'; +import { runQuery as aqlQuery } from './aql'; import q from '../shared/query'; const connection = require('../platform/server/connection'); diff --git a/packages/loot-core/src/server/aql/index.js b/packages/loot-core/src/server/aql/index.js new file mode 100644 index 0000000..2337f2b --- /dev/null +++ b/packages/loot-core/src/server/aql/index.js @@ -0,0 +1,10 @@ +export { + convertForInsert, + convertForUpdate, + convertFromSelect, + convertInputType, +} from './schema-helpers'; +export { compileQuery } from "./compiler"; +export { makeViews } from "./views"; +export { schema, schemaConfig } from "./schema"; +export { runQuery, runCompiledQuery } from "./schema/run-query"; diff --git a/packages/loot-core/src/server/db/index.js b/packages/loot-core/src/server/db/index.js index 249ec84..8c9813e 100644 --- a/packages/loot-core/src/server/db/index.js +++ b/packages/loot-core/src/server/db/index.js @@ -2,7 +2,7 @@ import LRU from 'lru-cache'; import * as sqlite from '../../platform/server/sqlite'; import fs from '../../platform/server/fs'; import { sendMessages, batchMessages } from '../sync'; -import { schema, schemaConfig } from '../aql/schema'; +import { schema, schemaConfig } from '../aql'; import { accountModel, categoryModel, @@ -23,7 +23,7 @@ import { convertForInsert, convertForUpdate, convertFromSelect -} from '../aql/schema-helpers'; +} from '../aql'; import { shoveSortOrders, SORT_INCREMENT } from './sort'; export { toDateRepr, fromDateRepr } from '../models'; diff --git a/packages/loot-core/src/server/main.js b/packages/loot-core/src/server/main.js index ac80260..6eca6a1 100644 --- a/packages/loot-core/src/server/main.js +++ b/packages/loot-core/src/server/main.js @@ -64,9 +64,8 @@ import * as tracking from './tracking/events'; import { get, post } from './post'; import { APIError, TransactionError, PostError, RuleError } from './errors'; import { createTestBudget } from '../mocks/budget'; -import { runQuery as aqlQuery } from './aql/schema/run-query'; -import { Query } from '../shared/query'; -import q from '../shared/query'; +import { runQuery as aqlQuery } from './aql'; +import q, { Query } from '../shared/query'; import app from './main-app'; // Apps diff --git a/packages/loot-core/src/server/schedules/app.js b/packages/loot-core/src/server/schedules/app.js index 062490e..34f6994 100644 --- a/packages/loot-core/src/server/schedules/app.js +++ b/packages/loot-core/src/server/schedules/app.js @@ -4,7 +4,7 @@ import { createApp } from '../app'; import * as db from '../db'; import * as prefs from '../prefs'; import { toDateRepr } from '../models'; -import { runQuery as aqlQuery } from '../aql/schema/run-query'; +import { runQuery as aqlQuery } from '../aql'; import { dayFromDate, currentDay, parseDate } from '../../shared/months'; import q from '../../shared/query'; import { diff --git a/packages/loot-core/src/server/schedules/app.test.js b/packages/loot-core/src/server/schedules/app.test.js index 916244c..5ba23b2 100644 --- a/packages/loot-core/src/server/schedules/app.test.js +++ b/packages/loot-core/src/server/schedules/app.test.js @@ -1,4 +1,4 @@ -import { runQuery as aqlQuery } from '../aql/schema/run-query'; +import { runQuery as aqlQuery } from '../aql'; import q from '../../shared/query'; import { loadRules, updateRule } from '../accounts/transaction-rules'; import { loadMappings } from '../db/mappings'; diff --git a/packages/loot-core/src/server/schedules/find-schedules.js b/packages/loot-core/src/server/schedules/find-schedules.js index 6432f0b..b40edad 100644 --- a/packages/loot-core/src/server/schedules/find-schedules.js +++ b/packages/loot-core/src/server/schedules/find-schedules.js @@ -3,7 +3,7 @@ import * as db from '../db'; import { Schedule as RSchedule } from '../util/rschedule'; import { groupBy } from '../../shared/util'; import { fromDateRepr } from '../models'; -import { runQuery as aqlQuery } from '../aql/schema/run-query'; +import { runQuery as aqlQuery } from '../aql'; import q from '../../shared/query'; import { getApproxNumberThreshold } from '../../shared/rules'; import { recurConfigToRSchedule } from '../../shared/schedules'; diff --git a/packages/loot-core/src/server/spreadsheet/spreadsheet.js b/packages/loot-core/src/server/spreadsheet/spreadsheet.js index 49de21d..c24ccd1 100644 --- a/packages/loot-core/src/server/spreadsheet/spreadsheet.js +++ b/packages/loot-core/src/server/spreadsheet/spreadsheet.js @@ -1,7 +1,5 @@ import mitt from 'mitt'; -import { schema, schemaConfig } from '../aql/schema'; -import { compileQuery } from '../aql/compiler'; -import { runCompiledQuery } from '../aql/schema/run-query'; +import { compileQuery, runCompiledQuery, schema, schemaConfig } from '../aql'; const Graph = require('./graph-data-structure'); const { unresolveName, resolveName } = require('./util'); diff --git a/packages/loot-core/src/server/sync/migrate.test.js b/packages/loot-core/src/server/sync/migrate.test.js index 5286c59..9a33561 100644 --- a/packages/loot-core/src/server/sync/migrate.test.js +++ b/packages/loot-core/src/server/sync/migrate.test.js @@ -3,9 +3,8 @@ import * as db from '../db'; import { listen, unlisten } from './migrate'; import { addSyncListener, sendMessages } from './index'; import { execTracer } from '../../shared/test-helpers'; -import { schema, schemaConfig } from '../aql/schema'; +import { convertInputType, schema, schemaConfig } from '../aql'; import arbs from '../../mocks/arbitrary-schema'; -import { convertInputType } from '../aql/schema-helpers'; beforeEach(() => { listen(); diff --git a/packages/loot-core/src/server/update.js b/packages/loot-core/src/server/update.js index f108a1a..f4e6459 100644 --- a/packages/loot-core/src/server/update.js +++ b/packages/loot-core/src/server/update.js @@ -1,8 +1,7 @@ import md5 from 'md5'; import * as migrations from './migrate/migrations'; import * as db from './db'; -import { schema, schemaConfig } from './aql/schema'; -import { makeViews } from './aql/views'; +import { schema, schemaConfig, makeViews } from './aql'; // Managing the init/update process From 01d0eb2f0a3c372561bf8e499eacc91787ea4b5f Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Wed, 31 Aug 2022 23:32:25 +0100 Subject: [PATCH 5/9] style: run linter (#232) --- packages/loot-core/src/server/aql/index.js | 16 ++++++++-------- packages/loot-core/src/server/db/index.js | 6 +----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/packages/loot-core/src/server/aql/index.js b/packages/loot-core/src/server/aql/index.js index 2337f2b..493010c 100644 --- a/packages/loot-core/src/server/aql/index.js +++ b/packages/loot-core/src/server/aql/index.js @@ -1,10 +1,10 @@ export { - convertForInsert, - convertForUpdate, - convertFromSelect, - convertInputType, + convertForInsert, + convertForUpdate, + convertFromSelect, + convertInputType } from './schema-helpers'; -export { compileQuery } from "./compiler"; -export { makeViews } from "./views"; -export { schema, schemaConfig } from "./schema"; -export { runQuery, runCompiledQuery } from "./schema/run-query"; +export { compileQuery } from './compiler'; +export { makeViews } from './views'; +export { schema, schemaConfig } from './schema'; +export { runQuery, runCompiledQuery } from './schema/run-query'; diff --git a/packages/loot-core/src/server/db/index.js b/packages/loot-core/src/server/db/index.js index 8c9813e..fdc432c 100644 --- a/packages/loot-core/src/server/db/index.js +++ b/packages/loot-core/src/server/db/index.js @@ -19,11 +19,7 @@ import { makeClientId, Timestamp } from '../crdt'; -import { - convertForInsert, - convertForUpdate, - convertFromSelect -} from '../aql'; +import { convertForInsert, convertForUpdate, convertFromSelect } from '../aql'; import { shoveSortOrders, SORT_INCREMENT } from './sort'; export { toDateRepr, fromDateRepr } from '../models'; From 4c0bd80f2425575dbdd46db0bac69b0b0d9eeb50 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Thu, 1 Sep 2022 12:47:34 +0100 Subject: [PATCH 6/9] Enforce linting in loot-design (#233) * build: add linter to loot-design package * style: automated fixes * style: manual linter fixes --- packages/loot-design/package.json | 10 ++-- .../src/components/PayeeAutocomplete.js | 4 +- .../loot-design/src/components/View.mobile.js | 2 +- .../components/budget/report/components.js | 10 ++-- packages/loot-design/src/components/common.js | 2 +- packages/loot-design/src/components/hooks.js | 2 +- .../src/components/manager/ImportYNAB4.js | 17 ++----- .../src/components/mobile/ScalableImage.js | 2 +- .../src/components/mobile/account.js | 2 +- .../src/components/mobile/budget.js | 48 ++++++++++--------- .../src/components/mobile/budget.test.js | 4 +- .../src/components/mobile/dragdrop.js | 2 +- .../src/components/mobile/transaction.js | 16 ++----- .../components/mobile/transaction.usage.js | 4 +- .../src/components/modals/CloseAccount.js | 10 +--- .../src/components/modals/PlaidExternalMsg.js | 9 +--- .../src/components/payees.usage.js | 7 ++- .../components/spreadsheet/CellDebugger.js | 4 +- .../src/components/spreadsheet/SheetValue.js | 29 +++++------ .../components/spreadsheet/useSheetValue.js | 29 +++++------ packages/loot-design/src/components/table.js | 40 +++++++--------- .../loot-design/src/components/tooltips.js | 3 +- packages/loot-design/src/parse-figma-theme.js | 2 +- packages/loot-design/src/setupTests.js | 2 +- packages/loot-design/src/svg/Add.mobile.js | 8 ++-- packages/loot-design/src/svg/Add.web.js | 8 ++-- packages/loot-design/src/svg/Bank.mobile.js | 6 +-- packages/loot-design/src/svg/Bank.web.js | 6 +-- packages/loot-design/src/svg/Budget.mobile.js | 6 +-- packages/loot-design/src/svg/Budget.web.js | 6 +-- packages/loot-design/src/svg/Check.mobile.js | 3 +- packages/loot-design/src/svg/Check.web.js | 6 +-- packages/loot-design/src/svg/Delete.mobile.js | 6 +-- packages/loot-design/src/svg/Delete.web.js | 6 +-- .../loot-design/src/svg/DownArrow.mobile.js | 6 +-- packages/loot-design/src/svg/DownArrow.web.js | 6 +-- .../loot-design/src/svg/DragIOS.mobile.js | 6 +-- packages/loot-design/src/svg/DragIOS.web.js | 6 +-- .../loot-design/src/svg/ExpandArrow.mobile.js | 6 +-- .../loot-design/src/svg/ExpandArrow.web.js | 12 +++-- .../loot-design/src/svg/LeftArrow.mobile.js | 7 ++- packages/loot-design/src/svg/LeftArrow.web.js | 7 ++- .../loot-design/src/svg/LeftArrow2.mobile.js | 6 +-- .../loot-design/src/svg/LeftArrow2.web.js | 6 +-- .../loot-design/src/svg/LeftArrow3.mobile.js | 6 +-- .../loot-design/src/svg/LeftArrow3.web.js | 6 +-- .../loot-design/src/svg/Loading.mobile.js | 6 +-- packages/loot-design/src/svg/Loading.web.js | 6 +-- packages/loot-design/src/svg/Logo.mobile.js | 6 +-- packages/loot-design/src/svg/Logo.web.js | 6 +-- packages/loot-design/src/svg/Math.mobile.js | 6 +-- packages/loot-design/src/svg/Math.web.js | 6 +-- packages/loot-design/src/svg/Pencil.mobile.js | 7 ++- packages/loot-design/src/svg/Pencil.web.js | 7 ++- .../loot-design/src/svg/Reports.mobile.js | 6 +-- packages/loot-design/src/svg/Reports.web.js | 6 +-- .../loot-design/src/svg/RightArrow.mobile.js | 7 ++- .../loot-design/src/svg/RightArrow.web.js | 7 ++- .../loot-design/src/svg/RightArrow2.mobile.js | 6 +-- .../loot-design/src/svg/RightArrow2.web.js | 6 +-- packages/loot-design/src/svg/Search.mobile.js | 6 +-- packages/loot-design/src/svg/Search.web.js | 6 +-- .../loot-design/src/svg/Settings.mobile.js | 6 +-- packages/loot-design/src/svg/Settings.web.js | 6 +-- .../loot-design/src/svg/Subtract.mobile.js | 6 +-- packages/loot-design/src/svg/Subtract.web.js | 1 - packages/loot-design/src/svg/logo/Logo.ios.js | 6 +-- packages/loot-design/src/svg/merge.mobile.js | 6 +-- packages/loot-design/src/svg/merge.web.js | 6 +-- packages/loot-design/src/svg/split.mobile.js | 6 +-- packages/loot-design/src/svg/split.web.js | 6 +-- yarn.lock | 2 + 72 files changed, 259 insertions(+), 293 deletions(-) diff --git a/packages/loot-design/package.json b/packages/loot-design/package.json index 1b54ea5..4d9a147 100644 --- a/packages/loot-design/package.json +++ b/packages/loot-design/package.json @@ -12,6 +12,8 @@ "chroma-js": "^1.3.3", "date-fns": "2.0.0-alpha.27", "downshift": "1.31.16", + "eslint": "5.6.0", + "eslint-plugin-prettier": "^3.1.4", "fast-glob": "^2.2.2", "formik": "^0.11.10", "glamor": "^2.20.40", @@ -48,7 +50,8 @@ "start:mobile": "IS_REACT_NATIVE=1 react-scripts start", "test": "npm-run-all -cp 'test:*'", "test:web": "jest -c jest.config.js", - "test:react-native": "jest -c jest.rn.config.js" + "test:react-native": "jest -c jest.rn.config.js", + "lint": "eslint src" }, "homepage": "./", "manifest": "manifest.json", @@ -61,8 +64,5 @@ }, "browserslist": [ "electron 3.0" - ], - "eslintConfig": { - "extends": "react-app" - } + ] } diff --git a/packages/loot-design/src/components/PayeeAutocomplete.js b/packages/loot-design/src/components/PayeeAutocomplete.js index 9f48367..4c3ee16 100644 --- a/packages/loot-design/src/components/PayeeAutocomplete.js +++ b/packages/loot-design/src/components/PayeeAutocomplete.js @@ -183,7 +183,9 @@ export default function PayeeAutocomplete({ let payees = useCachedPayees(); let accounts = useCachedAccounts(); - let [focusTransferPayees, setFocusTransferPayees] = useState(defaultFocusTransferPayees); + let [focusTransferPayees, setFocusTransferPayees] = useState( + defaultFocusTransferPayees + ); let payeeSuggestions = useMemo( () => [ { id: 'new', name: '' }, diff --git a/packages/loot-design/src/components/View.mobile.js b/packages/loot-design/src/components/View.mobile.js index e4418c8..f20f299 100644 --- a/packages/loot-design/src/components/View.mobile.js +++ b/packages/loot-design/src/components/View.mobile.js @@ -1,3 +1,3 @@ import { View } from 'react-native'; -export default View +export default View; diff --git a/packages/loot-design/src/components/budget/report/components.js b/packages/loot-design/src/components/budget/report/components.js index 51bdb80..b3d87f9 100644 --- a/packages/loot-design/src/components/budget/report/components.js +++ b/packages/loot-design/src/components/budget/report/components.js @@ -33,7 +33,7 @@ export const BudgetTotalsMonth = React.memo(function BudgetTotalsMonth() { binding={reportBudget.totalBudgetedExpense} type="financial" style={{ color: colors.n4, fontWeight: 600 }} - formatter={(value) => { + formatter={value => { return format(parseFloat(value || '0'), 'financial'); }} /> @@ -136,7 +136,7 @@ function BalanceTooltip({ categoryId, tooltip, monthIndex, onBudgetAction }) { onClose={tooltip.close} > { + onMenuSelect={type => { onBudgetAction(monthIndex, 'carryover', { category: categoryId, flag: !carryover @@ -199,10 +199,10 @@ export const CategoryMonth = React.memo(function CategoryMonth({ binding: reportBudget.catBudgeted(category.id), type: 'financial', getValueStyle: makeAmountGrey, - formatExpr: (expr) => { + formatExpr: expr => { return integerToCurrency(expr); }, - unformatExpr: (expr) => { + unformatExpr: expr => { return amountToInteger(evalArithmetic(expr, 0)); } }} @@ -211,7 +211,7 @@ export const CategoryMonth = React.memo(function CategoryMonth({ onEdit(null); } }} - onSave={(amount) => { + onSave={amount => { onBudgetAction(monthIndex, 'budget-amount', { category: category.id, amount diff --git a/packages/loot-design/src/components/common.js b/packages/loot-design/src/components/common.js index b54c259..1aea5a5 100644 --- a/packages/loot-design/src/components/common.js +++ b/packages/loot-design/src/components/common.js @@ -3,7 +3,7 @@ import React, { useEffect, useLayoutEffect, useState, - useCallback, + useCallback } from 'react'; import { css } from 'glamor'; import mergeRefs from 'react-merge-refs'; diff --git a/packages/loot-design/src/components/hooks.js b/packages/loot-design/src/components/hooks.js index e6eb234..315d1e0 100644 --- a/packages/loot-design/src/components/hooks.js +++ b/packages/loot-design/src/components/hooks.js @@ -1,4 +1,4 @@ -import { useRef } from 'react'; +import { useEffect, useRef } from 'react'; export function useScrollFlasher() { let scrollRef = useRef(null); diff --git a/packages/loot-design/src/components/manager/ImportYNAB4.js b/packages/loot-design/src/components/manager/ImportYNAB4.js index ebb4662..dbe9f93 100644 --- a/packages/loot-design/src/components/manager/ImportYNAB4.js +++ b/packages/loot-design/src/components/manager/ImportYNAB4.js @@ -1,14 +1,7 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { importBudget } from 'loot-core/src/client/actions/budgets'; -import { - View, - Block, - Modal, - Button, - ButtonWithLoading, - P -} from '../common'; +import { View, Block, Modal, Button, ButtonWithLoading, P } from '../common'; import { styles, colors } from '../../style'; function getErrorMessage(error) { @@ -67,10 +60,10 @@ function Import({ modalProps, availableImports }) {

When you've located your data,{' '} - compress it into a zip file. On macOS, right-click - the folder and select "Compress". On Windows, right-click and - select "Send to > Compressed (zipped) folder". Upload the zipped - folder for importing. + compress it into a zip file. On macOS, + right-click the folder and select "Compress". On Windows, + right-click and select "Send to > Compressed (zipped) folder". + Upload the zipped folder for importing.

diff --git a/packages/loot-design/src/components/mobile/ScalableImage.js b/packages/loot-design/src/components/mobile/ScalableImage.js index 5f50fab..531e1dd 100644 --- a/packages/loot-design/src/components/mobile/ScalableImage.js +++ b/packages/loot-design/src/components/mobile/ScalableImage.js @@ -64,7 +64,7 @@ export default function ScalableImage(props) { width: scalableWidth, height: scalableHeight, flex: -1, - overflow: 'hidden', + overflow: 'hidden' }, props.style ]} diff --git a/packages/loot-design/src/components/mobile/account.js b/packages/loot-design/src/components/mobile/account.js index bb7e490..ae3a2fe 100644 --- a/packages/loot-design/src/components/mobile/account.js +++ b/packages/loot-design/src/components/mobile/account.js @@ -64,7 +64,7 @@ export function AccountDetails({ return prependTransactions.concat(transactions); }, [prependTransactions, transactions]); - console.log('rendering') + console.log('rendering'); return ( diff --git a/packages/loot-design/src/components/mobile/budget.js b/packages/loot-design/src/components/mobile/budget.js index 5eb4461..65033ff 100644 --- a/packages/loot-design/src/components/mobile/budget.js +++ b/packages/loot-design/src/components/mobile/budget.js @@ -123,7 +123,7 @@ export class BudgetCell extends React.PureComponent { return ( - {(node) => { + {node => { return ( { + onBlur={value => { onBudgetAction(month, 'budget-amount', { category: categoryId, amount: amountToInteger(value) @@ -288,7 +288,7 @@ export class BudgetCategory extends React.PureComponent { let content = ( (this.container = el)} + ref={el => (this.container = el)} style={[ { backgroundColor: editing ? colors.p11 : 'transparent', @@ -323,7 +323,7 @@ export class BudgetCategory extends React.PureComponent { name="balance" binding={balance} style={[styles.smallText, { width: 90, textAlign: 'right' }]} - getStyle={(value) => value < 0 && { color: colors.r4 }} + getStyle={value => value < 0 && { color: colors.r4 }} type="financial" /> @@ -487,8 +487,14 @@ export class TotalsRow extends React.PureComponent { export class IncomeCategory extends React.PureComponent { render() { - const { name, budget, balance, style, nameTextStyle, amountTextStyle } = - this.props; + const { + name, + budget, + balance, + style, + nameTextStyle, + amountTextStyle + } = this.props; return ( { + getGroups = memoizeOne(groups => { return { - incomeGroup: groups.find((group) => group.is_income), - expenseGroups: groups.filter((group) => !group.is_income) + incomeGroup: groups.find(group => group.is_income), + expenseGroups: groups.filter(group => !group.is_income) }; }); @@ -742,7 +748,7 @@ export class BudgetGroups extends React.Component { return ( - {expenseGroups.map((group) => { + {expenseGroups.map(group => { return ( { + const keyboardWillHide = e => { if (ACTScrollViewManager) { ACTScrollViewManager.setFocused(-1); } @@ -831,7 +837,7 @@ export class BudgetTable extends React.Component { this.cleanup(); } - onEditCategory = (id) => { + onEditCategory = id => { this.setState({ editingCategory: id }); }; @@ -849,11 +855,9 @@ export class BudgetTable extends React.Component { onMoveUp = () => { const { categories } = this.props; const { editingCategory } = this.state; - const expenseCategories = categories.filter((cat) => !cat.is_income); + const expenseCategories = categories.filter(cat => !cat.is_income); - const idx = expenseCategories.findIndex( - (cat) => editingCategory === cat.id - ); + const idx = expenseCategories.findIndex(cat => editingCategory === cat.id); if (idx - 1 >= 0) { this.onEditCategory(expenseCategories[idx - 1].id); } @@ -862,11 +866,9 @@ export class BudgetTable extends React.Component { onMoveDown = () => { const { categories } = this.props; const { editingCategory } = this.state; - const expenseCategories = categories.filter((cat) => !cat.is_income); + const expenseCategories = categories.filter(cat => !cat.is_income); - const idx = expenseCategories.findIndex( - (cat) => editingCategory === cat.id - ); + const idx = expenseCategories.findIndex(cat => editingCategory === cat.id); if (idx + 1 < expenseCategories.length) { this.onEditCategory(expenseCategories[idx + 1].id); } @@ -937,7 +939,7 @@ export class BudgetTable extends React.Component { styles.smallText, { color: colors.n1, textAlign: 'right', fontWeight: '500' } ]} - formatter={(value) => { + formatter={value => { return format(-parseFloat(value || '0'), 'financial'); }} /> @@ -958,7 +960,7 @@ export class BudgetTable extends React.Component { {!editMode ? ( (this.list = el)} + ref={el => (this.list = el)} keyboardShouldPersistTaps="always" refreshControl={refreshControl} style={{ backgroundColor: colors.n10 }} @@ -993,7 +995,7 @@ export class BudgetTable extends React.Component { ref={this.gestures.scroll} > { + ref={el => { scrollRef.current = el; this.list = el; }} diff --git a/packages/loot-design/src/components/mobile/budget.test.js b/packages/loot-design/src/components/mobile/budget.test.js index 12454e1..3fd5929 100644 --- a/packages/loot-design/src/components/mobile/budget.test.js +++ b/packages/loot-design/src/components/mobile/budget.test.js @@ -178,7 +178,7 @@ describe('Budget', () => { expectToBeEditingRow(container, 1); // It should never go past the last expense category - let lastCat = categories.findIndex((c) => c.is_income) - 1; + let lastCat = categories.findIndex(c => c.is_income) - 1; editRow(container, lastCat); expectToBeEditingRow(container, lastCat); fireEvent.press(getButton(container, 'down')); @@ -247,7 +247,7 @@ describe('Budget', () => { fireEvent.press(getButton(container, 'done')); expectToNotBeEditing(container); - await new Promise((resolve) => setTimeout(resolve, 100)); + await new Promise(resolve => setTimeout(resolve, 100)); expect(getField(container, 1, 'budgeted').textContent).toBe('22.00'); }); }); diff --git a/packages/loot-design/src/components/mobile/dragdrop.js b/packages/loot-design/src/components/mobile/dragdrop.js index 812495f..959af4d 100644 --- a/packages/loot-design/src/components/mobile/dragdrop.js +++ b/packages/loot-design/src/components/mobile/dragdrop.js @@ -173,7 +173,7 @@ export function DragDrop({ makeHighlight, children, style }) { A.set(ax, absoluteX), A.set(ay, absoluteY), - A.call([ax, ay], onDragMove), + A.call([ax, ay], onDragMove) ]) ]) } diff --git a/packages/loot-design/src/components/mobile/transaction.js b/packages/loot-design/src/components/mobile/transaction.js index 9f9c6d0..fcedc83 100644 --- a/packages/loot-design/src/components/mobile/transaction.js +++ b/packages/loot-design/src/components/mobile/transaction.js @@ -1,11 +1,5 @@ import React from 'react'; -import { - View, - Text, - SectionList, - ScrollView, - Animated -} from 'react-native'; +import { View, Text, SectionList, ScrollView, Animated } from 'react-native'; import memoizeOne from 'memoize-one'; import { format as formatDate, @@ -772,8 +766,8 @@ export class Transaction extends React.PureComponent { let prettyCategory = transferAcct ? 'Transfer' : is_parent - ? 'Split' - : categoryName; + ? 'Split' + : categoryName; let isPreview = isPreviewId(id); let textStyle = isPreview && { @@ -787,8 +781,8 @@ export class Transaction extends React.PureComponent { notes === 'missed' ? colors.r6 : notes === 'due' - ? colors.y4 - : colors.n5 + ? colors.y4 + : colors.n5 } ]; diff --git a/packages/loot-design/src/components/mobile/transaction.usage.js b/packages/loot-design/src/components/mobile/transaction.usage.js index 2edf4f7..90830f9 100644 --- a/packages/loot-design/src/components/mobile/transaction.usage.js +++ b/packages/loot-design/src/components/mobile/transaction.usage.js @@ -33,8 +33,8 @@ transactions.sort((t1, t2) => { return monthUtils.isBefore(t1.date, t2.date) ? 1 : monthUtils.isAfter(t1.date, t2.date) - ? -1 - : 0; + ? -1 + : 0; }); transactions[1].description = 'A really long one to test to see what happens when there iss too much'; diff --git a/packages/loot-design/src/components/modals/CloseAccount.js b/packages/loot-design/src/components/modals/CloseAccount.js index 6e53820..b53a8b3 100644 --- a/packages/loot-design/src/components/modals/CloseAccount.js +++ b/packages/loot-design/src/components/modals/CloseAccount.js @@ -1,14 +1,6 @@ import React, { useState } from 'react'; import { Formik } from 'formik'; -import { - View, - Text, - Modal, - Button, - P, - Select, - FormError, -} from '../common'; +import { View, Text, Modal, Button, P, Select, FormError } from '../common'; import { integerToCurrency } from 'loot-core/src/shared/util'; import { colors } from '../../style'; diff --git a/packages/loot-design/src/components/modals/PlaidExternalMsg.js b/packages/loot-design/src/components/modals/PlaidExternalMsg.js index 31e3d6b..edfbb32 100644 --- a/packages/loot-design/src/components/modals/PlaidExternalMsg.js +++ b/packages/loot-design/src/components/modals/PlaidExternalMsg.js @@ -1,12 +1,5 @@ import React, { useState, useRef } from 'react'; -import { - View, - Text, - Modal, - Button, - P, - ModalButtons -} from '../common'; +import { View, Text, Modal, Button, P, ModalButtons } from '../common'; import { Error } from '../alerts'; import { colors } from '../../style'; import AnimatedLoading from '../../svg/v1/AnimatedLoading'; diff --git a/packages/loot-design/src/components/payees.usage.js b/packages/loot-design/src/components/payees.usage.js index 549d06c..c40aa48 100644 --- a/packages/loot-design/src/components/payees.usage.js +++ b/packages/loot-design/src/components/payees.usage.js @@ -95,7 +95,12 @@ export default () => ( onClose: () => setState({ isCurrent: true }) }} payees={state.payees} - ruleCounts={new Map([['three', 1], ['tw', 3]])} + ruleCounts={ + new Map([ + ['three', 1], + ['tw', 3] + ]) + } categoryGroups={categoryGroups} onBatchChange={changes => { setState({ payees: applyChanges(changes, state.payees) }); diff --git a/packages/loot-design/src/components/spreadsheet/CellDebugger.js b/packages/loot-design/src/components/spreadsheet/CellDebugger.js index c7c84ad..1339ced 100644 --- a/packages/loot-design/src/components/spreadsheet/CellDebugger.js +++ b/packages/loot-design/src/components/spreadsheet/CellDebugger.js @@ -34,9 +34,7 @@ class CellDebugger extends Component { render() { return ( - - {this.props.name}:{' '} - + {this.props.name}: { - if (binding.query) { - spreadsheet.createQuery(sheetName, binding.name, binding.query); + useLayoutEffect(() => { + if (binding.query) { + spreadsheet.createQuery(sheetName, binding.name, binding.query); + } + + return spreadsheet.bind(sheetName, binding, null, newResult => { + if (latestOnChange.current) { + latestOnChange.current(newResult); } - return spreadsheet.bind(sheetName, binding, null, newResult => { - if (latestOnChange.current) { - latestOnChange.current(newResult); - } - - if (newResult.value !== latestValue.current) { - setResult(newResult); - } - }); - }, - [sheetName, binding.name] - ); + if (newResult.value !== latestValue.current) { + setResult(newResult); + } + }); + }, [sheetName, binding.name]); return result.value != null ? children(result, setCell) : null; } diff --git a/packages/loot-design/src/components/spreadsheet/useSheetValue.js b/packages/loot-design/src/components/spreadsheet/useSheetValue.js index 3dc9f56..6ed20ef 100644 --- a/packages/loot-design/src/components/spreadsheet/useSheetValue.js +++ b/packages/loot-design/src/components/spreadsheet/useSheetValue.js @@ -51,24 +51,21 @@ export default function useSheetValue(binding, onChange) { latestValue.current = result.value; }); - useLayoutEffect( - () => { - if (binding.query) { - spreadsheet.createQuery(sheetName, binding.name, binding.query); + useLayoutEffect(() => { + if (binding.query) { + spreadsheet.createQuery(sheetName, binding.name, binding.query); + } + + return spreadsheet.bind(sheetName, binding, null, newResult => { + if (latestOnChange.current) { + latestOnChange.current(newResult); } - return spreadsheet.bind(sheetName, binding, null, newResult => { - if (latestOnChange.current) { - latestOnChange.current(newResult); - } - - if (newResult.value !== latestValue.current) { - setResult(newResult); - } - }); - }, - [sheetName, binding.name] - ); + if (newResult.value !== latestValue.current) { + setResult(newResult); + } + }); + }, [sheetName, binding.name]); return result.value; } diff --git a/packages/loot-design/src/components/table.js b/packages/loot-design/src/components/table.js index efe1ee1..4ff5922 100644 --- a/packages/loot-design/src/components/table.js +++ b/packages/loot-design/src/components/table.js @@ -31,10 +31,7 @@ import SheetValue from './spreadsheet/SheetValue'; import DateSelect from './DateSelect'; import format from './spreadsheet/format'; import { keys } from '../util/keys'; -import { - AvoidRefocusScrollProvider, - useProperFocus, -} from './useProperFocus'; +import { AvoidRefocusScrollProvider, useProperFocus } from './useProperFocus'; import { useSelectedItems } from './useSelected'; export const ROW_HEIGHT = 32; @@ -250,26 +247,23 @@ export function Row({ let rowRef = useRef(null); let timer = useRef(null); - useEffect( - () => { - if (highlighted && !prevHighlighted.current && rowRef.current) { - rowRef.current.classList.add('animated'); - setShouldHighlight(true); + useEffect(() => { + if (highlighted && !prevHighlighted.current && rowRef.current) { + rowRef.current.classList.add('animated'); + setShouldHighlight(true); + + clearTimeout(timer.current); + timer.current = setTimeout(() => { + setShouldHighlight(false); - clearTimeout(timer.current); timer.current = setTimeout(() => { - setShouldHighlight(false); - - timer.current = setTimeout(() => { - if (rowRef.current) { - rowRef.current.classList.remove('animated'); - } - }, 500); + if (rowRef.current) { + rowRef.current.classList.remove('animated'); + } }, 500); - } - }, - [highlighted] - ); + }, 500); + } + }, [highlighted]); useEffect(() => { prevHighlighted.current = highlighted; @@ -1233,8 +1227,8 @@ export function useTableNavigator(data, fields, opts = {}) { ? 'up' : 'down' : e.shiftKey - ? 'left' - : 'right' + ? 'left' + : 'right' ); break; default: diff --git a/packages/loot-design/src/components/tooltips.js b/packages/loot-design/src/components/tooltips.js index afc2f39..acd99d3 100644 --- a/packages/loot-design/src/components/tooltips.js +++ b/packages/loot-design/src/components/tooltips.js @@ -189,7 +189,8 @@ export class Tooltip extends React.Component { // If it doesn't fit below it, switch it above only if it does // fit above it (this.position.indexOf('bottom') !== -1 && - (testBottom > containerRect.height && testTop > 0)) + testBottom > containerRect.height && + testTop > 0) ) { // Invert the position this.position = this.getOppositePosition(this.position); diff --git a/packages/loot-design/src/parse-figma-theme.js b/packages/loot-design/src/parse-figma-theme.js index 28c2a56..8795388 100644 --- a/packages/loot-design/src/parse-figma-theme.js +++ b/packages/loot-design/src/parse-figma-theme.js @@ -1,7 +1,7 @@ let fs = require('fs'); let contents = fs.readFileSync(process.argv[2], 'utf8'); -let list = contents.match(/(\#[0-9a-fA-F]*)/g); +let list = contents.match(/(#[0-9a-fA-F]*)/g); let groups = ['y', 'r', 'b', 'n', 'g', 'p']; let colors = {}; diff --git a/packages/loot-design/src/setupTests.js b/packages/loot-design/src/setupTests.js index ebf5e77..27fad9d 100644 --- a/packages/loot-design/src/setupTests.js +++ b/packages/loot-design/src/setupTests.js @@ -53,7 +53,7 @@ process.on('unhandledRejection', reason => { }); global.afterEach(() => { - __resetWorld(); + global.__resetWorld(); }); // https://github.com/testing-library/react-testing-library#suppressing-unnecessary-warnings-on-react-dom-168 diff --git a/packages/loot-design/src/svg/Add.mobile.js b/packages/loot-design/src/svg/Add.mobile.js index 1f16d3a..a121771 100644 --- a/packages/loot-design/src/svg/Add.mobile.js +++ b/packages/loot-design/src/svg/Add.mobile.js @@ -1,5 +1,5 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ -import React from "react"; +import React from 'react'; import { Svg, @@ -18,9 +18,9 @@ import { Use, Defs, Stop -} from "mobile/node_modules/react-native-svg"; +} from 'mobile/node_modules/react-native-svg'; -function Add({ width, height, style, color = "black", ...props }) { +function Add({ width, height, style, color = 'black', ...props }) { return ( diff --git a/packages/loot-design/src/svg/Add.web.js b/packages/loot-design/src/svg/Add.web.js index c651c73..ad94f41 100644 --- a/packages/loot-design/src/svg/Add.web.js +++ b/packages/loot-design/src/svg/Add.web.js @@ -1,8 +1,8 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ -import React from "react"; -import { css } from "glamor"; +import React from 'react'; +import { css } from 'glamor'; -function Add({ width, height, style, color = "black", ...props }) { +function Add({ width, height, style, color = 'black', ...props }) { return ( diff --git a/packages/loot-design/src/svg/Bank.mobile.js b/packages/loot-design/src/svg/Bank.mobile.js index 6f619a6..d71ce89 100644 --- a/packages/loot-design/src/svg/Bank.mobile.js +++ b/packages/loot-design/src/svg/Bank.mobile.js @@ -1,5 +1,5 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ -import React from "react"; +import React from 'react'; import { Svg, @@ -18,9 +18,9 @@ import { Use, Defs, Stop -} from "mobile/node_modules/react-native-svg"; +} from 'mobile/node_modules/react-native-svg'; -function Bank({ width, height, style, color = "black", ...props }) { +function Bank({ width, height, style, color = 'black', ...props }) { return ( ; -function LeftArrow3({ width, height, style, color = "black", ...props }) { +function LeftArrow3({ width, height, style, color = 'black', ...props }) { return ( diff --git a/packages/loot-design/src/svg/Pencil.web.js b/packages/loot-design/src/svg/Pencil.web.js index b3d23ce..1e82041 100644 --- a/packages/loot-design/src/svg/Pencil.web.js +++ b/packages/loot-design/src/svg/Pencil.web.js @@ -1,8 +1,8 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ -import React from "react"; -import { css } from "glamor"; +import React from 'react'; +import { css } from 'glamor'; -function Pencil({ width, height, style, color = "black", ...props }) { +function Pencil({ width, height, style, color = 'black', ...props }) { return ( diff --git a/packages/loot-design/src/svg/Reports.mobile.js b/packages/loot-design/src/svg/Reports.mobile.js index 073f8dc..2ab8844 100644 --- a/packages/loot-design/src/svg/Reports.mobile.js +++ b/packages/loot-design/src/svg/Reports.mobile.js @@ -1,5 +1,5 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ -import React from "react"; +import React from 'react'; import { Svg, @@ -18,9 +18,9 @@ import { Use, Defs, Stop -} from "mobile/node_modules/react-native-svg"; +} from 'mobile/node_modules/react-native-svg'; -function Reports({ width, height, style, color = "black", ...props }) { +function Reports({ width, height, style, color = 'black', ...props }) { return ( diff --git a/packages/loot-design/src/svg/logo/Logo.ios.js b/packages/loot-design/src/svg/logo/Logo.ios.js index ec43b37..cd74b3a 100644 --- a/packages/loot-design/src/svg/logo/Logo.ios.js +++ b/packages/loot-design/src/svg/logo/Logo.ios.js @@ -1,5 +1,5 @@ -import React from "react"; -import Svg, { Path } from "react-native-svg"; +import React from 'react'; +import Svg, { Path } from 'react-native-svg'; const SvgLogo = props => ( ( height={32} fill="none" style={{ - color: "#242134", + color: '#242134', ...props.style }} > diff --git a/packages/loot-design/src/svg/merge.mobile.js b/packages/loot-design/src/svg/merge.mobile.js index 0a22c2e..ca01b67 100644 --- a/packages/loot-design/src/svg/merge.mobile.js +++ b/packages/loot-design/src/svg/merge.mobile.js @@ -1,5 +1,5 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ -import React from "react"; +import React from 'react'; import { Svg, @@ -18,9 +18,9 @@ import { Use, Defs, Stop -} from "mobile/node_modules/react-native-svg"; +} from 'mobile/node_modules/react-native-svg'; -function Merge({ width, height, style, color = "black", ...props }) { +function Merge({ width, height, style, color = 'black', ...props }) { return ( Date: Thu, 1 Sep 2022 09:11:31 -0400 Subject: [PATCH 7/9] Allow `enter` to create new transaction when focused on `cleared` column (#234) --- .../src/components/accounts/TransactionsTable.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/desktop-client/src/components/accounts/TransactionsTable.js b/packages/desktop-client/src/components/accounts/TransactionsTable.js index 9b678e7..3ba3d9d 100644 --- a/packages/desktop-client/src/components/accounts/TransactionsTable.js +++ b/packages/desktop-client/src/components/accounts/TransactionsTable.js @@ -1634,7 +1634,8 @@ export let TransactionTable = React.forwardRef((props, ref) => { onAddSplit(lastTransaction.id); } else if ( (newNavigator.focusedField === 'debit' || - newNavigator.focusedField === 'credit') && + newNavigator.focusedField === 'credit' || + newNavigator.focusedField === 'cleared') && newNavigator.editingId === lastTransaction.id && (!isSplit || !lastTransaction.error) ) { From dc53a744594cfb078c8d42a36859c4d4d11ef189 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Fri, 2 Sep 2022 12:43:37 +0100 Subject: [PATCH 8/9] Separate external, monorepo and internal imports (#237) * style: enforce ordering of imports * style: sort imports in loot-core * style: sort imports in desktop-client * style: sort imports in loot-design * style: manual fixes --- .eslintrc.js | 29 +- packages/desktop-client/package.json | 2 +- .../src/components/AnimatedRefresh.js | 2 + packages/desktop-client/src/components/App.js | 3 + .../src/components/AppBackground.js | 5 +- .../src/components/Background.js | 1 + .../src/components/BankSyncStatus.js | 2 + .../desktop-client/src/components/Debugger.js | 4 +- .../src/components/FatalError.js | 1 + .../src/components/FinancesApp.js | 6 +- .../src/components/FloatableSidebar.js | 2 + .../src/components/GlobalKeys.js | 1 + .../src/components/LoggedInUser.js | 1 + .../src/components/MobileWebMessage.js | 1 + .../desktop-client/src/components/Modals.js | 6 +- .../src/components/Notifications.js | 4 +- .../desktop-client/src/components/Page.js | 1 + .../desktop-client/src/components/Settings.js | 4 +- .../src/components/SidebarWithData.js | 4 +- .../src/components/SpreadsheetInterface.js | 1 + .../desktop-client/src/components/Titlebar.js | 2 + .../desktop-client/src/components/Tutorial.js | 5 +- .../src/components/TutorialPoints.js | 1 + .../src/components/UpdateNotification.js | 4 +- .../src/components/accounts/Account.js | 5 +- .../components/accounts/AccountSyncCheck.js | 2 + .../src/components/accounts/Filters.js | 3 + .../accounts/SimpleTransactionsTable.js | 3 + .../components/accounts/TransactionList.js | 3 + .../components/accounts/TransactionsTable.js | 3 + .../accounts/TransactionsTable.test.js | 4 + .../components/budget/MonthCountSelector.js | 1 + .../src/components/budget/index.js | 5 +- .../src/components/debug/index.js | 2 + .../src/components/manager/ConfigServer.js | 2 + .../src/components/manager/ManagementApp.js | 6 +- .../src/components/manager/Modals.js | 5 +- .../src/components/manager/ServerURL.js | 1 + .../components/manager/subscribe/Bootstrap.js | 2 + .../manager/subscribe/ChangePassword.js | 2 + .../manager/subscribe/ConfirmPasswordForm.js | 2 + .../src/components/manager/subscribe/Error.js | 1 + .../src/components/manager/subscribe/Login.js | 2 + .../components/manager/subscribe/common.js | 1 + .../modals/ConfirmCategoryDelete.js | 1 + .../src/components/modals/CreateAccount.js | 5 +- .../components/modals/CreateEncryptionKey.js | 2 + .../src/components/modals/EditRule.js | 2 + .../src/components/modals/FixEncryptionKey.js | 1 + .../src/components/modals/ManageRules.js | 2 + .../components/modals/MergeUnusedPayees.js | 1 + .../src/components/modals/WelcomeScreen.js | 1 + .../components/payees/ManagePayeesWithData.js | 1 + .../src/components/reports/CashFlow.js | 3 + .../src/components/reports/Change.js | 1 + .../src/components/reports/Container.js | 3 +- .../src/components/reports/DateRange.js | 2 + .../src/components/reports/Header.js | 1 + .../src/components/reports/NetWorth.js | 5 +- .../src/components/reports/Overview.js | 5 +- .../src/components/reports/Tooltip.js | 2 + .../reports/graphs/CashFlowGraph.js | 3 + .../reports/graphs/NetWorthGraph.js | 2 + .../reports/graphs/cash-flow-spreadsheet.js | 5 +- .../reports/graphs/net-worth-spreadsheet.js | 5 +- .../src/components/reports/index.js | 2 + .../src/components/reports/util.js | 1 + .../components/schedules/DiscoverSchedules.js | 2 + .../src/components/schedules/EditSchedule.js | 2 + .../src/components/schedules/LinkSchedule.js | 2 + .../schedules/PostsOfflineNotification.js | 2 + .../components/schedules/SchedulesTable.js | 2 + .../src/components/schedules/StatusBadge.js | 2 +- .../src/components/schedules/index.js | 2 + .../src/components/tools/FixSplitsTool.js | 2 + .../components/tutorial/BudgetCategories.js | 2 + .../src/components/tutorial/BudgetInitial.js | 5 +- .../components/tutorial/BudgetNewIncome.js | 2 + .../components/tutorial/BudgetNextMonth.js | 5 +- .../src/components/tutorial/BudgetSummary.js | 2 + .../components/tutorial/CategoryBalance.js | 2 + .../components/tutorial/DeleteTransactions.js | 2 + .../src/components/tutorial/Final.js | 2 + .../src/components/tutorial/Intro.js | 2 + .../src/components/tutorial/Navigation.js | 1 + .../src/components/tutorial/Overspending.js | 5 +- .../src/components/tutorial/TransactionAdd.js | 2 + .../components/tutorial/TransactionEnter.js | 2 + .../tutorial/TransactionFinalize.js | 5 +- .../src/components/tutorial/common.js | 2 + .../src/components/util/AmountInput.js | 1 + .../src/components/util/DisplayId.js | 1 + .../src/components/util/GenericInput.js | 1 + .../src/hooks/useServerVersion.js | 1 + packages/desktop-client/src/index.js | 7 +- packages/loot-core/package.json | 1 + .../src/client/SpreadsheetProvider.js | 3 + .../loot-core/src/client/actions/budgets.js | 1 + .../src/client/actions/notifications.js | 1 + .../loot-core/src/client/actions/queries.js | 1 + .../src/client/data-hooks/accounts.js | 1 + .../loot-core/src/client/data-hooks/payees.js | 1 + .../src/client/data-hooks/schedules.js | 1 + packages/loot-core/src/client/queries.js | 1 + .../loot-core/src/client/query-helpers.js | 1 - packages/loot-core/src/client/query-hooks.js | 1 + .../loot-core/src/client/reducers/queries.js | 3 +- .../loot-core/src/mocks/arbitrary-schema.js | 1 + packages/loot-core/src/mocks/index.js | 1 + packages/loot-core/src/mocks/redux.js | 2 + packages/loot-core/src/mocks/util.js | 3 +- .../server/asyncStorage/index.electron.js | 3 +- .../server/connection/index.electron.js | 3 +- .../server/connection/index.mobile.js | 3 +- .../platform/server/fetch/index.electron.js | 1 + .../src/platform/server/fs/index.mobile.js | 1 + .../src/platform/server/fs/index.web.js | 1 + .../src/platform/server/fs/index.web.test.js | 1 + .../platform/server/sqlite/index.web.test.js | 1 + .../src/server/accounts/export-to-csv.js | 1 + .../loot-core/src/server/accounts/link.js | 1 + .../src/server/accounts/parse-file.js | 3 +- .../src/server/accounts/parse-file.test.js | 3 +- .../loot-core/src/server/accounts/rules.js | 3 +- .../loot-core/src/server/accounts/sync.js | 3 +- .../src/server/accounts/sync.test.js | 2 + .../src/server/accounts/transactions.js | 1 + packages/loot-core/src/server/app.js | 1 + .../loot-core/src/server/aql/exec.test.js | 1 + .../src/server/aql/schema/executors.test.js | 1 + .../src/server/aql/schema/run-query.js | 3 +- packages/loot-core/src/server/backups.js | 4 +- packages/loot-core/src/server/backups.test.js | 1 + packages/loot-core/src/server/budget/base.js | 2 +- .../loot-core/src/server/budget/report.js | 1 + .../loot-core/src/server/budget/rollover.js | 1 + .../loot-core/src/server/cloud-storage.js | 4 +- .../loot-core/src/server/crdt/timestamp.js | 1 + packages/loot-core/src/server/db/index.js | 1 + packages/loot-core/src/server/db/mappings.js | 3 +- packages/loot-core/src/server/encryption.js | 1 + packages/loot-core/src/server/main-app.js | 1 + packages/loot-core/src/server/main.js | 5 +- packages/loot-core/src/server/migrate/cli.js | 2 +- .../src/server/migrate/migrations.js | 5 +- packages/loot-core/src/server/post.js | 1 + packages/loot-core/src/server/prefs.js | 1 + .../loot-core/src/server/schedules/app.js | 1 + .../src/server/schedules/app.test.js | 3 +- .../src/server/schedules/find-schedules.js | 2 + packages/loot-core/src/server/sheet.js | 1 + .../src/server/spreadsheet/interpreter.js | 1 + .../src/server/spreadsheet/new/vm.test.js | 1 + .../src/server/spreadsheet/spreadsheet.js | 1 + .../spreadsheet/tests/data-propagation.js | 1 + .../loot-core/src/server/spreadsheet/usage.js | 4 +- packages/loot-core/src/server/sync/encoder.js | 1 + .../src/server/sync/make-test-message.js | 1 + packages/loot-core/src/server/sync/migrate.js | 3 +- .../loot-core/src/server/sync/migrate.test.js | 4 +- packages/loot-core/src/server/sync/reset.js | 1 + .../src/server/sync/sync.property.test.js | 4 +- .../loot-core/src/server/sync/sync.test.js | 4 +- .../src/server/tests/mockSyncServer.js | 2 + packages/loot-core/src/server/undo.js | 1 + packages/loot-core/src/server/update.js | 1 + .../loot-core/src/server/util/budget-name.js | 1 + .../loot-core/src/shared/schedules.test.js | 3 +- packages/loot-core/src/shared/transactions.js | 1 + .../loot-core/src/shared/transactions.test.js | 1 + .../src/components/AccountAutocomplete.js | 2 + .../src/components/Autocomplete.js | 2 + .../src/components/Autocomplete.usage.js | 4 +- .../src/components/CategorySelect.js | 1 + .../loot-design/src/components/DateSelect.js | 6 +- .../src/components/DateSelect.usage.js | 1 + .../src/components/FixedSizeList.js | 2 + .../loot-design/src/components/KeyHandlers.js | 3 +- .../loot-design/src/components/NotesButton.js | 3 + .../src/components/PayeeAutocomplete.js | 2 + .../src/components/RecurringSchedulePicker.js | 14 +- .../RecurringSchedulePicker.usage.js | 3 +- packages/loot-design/src/components/Stack.js | 1 + packages/loot-design/src/components/Text.js | 1 + .../src/components/TutorialPoint.js | 1 + packages/loot-design/src/components/View.js | 1 + packages/loot-design/src/components/alerts.js | 1 + .../components/budget/BalanceWithCarryover.js | 1 + .../budget/BudgetMonthCountContext.js | 1 + .../src/components/budget/BudgetSummaries.js | 5 +- .../components/budget/DynamicBudgetTable.js | 4 +- .../src/components/budget/MonthsContext.js | 1 + .../src/components/budget/index.js | 9 +- .../src/components/budget/index.usage.js | 8 +- .../components/budget/report/BudgetSummary.js | 3 + .../components/budget/report/ReportContext.js | 1 + .../components/budget/report/components.js | 2 + .../budget/rollover/BudgetSummary.js | 3 + .../components/budget/rollover/HoldTooltip.js | 2 + .../budget/rollover/RolloverContext.js | 1 + .../budget/rollover/TransferTooltip.js | 2 + .../budget/rollover/rollover-components.js | 2 + .../loot-design/src/components/budget/util.js | 1 + packages/loot-design/src/components/common.js | 11 +- .../src/components/common.usage.js | 2 + packages/loot-design/src/components/forms.js | 2 + .../loot-design/src/components/icons.usage.js | 1 + .../src/components/manager/BudgetList.js | 8 +- .../components/manager/BudgetList.usage.js | 1 + .../src/components/manager/DeleteFile.js | 1 + .../components/manager/DeleteFile.usage.js | 1 + .../src/components/manager/Import.js | 1 + .../src/components/manager/Import.usage.js | 1 + .../src/components/manager/ImportActual.js | 2 + .../src/components/manager/ImportYNAB4.js | 2 + .../src/components/manager/ImportYNAB5.js | 2 + .../src/components/mobile/AmountInput.js | 13 +- .../AndroidKeyboardAvoidingView.android.js | 1 + .../components/mobile/FocusAwareStatusBar.js | 1 + .../mobile/TextInputWithAccessory.android.js | 1 + .../src/components/mobile/account.js | 1 + .../src/components/mobile/account.usage.js | 4 +- .../src/components/mobile/accounts.js | 2 + .../src/components/mobile/accounts.usage.js | 8 +- .../src/components/mobile/alerts.js | 1 + .../src/components/mobile/budget.js | 12 +- .../src/components/mobile/budget.test.js | 7 +- .../src/components/mobile/budget.usage.js | 6 +- .../src/components/mobile/common.js | 1 + .../src/components/mobile/dragdrop.js | 1 + .../src/components/mobile/forms.js | 1 + .../src/components/mobile/table.js | 4 +- .../src/components/mobile/transaction.js | 8 +- .../components/mobile/transaction.usage.js | 6 +- .../src/components/modals/CloseAccount.js | 5 +- .../components/modals/CloseAccount.usage.js | 4 +- .../modals/ConfigureLinkedAccounts.js | 6 +- .../modals/ConfigureLinkedAccounts.usage.js | 1 + .../components/modals/CreateLocalAccount.js | 5 +- .../modals/CreateLocalAccount.usage.js | 1 + .../src/components/modals/EditField.js | 3 + .../components/modals/ImportTransactions.js | 3 + .../modals/ImportTransactions.usage.js | 4 +- .../src/components/modals/LoadBackup.js | 1 + .../src/components/modals/LoadBackup.usage.js | 1 + .../src/components/modals/PlaidExternalMsg.js | 1 + .../modals/PlaidExternalMsg.usage.js | 1 + .../components/modals/SelectLinkedAccounts.js | 6 +- .../modals/SelectLinkedAccounts.usage.js | 1 + packages/loot-design/src/components/payees.js | 9 +- .../src/components/payees.usage.js | 7 +- .../loot-design/src/components/sidebar.js | 12 +- .../src/components/sidebar.usage.js | 11 +- packages/loot-design/src/components/sort.js | 1 + .../components/spreadsheet/CellDebugger.js | 1 + .../src/components/spreadsheet/CellValue.js | 1 + .../src/components/spreadsheet/SheetValue.js | 1 + .../components/spreadsheet/useSheetValue.js | 1 + packages/loot-design/src/components/table.js | 4 +- .../loot-design/src/components/table.usage.js | 2 + .../loot-design/src/components/tooltips.js | 2 + .../loot-design/src/components/useSelected.js | 4 +- packages/loot-design/src/guide/components.js | 1 + packages/loot-design/src/guide/document.js | 1 + .../guide/mocks/react-native-reanimated.js | 1 + packages/loot-design/src/index.js | 3 +- packages/loot-design/src/setupTests.js | 1 + packages/loot-design/src/svg/Add.web.js | 1 + .../src/svg/AnimatedLoading.mobile.js | 3 +- .../src/svg/AnimatedLoading.web.js | 4 +- packages/loot-design/src/svg/Bank.web.js | 1 + packages/loot-design/src/svg/Budget.web.js | 1 + packages/loot-design/src/svg/Check.web.js | 1 + packages/loot-design/src/svg/Delete.web.js | 1 + packages/loot-design/src/svg/DownArrow.web.js | 1 + packages/loot-design/src/svg/DragIOS.web.js | 1 + .../loot-design/src/svg/ExpandArrow.web.js | 1 + packages/loot-design/src/svg/LeftArrow.web.js | 1 + .../loot-design/src/svg/LeftArrow2.web.js | 1 + .../loot-design/src/svg/LeftArrow3.web.js | 1 + packages/loot-design/src/svg/Loading.web.js | 1 + packages/loot-design/src/svg/Logo.web.js | 1 + packages/loot-design/src/svg/Math.web.js | 1 + packages/loot-design/src/svg/Pencil.web.js | 1 + packages/loot-design/src/svg/Reports.web.js | 1 + .../loot-design/src/svg/RightArrow.web.js | 1 + .../loot-design/src/svg/RightArrow2.web.js | 1 + packages/loot-design/src/svg/Search.web.js | 1 + packages/loot-design/src/svg/Settings.web.js | 1 + packages/loot-design/src/svg/Subtract.web.js | 1 + packages/loot-design/src/svg/merge.web.js | 1 + packages/loot-design/src/svg/split.web.js | 1 + .../src/svg/v1/AnimatedLoading.mobile.js | 3 +- .../src/svg/v1/AnimatedLoading.web.js | 4 +- yarn.lock | 312 +++++++++++++++--- 295 files changed, 874 insertions(+), 196 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index f0ee86d..46cbd36 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,10 +1,35 @@ module.exports = { - plugins: ['prettier'], + plugins: ['prettier', 'import'], extends: ['react-app'], rules: { 'prettier/prettier': 'error', 'no-unused-vars': 'off', 'no-loop-func': 'off', - 'no-restricted-globals': 'off' + 'no-restricted-globals': 'off', + + 'import/no-useless-path-segments': 'error', + 'import/order': [ + 'error', + { + groups: [ + 'builtin', // Built-in types are first + 'external', + ['sibling', 'parent'], // Then sibling and parent types. They can be mingled together + 'index' // Then the index file + ], + 'newlines-between': 'always', + pathGroups: [ + // Enforce that React (and react-related packages) is the first import + { group: 'builtin', pattern: 'react?(-*)', position: 'before' }, + // Separate imports from Actual from "real" external imports + { + group: 'external', + pattern: 'loot-{core,design}/**/*', + position: 'after' + } + ], + pathGroupsExcludedImportTypes: ['react'] + } + ] } }; diff --git a/packages/desktop-client/package.json b/packages/desktop-client/package.json index cd8c29b..b5cfe67 100644 --- a/packages/desktop-client/package.json +++ b/packages/desktop-client/package.json @@ -32,7 +32,7 @@ "eslint-config-react-app": "3.0.5", "eslint-loader": "2.1.1", "eslint-plugin-flowtype": "2.50.1", - "eslint-plugin-import": "2.14.0", + "eslint-plugin-import": "^2.26.0", "eslint-plugin-jsx-a11y": "6.1.2", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "7.11.1", diff --git a/packages/desktop-client/src/components/AnimatedRefresh.js b/packages/desktop-client/src/components/AnimatedRefresh.js index 4318fea..175529f 100644 --- a/packages/desktop-client/src/components/AnimatedRefresh.js +++ b/packages/desktop-client/src/components/AnimatedRefresh.js @@ -1,5 +1,7 @@ import React from 'react'; + import { css } from 'glamor'; + import { View } from 'loot-design/src/components/common'; import Refresh from 'loot-design/src/svg/v1/Refresh'; diff --git a/packages/desktop-client/src/components/App.js b/packages/desktop-client/src/components/App.js index 2280386..1f4d8f8 100644 --- a/packages/desktop-client/src/components/App.js +++ b/packages/desktop-client/src/components/App.js @@ -1,12 +1,15 @@ import React from 'react'; import { connect } from 'react-redux'; + import { css } from 'glamor'; + import * as actions from 'loot-core/src/client/actions'; import { init as initConnection, send } from 'loot-core/src/platform/client/fetch'; import { styles, hasHiddenScrollbars } from 'loot-design/src/style'; + import installPolyfills from '../polyfills'; import FatalError from './FatalError'; import ManagementApp from './manager/ManagementApp'; diff --git a/packages/desktop-client/src/components/AppBackground.js b/packages/desktop-client/src/components/AppBackground.js index f01ff69..c617e4f 100644 --- a/packages/desktop-client/src/components/AppBackground.js +++ b/packages/desktop-client/src/components/AppBackground.js @@ -1,8 +1,11 @@ import React from 'react'; -import { View, Block } from 'loot-design/src/components/common'; + import { css } from 'glamor'; + +import { View, Block } from 'loot-design/src/components/common'; import AnimatedLoading from 'loot-design/src/svg/v1/AnimatedLoading'; import { colors } from 'loot-design/src/style'; + import Background from './Background'; function AppBackground({ initializing, loadingText }) { diff --git a/packages/desktop-client/src/components/Background.js b/packages/desktop-client/src/components/Background.js index fe39d02..7d337ad 100644 --- a/packages/desktop-client/src/components/Background.js +++ b/packages/desktop-client/src/components/Background.js @@ -1,4 +1,5 @@ import React from 'react'; + import { css } from 'glamor'; import BG from './manager/bg.svg'; diff --git a/packages/desktop-client/src/components/BankSyncStatus.js b/packages/desktop-client/src/components/BankSyncStatus.js index dddc3fc..1387516 100644 --- a/packages/desktop-client/src/components/BankSyncStatus.js +++ b/packages/desktop-client/src/components/BankSyncStatus.js @@ -1,9 +1,11 @@ import React from 'react'; import { connect } from 'react-redux'; import { useTransition, animated } from 'react-spring'; + import * as actions from 'loot-core/src/client/actions'; import { View, Text } from 'loot-design/src/components/common'; import { colors, styles } from 'loot-design/src/style'; + import AnimatedRefresh from './AnimatedRefresh'; function BankSyncStatus({ accountsSyncing }) { diff --git a/packages/desktop-client/src/components/Debugger.js b/packages/desktop-client/src/components/Debugger.js index 770ab6b..eb37911 100644 --- a/packages/desktop-client/src/components/Debugger.js +++ b/packages/desktop-client/src/components/Debugger.js @@ -1,10 +1,12 @@ import React from 'react'; + +import CodeMirror from 'codemirror'; + import { send, init as initConnection } from 'loot-core/src/platform/client/fetch'; import * as spreadsheet from 'loot-core/src/client/sheetql/spreadsheet'; -import CodeMirror from 'codemirror'; import { View, Button, diff --git a/packages/desktop-client/src/components/FatalError.js b/packages/desktop-client/src/components/FatalError.js index 48dd267..6666c86 100644 --- a/packages/desktop-client/src/components/FatalError.js +++ b/packages/desktop-client/src/components/FatalError.js @@ -1,4 +1,5 @@ import React from 'react'; + import { View, Stack, diff --git a/packages/desktop-client/src/components/FinancesApp.js b/packages/desktop-client/src/components/FinancesApp.js index f28507d..04cd497 100644 --- a/packages/desktop-client/src/components/FinancesApp.js +++ b/packages/desktop-client/src/components/FinancesApp.js @@ -1,10 +1,12 @@ import React, { useMemo } from 'react'; import { Router, Route, Redirect, Switch, useLocation } from 'react-router-dom'; -import { createBrowserHistory } from 'history'; import { connect } from 'react-redux'; import { DndProvider } from 'react-dnd'; import Backend from 'react-dnd-html5-backend'; + +import { createBrowserHistory } from 'history'; import hotkeys from 'hotkeys-js'; + import * as actions from 'loot-core/src/client/actions'; import { SpreadsheetProvider } from 'loot-core/src/client/SpreadsheetProvider'; import checkForUpgradeNotifications from 'loot-core/src/client/upgrade-notifications'; @@ -14,12 +16,12 @@ import { BudgetMonthCountProvider } from 'loot-design/src/components/budget/Budg import * as undo from 'loot-core/src/platform/client/undo'; import { PayeesProvider } from 'loot-core/src/client/data-hooks/payees'; import { AccountsProvider } from 'loot-core/src/client/data-hooks/accounts'; + import { getLocationState } from '../util/location-state'; import { makeLocationState } from '../util/location-state'; import { PageTypeProvider } from './Page'; import { ActiveLocationProvider } from './ActiveLocation'; import BankSyncStatus from './BankSyncStatus'; - import Titlebar, { TitlebarProvider } from './Titlebar'; import FloatableSidebar, { SidebarProvider } from './FloatableSidebar'; import Account from './accounts/Account'; diff --git a/packages/desktop-client/src/components/FloatableSidebar.js b/packages/desktop-client/src/components/FloatableSidebar.js index 3d676f2..a272c61 100644 --- a/packages/desktop-client/src/components/FloatableSidebar.js +++ b/packages/desktop-client/src/components/FloatableSidebar.js @@ -1,7 +1,9 @@ import React, { useState, useEffect, useContext } from 'react'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; + import mitt from 'mitt'; + import * as actions from 'loot-core/src/client/actions'; import { View } from 'loot-design/src/components/common'; import { SIDEBAR_WIDTH } from 'loot-design/src/components/sidebar'; diff --git a/packages/desktop-client/src/components/GlobalKeys.js b/packages/desktop-client/src/components/GlobalKeys.js index 08d3ad8..0b38966 100644 --- a/packages/desktop-client/src/components/GlobalKeys.js +++ b/packages/desktop-client/src/components/GlobalKeys.js @@ -1,5 +1,6 @@ import React from 'react'; import { withRouter } from 'react-router-dom'; + import Platform from 'loot-core/src/client/platform'; class GlobalKeys extends React.Component { diff --git a/packages/desktop-client/src/components/LoggedInUser.js b/packages/desktop-client/src/components/LoggedInUser.js index 46d472f..c02a23c 100644 --- a/packages/desktop-client/src/components/LoggedInUser.js +++ b/packages/desktop-client/src/components/LoggedInUser.js @@ -1,6 +1,7 @@ import React, { useState, useEffect } from 'react'; import { connect } from 'react-redux'; import { withRouter } from 'react-router'; + import * as actions from 'loot-core/src/client/actions'; import { View, diff --git a/packages/desktop-client/src/components/MobileWebMessage.js b/packages/desktop-client/src/components/MobileWebMessage.js index ad0666a..cca240e 100644 --- a/packages/desktop-client/src/components/MobileWebMessage.js +++ b/packages/desktop-client/src/components/MobileWebMessage.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; + import { View, Text, diff --git a/packages/desktop-client/src/components/Modals.js b/packages/desktop-client/src/components/Modals.js index 5e756bb..ee19f3a 100644 --- a/packages/desktop-client/src/components/Modals.js +++ b/packages/desktop-client/src/components/Modals.js @@ -1,12 +1,13 @@ import React from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { Route, Switch } from 'react-router-dom'; + +import { bindActionCreators } from 'redux'; import { createLocation } from 'history'; import Component from '@reactions/component'; + import * as actions from 'loot-core/src/client/actions'; import { send, listen, unlisten } from 'loot-core/src/platform/client/fetch'; - import CreateLocalAccount from 'loot-design/src/components/modals/CreateLocalAccount'; import CloseAccount from 'loot-design/src/components/modals/CloseAccount'; import SelectLinkedAccounts from 'loot-design/src/components/modals/SelectLinkedAccounts'; @@ -15,6 +16,7 @@ import LoadBackup from 'loot-design/src/components/modals/LoadBackup'; import PlaidExternalMsg from 'loot-design/src/components/modals/PlaidExternalMsg'; import ImportTransactions from 'loot-design/src/components/modals/ImportTransactions'; import EditField from 'loot-design/src/components/modals/EditField'; + import CreateAccount from './modals/CreateAccount'; import ManagePayeesWithData from './payees/ManagePayeesWithData'; import ManageRules from './modals/ManageRules'; diff --git a/packages/desktop-client/src/components/Notifications.js b/packages/desktop-client/src/components/Notifications.js index ff03df4..3875c49 100644 --- a/packages/desktop-client/src/components/Notifications.js +++ b/packages/desktop-client/src/components/Notifications.js @@ -1,6 +1,8 @@ import React, { useState, useEffect, useMemo } from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; + import * as actions from 'loot-core/src/client/actions'; import { View, diff --git a/packages/desktop-client/src/components/Page.js b/packages/desktop-client/src/components/Page.js index 757993d..f18332d 100644 --- a/packages/desktop-client/src/components/Page.js +++ b/packages/desktop-client/src/components/Page.js @@ -1,5 +1,6 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; + import { Modal, View, Text } from 'loot-design/src/components/common'; import { styles } from 'loot-design/src/style'; diff --git a/packages/desktop-client/src/components/Settings.js b/packages/desktop-client/src/components/Settings.js index e9c9a68..f2cb991 100644 --- a/packages/desktop-client/src/components/Settings.js +++ b/packages/desktop-client/src/components/Settings.js @@ -1,7 +1,9 @@ import React, { useState, useEffect, useRef } from 'react'; import { connect } from 'react-redux'; -import { css } from 'glamor'; import { Route, Switch, Redirect } from 'react-router-dom'; + +import { css } from 'glamor'; + import * as actions from 'loot-core/src/client/actions'; import { View, diff --git a/packages/desktop-client/src/components/SidebarWithData.js b/packages/desktop-client/src/components/SidebarWithData.js index eeaa5e2..1943bbb 100644 --- a/packages/desktop-client/src/components/SidebarWithData.js +++ b/packages/desktop-client/src/components/SidebarWithData.js @@ -1,7 +1,9 @@ import React, { useState, useEffect } from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; + +import { bindActionCreators } from 'redux'; + import { send } from 'loot-core/src/platform/client/fetch'; import { styles, colors } from 'loot-design/src/style'; import { diff --git a/packages/desktop-client/src/components/SpreadsheetInterface.js b/packages/desktop-client/src/components/SpreadsheetInterface.js index 856ddc6..4066530 100644 --- a/packages/desktop-client/src/components/SpreadsheetInterface.js +++ b/packages/desktop-client/src/components/SpreadsheetInterface.js @@ -1,4 +1,5 @@ import React from 'react'; + import Cell from 'loot-design/src/components/spreadsheet/Cell'; import { View } from 'loot-design/src/components/common'; diff --git a/packages/desktop-client/src/components/Titlebar.js b/packages/desktop-client/src/components/Titlebar.js index b96d5a9..dcbdd8f 100644 --- a/packages/desktop-client/src/components/Titlebar.js +++ b/packages/desktop-client/src/components/Titlebar.js @@ -1,6 +1,7 @@ import React, { useState, useEffect, useRef, useContext } from 'react'; import { Switch, Route, withRouter } from 'react-router-dom'; import { connect } from 'react-redux'; + import * as actions from 'loot-core/src/client/actions'; import * as queries from 'loot-core/src/client/queries'; import { listen } from 'loot-core/src/platform/client/fetch'; @@ -20,6 +21,7 @@ import ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1'; import NavigationMenu from 'loot-design/src/svg/v2/NavigationMenu'; import ArrowLeft from 'loot-design/src/svg/v1/ArrowLeft'; import AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle'; + import { MonthCountSelector } from './budget/MonthCountSelector'; import AccountSyncCheck from './accounts/AccountSyncCheck'; import LoggedInUser from './LoggedInUser'; diff --git a/packages/desktop-client/src/components/Tutorial.js b/packages/desktop-client/src/components/Tutorial.js index aeaa4e3..3cbe6e9 100644 --- a/packages/desktop-client/src/components/Tutorial.js +++ b/packages/desktop-client/src/components/Tutorial.js @@ -1,9 +1,12 @@ import React from 'react'; import ReactDOM from 'react-dom'; +import { connect } from 'react-redux'; + import PropTypes from 'prop-types'; import { bindActionCreators } from 'redux'; -import { connect } from 'react-redux'; + import * as actions from 'loot-core/src/client/actions'; + import Intro from './tutorial/Intro'; import BudgetSummary from './tutorial/BudgetSummary'; import BudgetCategories from './tutorial/BudgetCategories'; diff --git a/packages/desktop-client/src/components/TutorialPoints.js b/packages/desktop-client/src/components/TutorialPoints.js index 91ed03a..f7027e1 100644 --- a/packages/desktop-client/src/components/TutorialPoints.js +++ b/packages/desktop-client/src/components/TutorialPoints.js @@ -1,5 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; + import PropTypes from 'prop-types'; class Tutorial extends React.Component { diff --git a/packages/desktop-client/src/components/UpdateNotification.js b/packages/desktop-client/src/components/UpdateNotification.js index a2af5e8..5804946 100644 --- a/packages/desktop-client/src/components/UpdateNotification.js +++ b/packages/desktop-client/src/components/UpdateNotification.js @@ -1,6 +1,8 @@ import React from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; + import * as actions from 'loot-core/src/client/actions'; import { View, Text, Link, Button } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; diff --git a/packages/desktop-client/src/components/accounts/Account.js b/packages/desktop-client/src/components/accounts/Account.js index 9702010..636f557 100644 --- a/packages/desktop-client/src/components/accounts/Account.js +++ b/packages/desktop-client/src/components/accounts/Account.js @@ -1,8 +1,10 @@ import React, { useState, useEffect, useRef, useMemo } from 'react'; -import { bindActionCreators } from 'redux'; import { useSelector, useDispatch } from 'react-redux'; import { Redirect, useParams, useHistory, useLocation } from 'react-router-dom'; + +import { bindActionCreators } from 'redux'; import { debounce } from 'debounce'; + import { send, listen } from 'loot-core/src/platform/client/fetch'; import * as actions from 'loot-core/src/client/actions'; import { @@ -52,6 +54,7 @@ import { SchedulesProvider, useCachedSchedules } from 'loot-core/src/client/data-hooks/schedules'; + import { authorizeBank } from '../../plaid'; import AnimatedRefresh from '../AnimatedRefresh'; import { useActiveLocation } from '../ActiveLocation'; diff --git a/packages/desktop-client/src/components/accounts/AccountSyncCheck.js b/packages/desktop-client/src/components/accounts/AccountSyncCheck.js index d32311e..c6e6955 100644 --- a/packages/desktop-client/src/components/accounts/AccountSyncCheck.js +++ b/packages/desktop-client/src/components/accounts/AccountSyncCheck.js @@ -1,9 +1,11 @@ import React, { useState } from 'react'; import { connect } from 'react-redux'; + import * as actions from 'loot-core/src/client/actions'; import { View, Button, Tooltip } from 'loot-design/src/components/common'; import ExclamationOutline from 'loot-design/src/svg/v1/ExclamationOutline'; import { colors } from 'loot-design/src/style'; + import { reauthorizeBank } from '../../plaid'; function getErrorMessage(type, code) { diff --git a/packages/desktop-client/src/components/accounts/Filters.js b/packages/desktop-client/src/components/accounts/Filters.js index e39a9cd..495bfe7 100644 --- a/packages/desktop-client/src/components/accounts/Filters.js +++ b/packages/desktop-client/src/components/accounts/Filters.js @@ -1,11 +1,13 @@ import React, { useState, useRef, useEffect, useReducer } from 'react'; import { useSelector } from 'react-redux'; + import scopeTab from 'react-modal/lib/helpers/scopeTab'; import { parse as parseDate, format as formatDate, isValid as isDateValid } from 'date-fns'; + import { send } from 'loot-core/src/platform/client/fetch'; import { getMonthYearFormat } from 'loot-core/src/shared/months'; import { titleFirst } from 'loot-core/src/shared/util'; @@ -31,6 +33,7 @@ import { import DeleteIcon from 'loot-design/src/svg/Delete'; import SettingsSliderAlternate from 'loot-design/src/svg/v2/SettingsSliderAlternate'; import { colors } from 'loot-design/src/style'; + import GenericInput from '../util/GenericInput'; import { Value } from '../modals/ManageRules'; diff --git a/packages/desktop-client/src/components/accounts/SimpleTransactionsTable.js b/packages/desktop-client/src/components/accounts/SimpleTransactionsTable.js index ea84192..1db3fa0 100644 --- a/packages/desktop-client/src/components/accounts/SimpleTransactionsTable.js +++ b/packages/desktop-client/src/components/accounts/SimpleTransactionsTable.js @@ -1,10 +1,12 @@ import React, { useMemo, useCallback } from 'react'; import { useSelector } from 'react-redux'; + import { format as formatDate, parseISO, isValid as isDateValid } from 'date-fns'; + import { Table, Row, @@ -23,6 +25,7 @@ import { } from 'loot-core/src/client/reducers/queries'; import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize'; import { styles } from 'loot-design/src/style'; + import DisplayId from '../util/DisplayId'; function serializeTransaction(transaction, dateFormat) { diff --git a/packages/desktop-client/src/components/accounts/TransactionList.js b/packages/desktop-client/src/components/accounts/TransactionList.js index a07c31f..7ea870d 100644 --- a/packages/desktop-client/src/components/accounts/TransactionList.js +++ b/packages/desktop-client/src/components/accounts/TransactionList.js @@ -1,5 +1,6 @@ import React, { useRef, useEffect, useCallback, useLayoutEffect } from 'react'; import { useDispatch } from 'react-redux'; + import { splitTransaction, updateTransaction, @@ -9,7 +10,9 @@ import { } from 'loot-core/src/shared/transactions'; import { send } from 'loot-core/src/platform/client/fetch'; import { getChangedValues, applyChanges } from 'loot-core/src/shared/util'; + import { TransactionTable } from './TransactionsTable'; + const uuid = require('loot-core/src/platform/uuid'); // When data changes, there are two ways to update the UI: diff --git a/packages/desktop-client/src/components/accounts/TransactionsTable.js b/packages/desktop-client/src/components/accounts/TransactionsTable.js index 3ba3d9d..0fd3469 100644 --- a/packages/desktop-client/src/components/accounts/TransactionsTable.js +++ b/packages/desktop-client/src/components/accounts/TransactionsTable.js @@ -9,11 +9,13 @@ import React, { useReducer } from 'react'; import { useSelector, useDispatch } from 'react-redux'; + import { format as formatDate, parseISO, isValid as isDateValid } from 'date-fns'; + import { View, Text, Tooltip, Button } from 'loot-design/src/components/common'; import CategoryAutocomplete from 'loot-design/src/components/CategorySelect'; import PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete'; @@ -63,6 +65,7 @@ import { import { useMergedRefs } from 'loot-design/src/components/useMergedRefs'; import { useCachedSchedules } from 'loot-core/src/client/data-hooks/schedules'; import { getScheduledAmount } from 'loot-core/src/shared/schedules'; + import { getStatusProps } from '../schedules/StatusBadge'; let TABLE_BACKGROUND_COLOR = colors.n11; diff --git a/packages/desktop-client/src/components/accounts/TransactionsTable.test.js b/packages/desktop-client/src/components/accounts/TransactionsTable.test.js index eb4a9f3..f3f5519 100644 --- a/packages/desktop-client/src/components/accounts/TransactionsTable.test.js +++ b/packages/desktop-client/src/components/accounts/TransactionsTable.test.js @@ -1,7 +1,9 @@ import React from 'react'; + import { act } from 'react-dom/test-utils'; import { render, fireEvent } from '@testing-library/react'; import { format as formatDate, parse as parseDate } from 'date-fns'; + import { integerToCurrency } from 'loot-core/src/shared/util'; import { initServer } from 'loot-core/src/platform/client/fetch'; import { @@ -17,7 +19,9 @@ import { updateTransaction } from 'loot-core/src/shared'; import { SelectedProviderWithItems } from 'loot-design/src/components'; + import { SplitsExpandedProvider, TransactionTable } from './TransactionsTable'; + const uuid = require('loot-core/src/platform/uuid'); const accounts = [generateAccount('Bank of America')]; diff --git a/packages/desktop-client/src/components/budget/MonthCountSelector.js b/packages/desktop-client/src/components/budget/MonthCountSelector.js index ce90820..b11b28b 100644 --- a/packages/desktop-client/src/components/budget/MonthCountSelector.js +++ b/packages/desktop-client/src/components/budget/MonthCountSelector.js @@ -1,4 +1,5 @@ import React from 'react'; + import { colors } from 'loot-design/src/style'; import { View } from 'loot-design/src/components/common'; import { useBudgetMonthCount } from 'loot-design/src/components/budget/BudgetMonthCountContext'; diff --git a/packages/desktop-client/src/components/budget/index.js b/packages/desktop-client/src/components/budget/index.js index b1d862d..a063fe8 100644 --- a/packages/desktop-client/src/components/budget/index.js +++ b/packages/desktop-client/src/components/budget/index.js @@ -1,16 +1,14 @@ import React, { useContext, useMemo } from 'react'; import { connect } from 'react-redux'; + import * as actions from 'loot-core/src/client/actions'; import { send, listen } from 'loot-core/src/platform/client/fetch'; import * as monthUtils from 'loot-core/src/shared/months'; import { getValidMonthBounds } from 'loot-design/src/components/budget/MonthsContext'; - import * as rollover from 'loot-design/src/components/budget/rollover/rollover-components'; import { RolloverContext } from 'loot-design/src/components/budget/rollover/RolloverContext'; - import * as report from 'loot-design/src/components/budget/report/components'; import { ReportProvider } from 'loot-design/src/components/budget/report/ReportContext'; - import DynamicBudgetTable from 'loot-design/src/components/budget/DynamicBudgetTable'; import SpreadsheetContext from 'loot-design/src/components/spreadsheet/SpreadsheetContext'; import { View } from 'loot-design/src/components/common'; @@ -25,6 +23,7 @@ import { updateGroup, deleteGroup } from 'loot-core/src/shared/categories.js'; + import { TitlebarContext } from '../Titlebar'; let _initialBudgetMonth = null; diff --git a/packages/desktop-client/src/components/debug/index.js b/packages/desktop-client/src/components/debug/index.js index f7419d8..9270c49 100644 --- a/packages/desktop-client/src/components/debug/index.js +++ b/packages/desktop-client/src/components/debug/index.js @@ -1,5 +1,7 @@ import React from 'react'; + import styled from 'styled-components'; + import { send } from 'loot-core/src/platform/client/fetch'; const Container = styled.div` diff --git a/packages/desktop-client/src/components/manager/ConfigServer.js b/packages/desktop-client/src/components/manager/ConfigServer.js index b9380b0..81ca32e 100644 --- a/packages/desktop-client/src/components/manager/ConfigServer.js +++ b/packages/desktop-client/src/components/manager/ConfigServer.js @@ -1,6 +1,7 @@ import React, { useState, useEffect } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; + import { View, Text, @@ -10,6 +11,7 @@ import { import { colors } from 'loot-design/src/style'; import { signOut, loggedIn } from 'loot-core/src/client/actions/user'; import { send } from 'loot-core/src/platform/client/fetch'; + import { Title, Input } from './subscribe/common'; export default function ConfigServer() { diff --git a/packages/desktop-client/src/components/manager/ManagementApp.js b/packages/desktop-client/src/components/manager/ManagementApp.js index 7d574c7..4bb4b1a 100644 --- a/packages/desktop-client/src/components/manager/ManagementApp.js +++ b/packages/desktop-client/src/components/manager/ManagementApp.js @@ -1,15 +1,17 @@ import React from 'react'; import { connect } from 'react-redux'; -import { createBrowserHistory } from 'history'; import { Switch, Redirect, Router, Route } from 'react-router-dom'; + +import { createBrowserHistory } from 'history'; + import * as actions from 'loot-core/src/client/actions'; import { View, Text } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; + import LoggedInUser from '../LoggedInUser'; import Notifications from '../Notifications'; import useServerVersion from '../../hooks/useServerVersion'; import ServerURL from './ServerURL'; - import Modals from './Modals'; import Login from './subscribe/Login'; import Bootstrap from './subscribe/Bootstrap'; diff --git a/packages/desktop-client/src/components/manager/Modals.js b/packages/desktop-client/src/components/manager/Modals.js index e45b1ec..6fa892a 100644 --- a/packages/desktop-client/src/components/manager/Modals.js +++ b/packages/desktop-client/src/components/manager/Modals.js @@ -1,7 +1,9 @@ import React from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; import Component from '@reactions/component'; + import { send } from 'loot-core/src/platform/client/fetch'; import * as actions from 'loot-core/src/client/actions'; import { View } from 'loot-design/src/components/common'; @@ -12,6 +14,7 @@ import ImportYNAB4 from 'loot-design/src/components/manager/ImportYNAB4'; import ImportYNAB5 from 'loot-design/src/components/manager/ImportYNAB5'; import ImportActual from 'loot-design/src/components/manager/ImportActual'; import DeleteFile from 'loot-design/src/components/manager/DeleteFile'; + import CreateEncryptionKey from '../modals/CreateEncryptionKey'; import FixEncryptionKey from '../modals/FixEncryptionKey'; diff --git a/packages/desktop-client/src/components/manager/ServerURL.js b/packages/desktop-client/src/components/manager/ServerURL.js index c1ba72f..ef3f6f0 100644 --- a/packages/desktop-client/src/components/manager/ServerURL.js +++ b/packages/desktop-client/src/components/manager/ServerURL.js @@ -1,4 +1,5 @@ import React, { useState, useEffect } from 'react'; + import { View, Text, AnchorLink } from 'loot-design/src/components/common'; import { send } from 'loot-core/src/platform/client/fetch'; diff --git a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.js b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.js index 534c90c..7824a3f 100644 --- a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.js +++ b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.js @@ -1,11 +1,13 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; + import { View, Text, Button } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; import { loggedIn } from 'loot-core/src/client/actions/user'; import { createBudget } from 'loot-core/src/client/actions/budgets'; import { send } from 'loot-core/src/platform/client/fetch'; + import { ConfirmPasswordForm } from './ConfirmPasswordForm'; import { useBootstrapped, Title } from './common'; diff --git a/packages/desktop-client/src/components/manager/subscribe/ChangePassword.js b/packages/desktop-client/src/components/manager/subscribe/ChangePassword.js index 60daf23..b77834a 100644 --- a/packages/desktop-client/src/components/manager/subscribe/ChangePassword.js +++ b/packages/desktop-client/src/components/manager/subscribe/ChangePassword.js @@ -1,9 +1,11 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; + import { View, Text, Button } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; import { send } from 'loot-core/src/platform/client/fetch'; + import { ConfirmPasswordForm } from './ConfirmPasswordForm'; import { Title } from './common'; diff --git a/packages/desktop-client/src/components/manager/subscribe/ConfirmPasswordForm.js b/packages/desktop-client/src/components/manager/subscribe/ConfirmPasswordForm.js index c71f7a5..52453cd 100644 --- a/packages/desktop-client/src/components/manager/subscribe/ConfirmPasswordForm.js +++ b/packages/desktop-client/src/components/manager/subscribe/ConfirmPasswordForm.js @@ -1,5 +1,7 @@ import React, { useState } from 'react'; + import { View, ButtonWithLoading } from 'loot-design/src/components/common'; + import { Input } from './common'; export function ConfirmPasswordForm({ buttons, onSetPassword, onError }) { diff --git a/packages/desktop-client/src/components/manager/subscribe/Error.js b/packages/desktop-client/src/components/manager/subscribe/Error.js index 8de45a9..82903b1 100644 --- a/packages/desktop-client/src/components/manager/subscribe/Error.js +++ b/packages/desktop-client/src/components/manager/subscribe/Error.js @@ -1,5 +1,6 @@ import React from 'react'; import { useHistory, useLocation } from 'react-router-dom'; + import { View, Text, Button } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; diff --git a/packages/desktop-client/src/components/manager/subscribe/Login.js b/packages/desktop-client/src/components/manager/subscribe/Login.js index 76befa8..0844a46 100644 --- a/packages/desktop-client/src/components/manager/subscribe/Login.js +++ b/packages/desktop-client/src/components/manager/subscribe/Login.js @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; + import { View, Text, @@ -11,6 +12,7 @@ import { colors } from 'loot-design/src/style'; import { loggedIn } from 'loot-core/src/client/actions/user'; import { createBudget } from 'loot-core/src/client/actions/budgets'; import { send } from 'loot-core/src/platform/client/fetch'; + import { useBootstrapped, Title, Input } from './common'; export default function Login() { diff --git a/packages/desktop-client/src/components/manager/subscribe/common.js b/packages/desktop-client/src/components/manager/subscribe/common.js index 4c5a25c..2d0778f 100644 --- a/packages/desktop-client/src/components/manager/subscribe/common.js +++ b/packages/desktop-client/src/components/manager/subscribe/common.js @@ -1,5 +1,6 @@ import React, { useEffect, useState } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; + import { Text, Button, diff --git a/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js b/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js index dd315a8..74af79b 100644 --- a/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js +++ b/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js @@ -1,4 +1,5 @@ import React from 'react'; + import { View, Text, diff --git a/packages/desktop-client/src/components/modals/CreateAccount.js b/packages/desktop-client/src/components/modals/CreateAccount.js index 1930d2f..c81e295 100644 --- a/packages/desktop-client/src/components/modals/CreateAccount.js +++ b/packages/desktop-client/src/components/modals/CreateAccount.js @@ -1,9 +1,12 @@ import React from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; + import * as actions from 'loot-core/src/client/actions'; import { View, Text, Modal, Button } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; + import { authorizeBank } from '../../plaid'; class CreateAccount extends React.Component { diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKey.js b/packages/desktop-client/src/components/modals/CreateEncryptionKey.js index c26de87..ff5ad00 100644 --- a/packages/desktop-client/src/components/modals/CreateEncryptionKey.js +++ b/packages/desktop-client/src/components/modals/CreateEncryptionKey.js @@ -1,5 +1,7 @@ import React, { useState } from 'react'; + import { css } from 'glamor'; + import { View, Text, diff --git a/packages/desktop-client/src/components/modals/EditRule.js b/packages/desktop-client/src/components/modals/EditRule.js index c55c2c3..9d33ca0 100644 --- a/packages/desktop-client/src/components/modals/EditRule.js +++ b/packages/desktop-client/src/components/modals/EditRule.js @@ -1,5 +1,6 @@ import React, { useState, useEffect, useRef, useCallback } from 'react'; import { useDispatch, useSelector } from 'react-redux'; + import { initiallyLoadPayees, setUndoEnabled @@ -39,6 +40,7 @@ import { amountToInteger } from 'loot-core/src/shared/util'; import * as monthUtils from 'loot-core/src/shared/months'; + import SimpleTransactionsTable from '../accounts/SimpleTransactionsTable'; import { StatusBadge } from '../schedules/StatusBadge'; import DisplayId from '../util/DisplayId'; diff --git a/packages/desktop-client/src/components/modals/FixEncryptionKey.js b/packages/desktop-client/src/components/modals/FixEncryptionKey.js index c9c43ca..b196ee4 100644 --- a/packages/desktop-client/src/components/modals/FixEncryptionKey.js +++ b/packages/desktop-client/src/components/modals/FixEncryptionKey.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; + import { View, Text, diff --git a/packages/desktop-client/src/components/modals/ManageRules.js b/packages/desktop-client/src/components/modals/ManageRules.js index 61f89bb..3fdd12c 100644 --- a/packages/desktop-client/src/components/modals/ManageRules.js +++ b/packages/desktop-client/src/components/modals/ManageRules.js @@ -1,7 +1,9 @@ import React, { useState, useEffect, useRef, useCallback } from 'react'; import { useDispatch, useSelector } from 'react-redux'; + import { css } from 'glamor'; import { format as formatDate, parseISO } from 'date-fns'; + import * as undo from 'loot-core/src/platform/client/undo'; import { initiallyLoadPayees } from 'loot-core/src/client/actions/queries'; import q from 'loot-core/src/client/query-helpers'; diff --git a/packages/desktop-client/src/components/modals/MergeUnusedPayees.js b/packages/desktop-client/src/components/modals/MergeUnusedPayees.js index 58920d0..0f705e9 100644 --- a/packages/desktop-client/src/components/modals/MergeUnusedPayees.js +++ b/packages/desktop-client/src/components/modals/MergeUnusedPayees.js @@ -1,5 +1,6 @@ import React, { useState, useRef, useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; + import { View, Text, diff --git a/packages/desktop-client/src/components/modals/WelcomeScreen.js b/packages/desktop-client/src/components/modals/WelcomeScreen.js index 8cab2fe..b627230 100644 --- a/packages/desktop-client/src/components/modals/WelcomeScreen.js +++ b/packages/desktop-client/src/components/modals/WelcomeScreen.js @@ -1,5 +1,6 @@ import React from 'react'; import { connect } from 'react-redux'; + import * as actions from 'loot-core/src/client/actions'; import { View, diff --git a/packages/desktop-client/src/components/payees/ManagePayeesWithData.js b/packages/desktop-client/src/components/payees/ManagePayeesWithData.js index c80927f..89be6a2 100644 --- a/packages/desktop-client/src/components/payees/ManagePayeesWithData.js +++ b/packages/desktop-client/src/components/payees/ManagePayeesWithData.js @@ -1,5 +1,6 @@ import React, { useState, useEffect, useRef } from 'react'; import { connect } from 'react-redux'; + import * as actions from 'loot-core/src/client/actions'; import * as undo from 'loot-core/src/platform/client/undo'; import { send, listen } from 'loot-core/src/platform/client/fetch'; diff --git a/packages/desktop-client/src/components/reports/CashFlow.js b/packages/desktop-client/src/components/reports/CashFlow.js index 45b3ee4..a970144 100644 --- a/packages/desktop-client/src/components/reports/CashFlow.js +++ b/packages/desktop-client/src/components/reports/CashFlow.js @@ -1,5 +1,7 @@ import React, { useState, useEffect } from 'react'; + import * as d from 'date-fns'; + import { View, Text, @@ -12,6 +14,7 @@ import { send } from 'loot-core/src/platform/client/fetch'; import * as monthUtils from 'loot-core/src/shared/months'; import { integerToCurrency } from 'loot-core/src/shared/util'; import { colors } from 'loot-design/src/style'; + import Header from './Header'; import Change from './Change'; import CashFlowGraph from './graphs/CashFlowGraph'; diff --git a/packages/desktop-client/src/components/reports/Change.js b/packages/desktop-client/src/components/reports/Change.js index 61e9a37..cbdfc0f 100644 --- a/packages/desktop-client/src/components/reports/Change.js +++ b/packages/desktop-client/src/components/reports/Change.js @@ -1,4 +1,5 @@ import React from 'react'; + import { styles } from 'loot-design/src/style'; import { integerToCurrency } from 'loot-core/src/shared/util'; import { Block } from 'loot-design/src/components/common'; diff --git a/packages/desktop-client/src/components/reports/Container.js b/packages/desktop-client/src/components/reports/Container.js index 0c53f5d..5542081 100644 --- a/packages/desktop-client/src/components/reports/Container.js +++ b/packages/desktop-client/src/components/reports/Container.js @@ -1,7 +1,8 @@ import React from 'react'; -import { View } from 'loot-design/src/components/common'; import AutoSizer from 'react-virtualized-auto-sizer'; +import { View } from 'loot-design/src/components/common'; + class Container extends React.Component { render() { const { style, children } = this.props; diff --git a/packages/desktop-client/src/components/reports/DateRange.js b/packages/desktop-client/src/components/reports/DateRange.js index 33719b4..0a98466 100644 --- a/packages/desktop-client/src/components/reports/DateRange.js +++ b/packages/desktop-client/src/components/reports/DateRange.js @@ -1,5 +1,7 @@ import React from 'react'; + import * as d from 'date-fns'; + import { colors } from 'loot-design/src/style'; import { Block } from 'loot-design/src/components/common'; diff --git a/packages/desktop-client/src/components/reports/Header.js b/packages/desktop-client/src/components/reports/Header.js index a73c9e8..546f7c4 100644 --- a/packages/desktop-client/src/components/reports/Header.js +++ b/packages/desktop-client/src/components/reports/Header.js @@ -1,4 +1,5 @@ import React from 'react'; + import { styles } from 'loot-design/src/style'; import { View, diff --git a/packages/desktop-client/src/components/reports/NetWorth.js b/packages/desktop-client/src/components/reports/NetWorth.js index 40e007d..f2ffec7 100644 --- a/packages/desktop-client/src/components/reports/NetWorth.js +++ b/packages/desktop-client/src/components/reports/NetWorth.js @@ -1,13 +1,16 @@ import React, { useState, useEffect } from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; import * as d from 'date-fns'; + import * as actions from 'loot-core/src/client/actions'; import { View, P } from 'loot-design/src/components/common'; import { styles } from 'loot-design/src/style'; import * as monthUtils from 'loot-core/src/shared/months'; import { integerToCurrency } from 'loot-core/src/shared/util'; import { send } from 'loot-core/src/platform/client/fetch'; + import Header from './Header'; import { fromDateRepr } from './util'; import useReport from './useReport'; diff --git a/packages/desktop-client/src/components/reports/Overview.js b/packages/desktop-client/src/components/reports/Overview.js index 2366656..456a52c 100644 --- a/packages/desktop-client/src/components/reports/Overview.js +++ b/packages/desktop-client/src/components/reports/Overview.js @@ -1,12 +1,15 @@ import React from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; import { VictoryBar, VictoryGroup, VictoryVoronoiContainer } from 'victory'; + import * as actions from 'loot-core/src/client/actions'; import { View, Block, AnchorLink } from 'loot-design/src/components/common'; import { colors, styles } from 'loot-design/src/style'; import * as monthUtils from 'loot-core/src/shared/months'; import { integerToCurrency } from 'loot-core/src/shared/util'; + import { useArgsMemo } from './util'; import theme from './chart-theme'; import Container from './Container'; diff --git a/packages/desktop-client/src/components/reports/Tooltip.js b/packages/desktop-client/src/components/reports/Tooltip.js index b2a1654..254b9a2 100644 --- a/packages/desktop-client/src/components/reports/Tooltip.js +++ b/packages/desktop-client/src/components/reports/Tooltip.js @@ -1,7 +1,9 @@ import React from 'react'; import ReactDOM from 'react-dom'; + import { VictoryTooltip } from 'victory'; import { css, before } from 'glamor'; + import { colors } from 'loot-design/src/style'; class Tooltip extends React.Component { diff --git a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.js b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.js index ea050ab..3091921 100644 --- a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.js +++ b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.js @@ -1,4 +1,5 @@ import React from 'react'; + import { VictoryChart, VictoryBar, @@ -8,7 +9,9 @@ import { VictoryGroup } from 'victory'; import * as d from 'date-fns'; + import { colors } from 'loot-design/src/style'; + import Container from '../Container'; import Tooltip from '../Tooltip'; import theme from '../chart-theme'; diff --git a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js index 0a894fd..43502f5 100644 --- a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js +++ b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js @@ -1,4 +1,5 @@ import React from 'react'; + import { VictoryChart, VictoryBar, @@ -8,6 +9,7 @@ import { VictoryGroup } from 'victory'; import * as d from 'date-fns'; + import Container from '../Container'; import Tooltip from '../Tooltip'; import theme from '../chart-theme'; diff --git a/packages/desktop-client/src/components/reports/graphs/cash-flow-spreadsheet.js b/packages/desktop-client/src/components/reports/graphs/cash-flow-spreadsheet.js index e7400fa..a632d81 100644 --- a/packages/desktop-client/src/components/reports/graphs/cash-flow-spreadsheet.js +++ b/packages/desktop-client/src/components/reports/graphs/cash-flow-spreadsheet.js @@ -1,9 +1,12 @@ import React from 'react'; -import * as monthUtils from 'loot-core/src/shared/months'; + import * as d from 'date-fns'; + +import * as monthUtils from 'loot-core/src/shared/months'; import { AlignedText } from 'loot-design/src/components/common'; import { integerToCurrency, integerToAmount } from 'loot-core/src/shared/util'; import q from 'loot-core/src/client/query-helpers'; + import { fromDateRepr, fromDateReprToDay, runAll, index } from '../util'; export function simpleCashFlow(start, end) { diff --git a/packages/desktop-client/src/components/reports/graphs/net-worth-spreadsheet.js b/packages/desktop-client/src/components/reports/graphs/net-worth-spreadsheet.js index 7c09f2b..58135c5 100644 --- a/packages/desktop-client/src/components/reports/graphs/net-worth-spreadsheet.js +++ b/packages/desktop-client/src/components/reports/graphs/net-worth-spreadsheet.js @@ -1,6 +1,8 @@ import React from 'react'; -import * as monthUtils from 'loot-core/src/shared/months'; + import * as d from 'date-fns'; + +import * as monthUtils from 'loot-core/src/shared/months'; import { AlignedText } from 'loot-design/src/components/common'; import q, { runQuery } from 'loot-core/src/client/query-helpers'; import { @@ -8,6 +10,7 @@ import { integerToAmount, amountToInteger } from 'loot-core/src/shared/util'; + import { index } from '../util'; export default function createSpreadsheet(start, end, accounts) { diff --git a/packages/desktop-client/src/components/reports/index.js b/packages/desktop-client/src/components/reports/index.js index b4ff198..07f2f1d 100644 --- a/packages/desktop-client/src/components/reports/index.js +++ b/packages/desktop-client/src/components/reports/index.js @@ -1,6 +1,8 @@ import React from 'react'; import { Route } from 'react-router-dom'; + import { View } from 'loot-design/src/components/common'; + import Overview from './Overview'; import NetWorth from './NetWorth'; import CashFlow from './CashFlow'; diff --git a/packages/desktop-client/src/components/reports/util.js b/packages/desktop-client/src/components/reports/util.js index 5c297ca..078d54d 100644 --- a/packages/desktop-client/src/components/reports/util.js +++ b/packages/desktop-client/src/components/reports/util.js @@ -1,4 +1,5 @@ import { useMemo } from 'react'; + import { runQuery } from 'loot-core/src/client/query-helpers'; export function useArgsMemo(func) { diff --git a/packages/desktop-client/src/components/schedules/DiscoverSchedules.js b/packages/desktop-client/src/components/schedules/DiscoverSchedules.js index ae2602c..86c5d52 100644 --- a/packages/desktop-client/src/components/schedules/DiscoverSchedules.js +++ b/packages/desktop-client/src/components/schedules/DiscoverSchedules.js @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; import { useLocation, useHistory } from 'react-router-dom'; + import q, { runQuery } from 'loot-core/src/client/query-helpers'; import Platform from 'loot-core/src/client/platform'; import { send } from 'loot-core/src/platform/client/fetch'; @@ -24,6 +25,7 @@ import useSelected, { useSelectedItems, SelectedProvider } from 'loot-design/src/components/useSelected'; + import { Page } from '../Page'; import DisplayId from '../util/DisplayId'; import { ScheduleAmountCell } from './SchedulesTable'; diff --git a/packages/desktop-client/src/components/schedules/EditSchedule.js b/packages/desktop-client/src/components/schedules/EditSchedule.js index 0e25e3b..8af6f50 100644 --- a/packages/desktop-client/src/components/schedules/EditSchedule.js +++ b/packages/desktop-client/src/components/schedules/EditSchedule.js @@ -1,6 +1,7 @@ import React, { useEffect, useReducer } from 'react'; import { useParams, useHistory } from 'react-router-dom'; import { useDispatch, useSelector } from 'react-redux'; + import { pushModal } from 'loot-core/src/client/actions/modals'; import { send, sendCatch } from 'loot-core/src/platform/client/fetch'; import q, { runQuery, liveQuery } from 'loot-core/src/client/query-helpers'; @@ -22,6 +23,7 @@ import useSelected, { SelectedProvider } from 'loot-design/src/components/useSelected'; import RecurringSchedulePicker from 'loot-design/src/components/RecurringSchedulePicker'; + import SimpleTransactionsTable from '../accounts/SimpleTransactionsTable'; import { usePageType } from '../Page'; import { Page } from '../Page'; diff --git a/packages/desktop-client/src/components/schedules/LinkSchedule.js b/packages/desktop-client/src/components/schedules/LinkSchedule.js index 1daa056..07d1b46 100644 --- a/packages/desktop-client/src/components/schedules/LinkSchedule.js +++ b/packages/desktop-client/src/components/schedules/LinkSchedule.js @@ -1,9 +1,11 @@ import React, { useCallback } from 'react'; import { useSelector } from 'react-redux'; import { useLocation, useHistory } from 'react-router-dom'; + import { useSchedules } from 'loot-core/src/client/data-hooks/schedules'; import { send } from 'loot-core/src/platform/client/fetch'; import { Text } from 'loot-design/src/components/common'; + import { Page } from '../Page'; import { SchedulesTable } from './SchedulesTable'; diff --git a/packages/desktop-client/src/components/schedules/PostsOfflineNotification.js b/packages/desktop-client/src/components/schedules/PostsOfflineNotification.js index 2d7cdcd..722379c 100644 --- a/packages/desktop-client/src/components/schedules/PostsOfflineNotification.js +++ b/packages/desktop-client/src/components/schedules/PostsOfflineNotification.js @@ -1,8 +1,10 @@ import React from 'react'; import { useLocation, useHistory } from 'react-router-dom'; + import { send } from 'loot-core/src/platform/client/fetch'; import { Text, P, Button, Stack } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; + import { Page } from '../Page'; import DisplayId from '../util/DisplayId'; diff --git a/packages/desktop-client/src/components/schedules/SchedulesTable.js b/packages/desktop-client/src/components/schedules/SchedulesTable.js index fa2a339..6d8d732 100644 --- a/packages/desktop-client/src/components/schedules/SchedulesTable.js +++ b/packages/desktop-client/src/components/schedules/SchedulesTable.js @@ -1,5 +1,6 @@ import React, { useState, useMemo } from 'react'; import { useSelector } from 'react-redux'; + import { integerToCurrency } from 'loot-core/src/shared/util'; import { colors } from 'loot-design/src/style'; import { @@ -20,6 +21,7 @@ import * as monthUtils from 'loot-core/src/shared/months'; import { getScheduledAmount } from 'loot-core/src/shared/schedules'; import DotsHorizontalTriple from 'loot-design/src/svg/v1/DotsHorizontalTriple'; import Check from 'loot-design/src/svg/v2/Check'; + import DisplayId from '../util/DisplayId'; import { StatusBadge } from './StatusBadge'; diff --git a/packages/desktop-client/src/components/schedules/StatusBadge.js b/packages/desktop-client/src/components/schedules/StatusBadge.js index 8a2eb5f..2f97a04 100644 --- a/packages/desktop-client/src/components/schedules/StatusBadge.js +++ b/packages/desktop-client/src/components/schedules/StatusBadge.js @@ -1,8 +1,8 @@ import React from 'react'; + import { colors } from 'loot-design/src/style'; import { View, Text } from 'loot-design/src/components/common'; import { titleFirst } from 'loot-core/src/shared/util'; - import EditSkull1 from 'loot-design/src/svg/v2/EditSkull1'; import AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle'; import CalendarIcon from 'loot-design/src/svg/v2/Calendar'; diff --git a/packages/desktop-client/src/components/schedules/index.js b/packages/desktop-client/src/components/schedules/index.js index ede1a8c..2e39691 100644 --- a/packages/desktop-client/src/components/schedules/index.js +++ b/packages/desktop-client/src/components/schedules/index.js @@ -1,8 +1,10 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; + import { View, Button } from 'loot-design/src/components/common'; import { send } from 'loot-core/src/platform/client/fetch'; import { useSchedules } from 'loot-core/src/client/data-hooks/schedules'; + import { Page } from '../Page'; import { SchedulesTable, ROW_HEIGHT } from './SchedulesTable'; diff --git a/packages/desktop-client/src/components/tools/FixSplitsTool.js b/packages/desktop-client/src/components/tools/FixSplitsTool.js index 15e5026..2d82c85 100644 --- a/packages/desktop-client/src/components/tools/FixSplitsTool.js +++ b/packages/desktop-client/src/components/tools/FixSplitsTool.js @@ -1,7 +1,9 @@ import React, { useState } from 'react'; + import { send } from 'loot-core/src/platform/client/fetch'; import { colors } from 'loot-design/src/style'; import { View, P, ButtonWithLoading } from 'loot-design/src/components/common'; + import { Page } from '../Page'; function renderResults(results) { diff --git a/packages/desktop-client/src/components/tutorial/BudgetCategories.js b/packages/desktop-client/src/components/tutorial/BudgetCategories.js index 3efb8de..fbda816 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetCategories.js +++ b/packages/desktop-client/src/components/tutorial/BudgetCategories.js @@ -1,6 +1,8 @@ import React from 'react'; + import { Tooltip, Pointer, P } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; + import Navigation from './Navigation'; import { Title } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/BudgetInitial.js b/packages/desktop-client/src/components/tutorial/BudgetInitial.js index 55d5bf2..ba10504 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetInitial.js +++ b/packages/desktop-client/src/components/tutorial/BudgetInitial.js @@ -1,8 +1,11 @@ import React from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; + import * as actions from 'loot-core/src/client/actions'; import { P, Button } from 'loot-design/src/components/common'; + import { Title, Standalone, useMinimized } from './common'; import Navigation from './Navigation'; diff --git a/packages/desktop-client/src/components/tutorial/BudgetNewIncome.js b/packages/desktop-client/src/components/tutorial/BudgetNewIncome.js index ff1bf88..9222b2e 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetNewIncome.js +++ b/packages/desktop-client/src/components/tutorial/BudgetNewIncome.js @@ -1,6 +1,8 @@ import React from 'react'; + import { Tooltip, Pointer, P } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; + import Navigation from './Navigation'; import { Title } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/BudgetNextMonth.js b/packages/desktop-client/src/components/tutorial/BudgetNextMonth.js index 7e36c49..708368f 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetNextMonth.js +++ b/packages/desktop-client/src/components/tutorial/BudgetNextMonth.js @@ -1,8 +1,11 @@ import React from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; + import * as actions from 'loot-core/src/client/actions'; import { View, P, Button } from 'loot-design/src/components/common'; + import Navigation from './Navigation'; import { Standalone, Title, useMinimized } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/BudgetSummary.js b/packages/desktop-client/src/components/tutorial/BudgetSummary.js index 0a3e4ab..dae0ae7 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetSummary.js +++ b/packages/desktop-client/src/components/tutorial/BudgetSummary.js @@ -1,6 +1,8 @@ import React from 'react'; + import { Tooltip, Pointer, P } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; + import Navigation from './Navigation'; import { Title } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/CategoryBalance.js b/packages/desktop-client/src/components/tutorial/CategoryBalance.js index ff99329..861c55b 100644 --- a/packages/desktop-client/src/components/tutorial/CategoryBalance.js +++ b/packages/desktop-client/src/components/tutorial/CategoryBalance.js @@ -1,5 +1,7 @@ import React from 'react'; + import { P, Button } from 'loot-design/src/components/common'; + import Navigation from './Navigation'; import { Standalone, Title, useMinimized } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/DeleteTransactions.js b/packages/desktop-client/src/components/tutorial/DeleteTransactions.js index b432a71..69eb52f 100644 --- a/packages/desktop-client/src/components/tutorial/DeleteTransactions.js +++ b/packages/desktop-client/src/components/tutorial/DeleteTransactions.js @@ -1,5 +1,7 @@ import React from 'react'; + import { P } from 'loot-design/src/components/common'; + import Navigation from './Navigation'; import { Standalone, Title } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/Final.js b/packages/desktop-client/src/components/tutorial/Final.js index 91d8a70..7b11fb0 100644 --- a/packages/desktop-client/src/components/tutorial/Final.js +++ b/packages/desktop-client/src/components/tutorial/Final.js @@ -1,5 +1,7 @@ import React from 'react'; + import { P, ModalButtons, Button } from 'loot-design/src/components/common'; + import { Standalone, Title, ExternalLink } from './common'; function Final({ targetRect, navigationProps }) { diff --git a/packages/desktop-client/src/components/tutorial/Intro.js b/packages/desktop-client/src/components/tutorial/Intro.js index 2bab2fb..2bb9396 100644 --- a/packages/desktop-client/src/components/tutorial/Intro.js +++ b/packages/desktop-client/src/components/tutorial/Intro.js @@ -1,4 +1,5 @@ import React from 'react'; + import { View, Text, @@ -6,6 +7,7 @@ import { ModalButtons, Button } from 'loot-design/src/components/common'; + import { Standalone, Title, ExternalLink } from './common'; function Intro({ fromYNAB, nextTutorialStage, closeTutorial }) { diff --git a/packages/desktop-client/src/components/tutorial/Navigation.js b/packages/desktop-client/src/components/tutorial/Navigation.js index 5301db3..2ab184c 100644 --- a/packages/desktop-client/src/components/tutorial/Navigation.js +++ b/packages/desktop-client/src/components/tutorial/Navigation.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Button, ModalButtons } from 'loot-design/src/components/common'; function Navigation({ diff --git a/packages/desktop-client/src/components/tutorial/Overspending.js b/packages/desktop-client/src/components/tutorial/Overspending.js index 26b9a3c..bb7dd06 100644 --- a/packages/desktop-client/src/components/tutorial/Overspending.js +++ b/packages/desktop-client/src/components/tutorial/Overspending.js @@ -1,12 +1,15 @@ import React from 'react'; -import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; + +import { bindActionCreators } from 'redux'; + import * as actions from 'loot-core/src/client/actions'; import SheetValue from 'loot-design/src/components/spreadsheet/SheetValue'; import NamespaceContext from 'loot-design/src/components/spreadsheet/NamespaceContext'; import { P, View, Text, Button } from 'loot-design/src/components/common'; import * as monthUtils from 'loot-core/src/shared/months'; import { integerToCurrency } from 'loot-core/src/shared/util'; + import Navigation from './Navigation'; import { Standalone, Title, useMinimized } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/TransactionAdd.js b/packages/desktop-client/src/components/tutorial/TransactionAdd.js index 5f2e9b0..d97118e 100644 --- a/packages/desktop-client/src/components/tutorial/TransactionAdd.js +++ b/packages/desktop-client/src/components/tutorial/TransactionAdd.js @@ -1,6 +1,8 @@ import React from 'react'; + import { Tooltip, Pointer, P } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; + import Navigation from './Navigation'; import { Title } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/TransactionEnter.js b/packages/desktop-client/src/components/tutorial/TransactionEnter.js index f06ecc1..f70e32d 100644 --- a/packages/desktop-client/src/components/tutorial/TransactionEnter.js +++ b/packages/desktop-client/src/components/tutorial/TransactionEnter.js @@ -1,6 +1,8 @@ import React from 'react'; + import { P } from 'loot-design/src/components/common'; import * as monthUtils from 'loot-core/src/shared/months'; + import Navigation from './Navigation'; import { Standalone, Title } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/TransactionFinalize.js b/packages/desktop-client/src/components/tutorial/TransactionFinalize.js index 266e583..deebba9 100644 --- a/packages/desktop-client/src/components/tutorial/TransactionFinalize.js +++ b/packages/desktop-client/src/components/tutorial/TransactionFinalize.js @@ -1,6 +1,9 @@ import React from 'react'; -import { P } from 'loot-design/src/components/common'; + import { css } from 'glamor'; + +import { P } from 'loot-design/src/components/common'; + import Navigation from './Navigation'; import { Standalone } from './common'; diff --git a/packages/desktop-client/src/components/tutorial/common.js b/packages/desktop-client/src/components/tutorial/common.js index 8ec1f69..39d64bb 100644 --- a/packages/desktop-client/src/components/tutorial/common.js +++ b/packages/desktop-client/src/components/tutorial/common.js @@ -1,6 +1,8 @@ import React, { useState } from 'react'; + import { View, AnchorLink } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; + import AnimateIn from './AnimateIn'; export function Title({ children }) { diff --git a/packages/desktop-client/src/components/util/AmountInput.js b/packages/desktop-client/src/components/util/AmountInput.js index 1e4184c..bdf657e 100644 --- a/packages/desktop-client/src/components/util/AmountInput.js +++ b/packages/desktop-client/src/components/util/AmountInput.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; + import { integerToCurrency, currencyToInteger diff --git a/packages/desktop-client/src/components/util/DisplayId.js b/packages/desktop-client/src/components/util/DisplayId.js index c69df07..c3bef77 100644 --- a/packages/desktop-client/src/components/util/DisplayId.js +++ b/packages/desktop-client/src/components/util/DisplayId.js @@ -1,4 +1,5 @@ import React from 'react'; + import { CachedPayees } from 'loot-core/src/client/data-hooks/payees'; import { CachedAccounts } from 'loot-core/src/client/data-hooks/accounts'; import { Text } from 'loot-design/src/components/common'; diff --git a/packages/desktop-client/src/components/util/GenericInput.js b/packages/desktop-client/src/components/util/GenericInput.js index ffefd22..f4a2cd3 100644 --- a/packages/desktop-client/src/components/util/GenericInput.js +++ b/packages/desktop-client/src/components/util/GenericInput.js @@ -1,5 +1,6 @@ import React from 'react'; import { useSelector } from 'react-redux'; + import { getMonthYearFormat } from 'loot-core/src/shared/months'; import { View, Input } from 'loot-design/src/components/common'; import PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete'; diff --git a/packages/desktop-client/src/hooks/useServerVersion.js b/packages/desktop-client/src/hooks/useServerVersion.js index 3b3f272..07fd31d 100644 --- a/packages/desktop-client/src/hooks/useServerVersion.js +++ b/packages/desktop-client/src/hooks/useServerVersion.js @@ -1,4 +1,5 @@ import { useState, useEffect } from 'react'; + import { send } from 'loot-core/src/platform/client/fetch'; function useServerVersion() { diff --git a/packages/desktop-client/src/index.js b/packages/desktop-client/src/index.js index 2134f6d..067cc2d 100644 --- a/packages/desktop-client/src/index.js +++ b/packages/desktop-client/src/index.js @@ -7,20 +7,23 @@ import '@reach/listbox/styles.css'; import React from 'react'; import ReactDOM from 'react-dom'; +import { Provider } from 'react-redux'; + import { createStore, combineReducers, applyMiddleware, bindActionCreators } from 'redux'; -import { Provider } from 'react-redux'; +import thunk from 'redux-thunk'; + import constants from 'loot-core/src/client/constants'; import reducers from 'loot-core/src/client/reducers'; import { send } from 'loot-core/src/platform/client/fetch'; import q, { runQuery } from 'loot-core/src/client/query-helpers'; import * as actions from 'loot-core/src/client/actions'; -import thunk from 'redux-thunk'; import { initialState as initialAppState } from 'loot-core/src/client/reducers/app'; + import { handleGlobalEvents } from './global-events'; import App from './components/App'; diff --git a/packages/loot-core/package.json b/packages/loot-core/package.json index 48b50c3..72dbd19 100644 --- a/packages/loot-core/package.json +++ b/packages/loot-core/package.json @@ -50,6 +50,7 @@ "damerau-levenshtein": "^1.0.4", "date-fns": "2.0.0-alpha.27", "eslint": "5.6.0", + "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^3.1.4", "esm": "^3.0.82", "fake-indexeddb": "^3.1.3", diff --git a/packages/loot-core/src/client/SpreadsheetProvider.js b/packages/loot-core/src/client/SpreadsheetProvider.js index aedacbe..cf6e884 100644 --- a/packages/loot-core/src/client/SpreadsheetProvider.js +++ b/packages/loot-core/src/client/SpreadsheetProvider.js @@ -1,7 +1,10 @@ import * as React from 'react'; import { useEffect, useMemo } from 'react'; + import LRU from 'lru-cache'; + import SpreadsheetContext from 'loot-design/src/components/spreadsheet/SpreadsheetContext'; + import { listen, send } from '../platform/client/fetch'; function makeSpreadsheet() { diff --git a/packages/loot-core/src/client/actions/budgets.js b/packages/loot-core/src/client/actions/budgets.js index d370b01..3a20240 100644 --- a/packages/loot-core/src/client/actions/budgets.js +++ b/packages/loot-core/src/client/actions/budgets.js @@ -5,6 +5,7 @@ import { send } from '../../platform/client/fetch'; import { setAppState } from './app'; import { startTutorialFirstTime } from './tutorial'; import { getDownloadError } from '../../shared/errors'; + const uuid = require('../../platform/uuid'); export function updateStatusText(text) { diff --git a/packages/loot-core/src/client/actions/notifications.js b/packages/loot-core/src/client/actions/notifications.js index 1a2f236..52eb7e4 100644 --- a/packages/loot-core/src/client/actions/notifications.js +++ b/packages/loot-core/src/client/actions/notifications.js @@ -1,4 +1,5 @@ import constants from '../constants'; + const uuid = require('../../platform/uuid'); export function addNotification(notification) { diff --git a/packages/loot-core/src/client/actions/queries.js b/packages/loot-core/src/client/actions/queries.js index e42ea7a..363ee35 100644 --- a/packages/loot-core/src/client/actions/queries.js +++ b/packages/loot-core/src/client/actions/queries.js @@ -1,4 +1,5 @@ import throttle from 'throttleit'; + import { send } from '../../platform/client/fetch'; import constants from '../constants'; import { addNotification, addGenericErrorNotification } from './notifications'; diff --git a/packages/loot-core/src/client/data-hooks/accounts.js b/packages/loot-core/src/client/data-hooks/accounts.js index c665939..405ad6b 100644 --- a/packages/loot-core/src/client/data-hooks/accounts.js +++ b/packages/loot-core/src/client/data-hooks/accounts.js @@ -1,4 +1,5 @@ import React, { useEffect, useState, useContext } from 'react'; + import q, { liveQuery } from 'loot-core/src/client/query-helpers'; import { getAccountsById } from 'loot-core/src/client/reducers/queries'; diff --git a/packages/loot-core/src/client/data-hooks/payees.js b/packages/loot-core/src/client/data-hooks/payees.js index 5cae0b9..b8383aa 100644 --- a/packages/loot-core/src/client/data-hooks/payees.js +++ b/packages/loot-core/src/client/data-hooks/payees.js @@ -1,4 +1,5 @@ import React, { useEffect, useState, useContext } from 'react'; + import q, { liveQuery } from 'loot-core/src/client/query-helpers'; import { getPayeesById } from 'loot-core/src/client/reducers/queries'; diff --git a/packages/loot-core/src/client/data-hooks/schedules.js b/packages/loot-core/src/client/data-hooks/schedules.js index 7cd0438..b7d5f63 100644 --- a/packages/loot-core/src/client/data-hooks/schedules.js +++ b/packages/loot-core/src/client/data-hooks/schedules.js @@ -1,4 +1,5 @@ import React, { useEffect, useState, useContext } from 'react'; + import { getStatus, getHasTransactionsQuery diff --git a/packages/loot-core/src/client/queries.js b/packages/loot-core/src/client/queries.js index 7ce78ad..b783b5a 100644 --- a/packages/loot-core/src/client/queries.js +++ b/packages/loot-core/src/client/queries.js @@ -1,4 +1,5 @@ import { parse as parseDate, isValid as isDateValid } from 'date-fns'; + import { currencyToAmount, amountToInteger } from '../shared/util'; import { dayFromDate, diff --git a/packages/loot-core/src/client/query-helpers.js b/packages/loot-core/src/client/query-helpers.js index b1a1d83..0a9b2a8 100644 --- a/packages/loot-core/src/client/query-helpers.js +++ b/packages/loot-core/src/client/query-helpers.js @@ -1,6 +1,5 @@ import { listen, send } from '../platform/client/fetch'; import { once } from '../shared/async'; - import q, { getPrimaryOrderBy } from '../shared/query'; export default q; diff --git a/packages/loot-core/src/client/query-hooks.js b/packages/loot-core/src/client/query-hooks.js index 6c680f4..97ef446 100644 --- a/packages/loot-core/src/client/query-hooks.js +++ b/packages/loot-core/src/client/query-hooks.js @@ -1,4 +1,5 @@ import React, { useState, useContext, useMemo, useEffect } from 'react'; + import { runQuery, liveQuery, LiveQuery, PagedQuery } from './query-helpers'; function makeContext(queryState, opts, QueryClass) { diff --git a/packages/loot-core/src/client/reducers/queries.js b/packages/loot-core/src/client/reducers/queries.js index c413744..87dff6c 100644 --- a/packages/loot-core/src/client/reducers/queries.js +++ b/packages/loot-core/src/client/reducers/queries.js @@ -1,5 +1,6 @@ -import constants from '../constants'; import memoizeOne from 'memoize-one'; + +import constants from '../constants'; import { groupById } from '../../shared/util'; const initialState = { diff --git a/packages/loot-core/src/mocks/arbitrary-schema.js b/packages/loot-core/src/mocks/arbitrary-schema.js index 0f508f2..2fee695 100644 --- a/packages/loot-core/src/mocks/arbitrary-schema.js +++ b/packages/loot-core/src/mocks/arbitrary-schema.js @@ -1,4 +1,5 @@ import fc from 'fast-check'; + import { schema } from '../server/aql'; import { addDays } from '../shared/months'; diff --git a/packages/loot-core/src/mocks/index.js b/packages/loot-core/src/mocks/index.js index a2423d8..ed2b174 100644 --- a/packages/loot-core/src/mocks/index.js +++ b/packages/loot-core/src/mocks/index.js @@ -1,4 +1,5 @@ import * as monthUtils from '../shared/months'; + const uuid = require('../platform/uuid'); export function generateAccount(name, isConnected, type, offbudget) { diff --git a/packages/loot-core/src/mocks/redux.js b/packages/loot-core/src/mocks/redux.js index 4c0a15f..47f1124 100644 --- a/packages/loot-core/src/mocks/redux.js +++ b/packages/loot-core/src/mocks/redux.js @@ -1,7 +1,9 @@ import React from 'react'; import { Provider } from 'react-redux'; + import thunk from 'redux-thunk'; import { createStore, combineReducers, applyMiddleware } from 'redux'; + import reducers from '../client/reducers'; let appReducer = combineReducers(reducers); diff --git a/packages/loot-core/src/mocks/util.js b/packages/loot-core/src/mocks/util.js index c430538..9508b0e 100644 --- a/packages/loot-core/src/mocks/util.js +++ b/packages/loot-core/src/mocks/util.js @@ -1,6 +1,7 @@ -const snapshotDiff = require('snapshot-diff'); const { join, dirname, basename } = require('path'); +const snapshotDiff = require('snapshot-diff'); + export function expectSnapshotWithDiffer(initialValue, { onlyUpdates } = {}) { let currentValue = initialValue; if (!onlyUpdates) { diff --git a/packages/loot-core/src/platform/server/asyncStorage/index.electron.js b/packages/loot-core/src/platform/server/asyncStorage/index.electron.js index b94b742..b2a8853 100644 --- a/packages/loot-core/src/platform/server/asyncStorage/index.electron.js +++ b/packages/loot-core/src/platform/server/asyncStorage/index.electron.js @@ -1,7 +1,8 @@ -const lootFs = require('../fs'); const fs = require('fs'); const { join } = require('path'); +const lootFs = require('../fs'); + let getStorePath = () => join(lootFs.getDataDir(), 'global-store.json'); let store; let persisted = true; diff --git a/packages/loot-core/src/platform/server/connection/index.electron.js b/packages/loot-core/src/platform/server/connection/index.electron.js index 3bd2b15..f31ab61 100644 --- a/packages/loot-core/src/platform/server/connection/index.electron.js +++ b/packages/loot-core/src/platform/server/connection/index.electron.js @@ -1,5 +1,6 @@ -const { runHandler, isMutating } = require('../../../server/mutators'); const ipc = require('node-ipc'); + +const { runHandler, isMutating } = require('../../../server/mutators'); const { captureException } = require('../../exceptions'); function coerceError(error) { diff --git a/packages/loot-core/src/platform/server/connection/index.mobile.js b/packages/loot-core/src/platform/server/connection/index.mobile.js index c11f0c0..02e1307 100644 --- a/packages/loot-core/src/platform/server/connection/index.mobile.js +++ b/packages/loot-core/src/platform/server/connection/index.mobile.js @@ -1,6 +1,7 @@ +let rn_bridge = require('rn-bridge'); + const { runHandler } = require('../../../server/mutators'); let { captureException } = require('../../exceptions'); -let rn_bridge = require('rn-bridge'); function coerceError(error) { if (error.type && error.type === 'APIError') { diff --git a/packages/loot-core/src/platform/server/fetch/index.electron.js b/packages/loot-core/src/platform/server/fetch/index.electron.js index ebad971..a553219 100644 --- a/packages/loot-core/src/platform/server/fetch/index.electron.js +++ b/packages/loot-core/src/platform/server/fetch/index.electron.js @@ -1,4 +1,5 @@ let fs = require('fs'); + let fetch = require('node-fetch'); async function fetchBinary(url, filepath) { diff --git a/packages/loot-core/src/platform/server/fs/index.mobile.js b/packages/loot-core/src/platform/server/fs/index.mobile.js index b8af10e..53ec5b2 100644 --- a/packages/loot-core/src/platform/server/fs/index.mobile.js +++ b/packages/loot-core/src/platform/server/fs/index.mobile.js @@ -1,4 +1,5 @@ let path = require('path'); + let fs = require('./index.electron.js'); // On mobile, the backend runs from a single bundle mounted at the diff --git a/packages/loot-core/src/platform/server/fs/index.web.js b/packages/loot-core/src/platform/server/fs/index.web.js index 591824f..f775c0f 100644 --- a/packages/loot-core/src/platform/server/fs/index.web.js +++ b/packages/loot-core/src/platform/server/fs/index.web.js @@ -1,5 +1,6 @@ let { SQLiteFS } = require('absurd-sql'); let IndexedDBBackend = require('absurd-sql/dist/indexeddb-backend').default; + let connection = require('../connection'); let { _getModule } = require('../sqlite'); let idb = require('../indexeddb'); diff --git a/packages/loot-core/src/platform/server/fs/index.web.test.js b/packages/loot-core/src/platform/server/fs/index.web.test.js index 965b3e9..c83f50f 100644 --- a/packages/loot-core/src/platform/server/fs/index.web.test.js +++ b/packages/loot-core/src/platform/server/fs/index.web.test.js @@ -4,6 +4,7 @@ require('fake-indexeddb/auto'); let FDBFactory = require('fake-indexeddb/lib/FDBFactory'); let idb = require('../indexeddb'); + let { init, readFile, writeFile, exists, pathToId, join } = require('./index'); beforeAll(() => { diff --git a/packages/loot-core/src/platform/server/sqlite/index.web.test.js b/packages/loot-core/src/platform/server/sqlite/index.web.test.js index 377516f..3d343f1 100644 --- a/packages/loot-core/src/platform/server/sqlite/index.web.test.js +++ b/packages/loot-core/src/platform/server/sqlite/index.web.test.js @@ -5,6 +5,7 @@ import { execQuery, runQuery } from './index.web'; + let os = require('os'); beforeAll(() => { diff --git a/packages/loot-core/src/server/accounts/export-to-csv.js b/packages/loot-core/src/server/accounts/export-to-csv.js index f58e468..3716f00 100644 --- a/packages/loot-core/src/server/accounts/export-to-csv.js +++ b/packages/loot-core/src/server/accounts/export-to-csv.js @@ -1,4 +1,5 @@ import csvStringify from 'csv-stringify/lib/sync'; + import { runQuery as aqlQuery } from '../aql'; import { integerToAmount } from '../../shared/util'; diff --git a/packages/loot-core/src/server/accounts/link.js b/packages/loot-core/src/server/accounts/link.js index 7f97be6..bcd7899 100644 --- a/packages/loot-core/src/server/accounts/link.js +++ b/packages/loot-core/src/server/accounts/link.js @@ -6,6 +6,7 @@ import { fromPlaidAccountType } from '../../shared/accounts'; import { amountToInteger } from '../../shared/util'; import { post } from '../post'; import { runMutator } from '../mutators'; + const uuid = require('../../platform/uuid'); export async function handoffPublicToken(institution, publicToken) { diff --git a/packages/loot-core/src/server/accounts/parse-file.js b/packages/loot-core/src/server/accounts/parse-file.js index 8887195..62f1e28 100644 --- a/packages/loot-core/src/server/accounts/parse-file.js +++ b/packages/loot-core/src/server/accounts/parse-file.js @@ -1,6 +1,7 @@ +import csv2json from 'csv-parse/lib/sync'; + import fs from '../../platform/server/fs'; import qif2json from './qif2json'; -import csv2json from 'csv-parse/lib/sync'; import { dayFromDate } from '../../shared/months'; import { looselyParseAmount } from '../../shared/util'; diff --git a/packages/loot-core/src/server/accounts/parse-file.test.js b/packages/loot-core/src/server/accounts/parse-file.test.js index 0c47088..6354852 100644 --- a/packages/loot-core/src/server/accounts/parse-file.test.js +++ b/packages/loot-core/src/server/accounts/parse-file.test.js @@ -1,9 +1,10 @@ +import * as d from 'date-fns'; + import { parseFile } from './parse-file'; import { reconcileTransactions } from './sync'; import * as prefs from '../prefs'; import * as db from '../db'; import { amountToInteger } from '../../shared/util'; -import * as d from 'date-fns'; beforeEach(global.emptyDatabase()); diff --git a/packages/loot-core/src/server/accounts/rules.js b/packages/loot-core/src/server/accounts/rules.js index 798cd09..f14a9b2 100644 --- a/packages/loot-core/src/server/accounts/rules.js +++ b/packages/loot-core/src/server/accounts/rules.js @@ -1,5 +1,6 @@ -import { RuleError } from '../errors'; import * as dateFns from 'date-fns'; + +import { RuleError } from '../errors'; import { monthFromDate, yearFromDate, diff --git a/packages/loot-core/src/server/accounts/sync.js b/packages/loot-core/src/server/accounts/sync.js index 2106fda..ce2d643 100644 --- a/packages/loot-core/src/server/accounts/sync.js +++ b/packages/loot-core/src/server/accounts/sync.js @@ -14,8 +14,9 @@ import { runRules } from './transaction-rules'; import { batchUpdateTransactions } from './transactions'; const dateFns = require('date-fns'); -const { post } = require('../post'); const levenshtein = require('damerau-levenshtein'); + +const { post } = require('../post'); const uuid = require('../../platform/uuid'); // Plaid article about API options: diff --git a/packages/loot-core/src/server/accounts/sync.test.js b/packages/loot-core/src/server/accounts/sync.test.js index 0ab189a..2f904f9 100644 --- a/packages/loot-core/src/server/accounts/sync.test.js +++ b/packages/loot-core/src/server/accounts/sync.test.js @@ -10,7 +10,9 @@ import { import * as monthUtils from '../../shared/months'; import * as transfer from './transfer'; import { loadRules, insertRule } from './transaction-rules'; + const snapshotDiff = require('snapshot-diff'); + const { post } = require('../post'); const mockSyncServer = require('../tests/mockSyncServer'); diff --git a/packages/loot-core/src/server/accounts/transactions.js b/packages/loot-core/src/server/accounts/transactions.js index 092379e..d8e71c8 100644 --- a/packages/loot-core/src/server/accounts/transactions.js +++ b/packages/loot-core/src/server/accounts/transactions.js @@ -3,6 +3,7 @@ import * as db from '../db'; import { incrFetch, whereIn } from '../db/util'; import * as transfer from './transfer'; import * as rules from './transaction-rules'; + const connection = require('../../platform/server/connection'); async function idsWithChildren(ids) { diff --git a/packages/loot-core/src/server/app.js b/packages/loot-core/src/server/app.js index c1740ef..964398e 100644 --- a/packages/loot-core/src/server/app.js +++ b/packages/loot-core/src/server/app.js @@ -1,4 +1,5 @@ import mitt from 'mitt'; + import { captureException } from '../platform/exceptions'; // This is a simple helper abstraction for defining methods exposed to diff --git a/packages/loot-core/src/server/aql/exec.test.js b/packages/loot-core/src/server/aql/exec.test.js index f64ab12..e7a3c40 100644 --- a/packages/loot-core/src/server/aql/exec.test.js +++ b/packages/loot-core/src/server/aql/exec.test.js @@ -3,6 +3,7 @@ import query from '../../shared/query'; import { makeChild } from '../../shared/transactions'; import * as aql from './exec'; import { schema, schemaConfig } from './schema'; + const uuid = require('../../platform/uuid'); beforeEach(global.emptyDatabase()); diff --git a/packages/loot-core/src/server/aql/schema/executors.test.js b/packages/loot-core/src/server/aql/schema/executors.test.js index 0bd4a1a..547ab86 100644 --- a/packages/loot-core/src/server/aql/schema/executors.test.js +++ b/packages/loot-core/src/server/aql/schema/executors.test.js @@ -1,4 +1,5 @@ import fc from 'fast-check'; + import * as db from '../../db'; import query from '../../../shared/query'; import { batchMessages, setSyncingMode } from '../../sync/index'; diff --git a/packages/loot-core/src/server/aql/schema/run-query.js b/packages/loot-core/src/server/aql/schema/run-query.js index f32847e..80ec3cc 100644 --- a/packages/loot-core/src/server/aql/schema/run-query.js +++ b/packages/loot-core/src/server/aql/schema/run-query.js @@ -1,4 +1,3 @@ -import { schema, schemaConfig } from './index'; import schemaExecutors from './executors'; import { runQuery as _runQuery, @@ -6,6 +5,8 @@ import { } from '../exec'; import { Query } from '../../../shared/query'; +import { schema, schemaConfig } from './index'; + export function runCompiledQuery(query, sqlPieces, state, params) { return _runCompiledQuery(query, sqlPieces, state, { params, diff --git a/packages/loot-core/src/server/backups.js b/packages/loot-core/src/server/backups.js index cba241a..da5a8af 100644 --- a/packages/loot-core/src/server/backups.js +++ b/packages/loot-core/src/server/backups.js @@ -3,9 +3,11 @@ import * as monthUtils from '../shared/months'; import * as sqlite from '../platform/server/sqlite'; import * as prefs from './prefs'; import * as cloudStorage from './cloud-storage'; + +const dateFns = require('date-fns'); + const connection = require('../platform/server/connection'); const uuid = require('../platform/uuid'); -const dateFns = require('date-fns'); // A special backup that represents the latest version of the db that // can be reverted to after loading a backup diff --git a/packages/loot-core/src/server/backups.test.js b/packages/loot-core/src/server/backups.test.js index 35b7dc7..a1c86cb 100644 --- a/packages/loot-core/src/server/backups.test.js +++ b/packages/loot-core/src/server/backups.test.js @@ -1,4 +1,5 @@ import { updateBackups } from './backups'; + const dateFns = require('date-fns'); describe('Backups', () => { diff --git a/packages/loot-core/src/server/budget/base.js b/packages/loot-core/src/server/budget/base.js index 139b0cb..c1c95e6 100644 --- a/packages/loot-core/src/server/budget/base.js +++ b/packages/loot-core/src/server/budget/base.js @@ -6,7 +6,7 @@ import { resolveName } from '../spreadsheet/util'; import * as report from './report'; import * as rollover from './rollover'; import { sumAmounts } from './util'; -import * as budgetActions from '../budget/actions'; +import * as budgetActions from './actions'; function mergeUpdates(updates) { const merged = {}; diff --git a/packages/loot-core/src/server/budget/report.js b/packages/loot-core/src/server/budget/report.js index 150d050..90901f7 100644 --- a/packages/loot-core/src/server/budget/report.js +++ b/packages/loot-core/src/server/budget/report.js @@ -1,5 +1,6 @@ import * as sheet from '../sheet'; import { number, sumAmounts } from './util'; + const { resolveName } = require('../spreadsheet/util'); export async function createCategory(cat, sheetName, prevSheetName) { diff --git a/packages/loot-core/src/server/budget/rollover.js b/packages/loot-core/src/server/budget/rollover.js index 5f5356f..4b2734b 100644 --- a/packages/loot-core/src/server/budget/rollover.js +++ b/packages/loot-core/src/server/budget/rollover.js @@ -1,6 +1,7 @@ import * as sheet from '../sheet'; import * as monthUtils from '../../shared/months'; import { number, sumAmounts, flatten2, unflatten2 } from './util'; + const { resolveName } = require('../spreadsheet/util'); function getBlankSheet(months) { diff --git a/packages/loot-core/src/server/cloud-storage.js b/packages/loot-core/src/server/cloud-storage.js index 498571d..9670290 100644 --- a/packages/loot-core/src/server/cloud-storage.js +++ b/packages/loot-core/src/server/cloud-storage.js @@ -14,9 +14,11 @@ import { } from './errors'; import encryption from './encryption'; import { post } from './post'; -let uuid = require('../platform/uuid'); + let AdmZip = require('adm-zip'); +let uuid = require('../platform/uuid'); + let UPLOAD_FREQUENCY_IN_DAYS = 7; async function checkHTTPStatus(res) { diff --git a/packages/loot-core/src/server/crdt/timestamp.js b/packages/loot-core/src/server/crdt/timestamp.js index b78a161..cf1f5fa 100644 --- a/packages/loot-core/src/server/crdt/timestamp.js +++ b/packages/loot-core/src/server/crdt/timestamp.js @@ -1,4 +1,5 @@ import murmurhash from 'murmurhash'; + const uuid = require('../../platform/uuid'); /** diff --git a/packages/loot-core/src/server/db/index.js b/packages/loot-core/src/server/db/index.js index fdc432c..7b96f29 100644 --- a/packages/loot-core/src/server/db/index.js +++ b/packages/loot-core/src/server/db/index.js @@ -1,4 +1,5 @@ import LRU from 'lru-cache'; + import * as sqlite from '../../platform/server/sqlite'; import fs from '../../platform/server/fs'; import { sendMessages, batchMessages } from '../sync'; diff --git a/packages/loot-core/src/server/db/mappings.js b/packages/loot-core/src/server/db/mappings.js index 4c0f19f..91d0007 100644 --- a/packages/loot-core/src/server/db/mappings.js +++ b/packages/loot-core/src/server/db/mappings.js @@ -1,6 +1,7 @@ -import * as db from './index'; import { addSyncListener } from '../sync/index'; +import * as db from './index'; + // This file keeps all the mappings in memory so we can access it // synchronously. This is primarily used in the rules system, but // there may be other uses in the future. You don't need to worry diff --git a/packages/loot-core/src/server/encryption.js b/packages/loot-core/src/server/encryption.js index 25018d7..1763c09 100644 --- a/packages/loot-core/src/server/encryption.js +++ b/packages/loot-core/src/server/encryption.js @@ -1,4 +1,5 @@ import * as internals from './encryption-internals'; + let uuid = require('../platform/uuid/index.electron.js'); // A map of all possible master encryption keys to use, keyed by diff --git a/packages/loot-core/src/server/main-app.js b/packages/loot-core/src/server/main-app.js index 3080039..e3597cb 100644 --- a/packages/loot-core/src/server/main-app.js +++ b/packages/loot-core/src/server/main-app.js @@ -1,4 +1,5 @@ import { createApp } from './app'; + const connection = require('../platform/server/connection'); // Main app diff --git a/packages/loot-core/src/server/main.js b/packages/loot-core/src/server/main.js index 6eca6a1..0ed999e 100644 --- a/packages/loot-core/src/server/main.js +++ b/packages/loot-core/src/server/main.js @@ -1,4 +1,6 @@ import './polyfills'; +import injectAPI from '@actual-app/api/injected'; + import asyncStorage from '../platform/server/asyncStorage'; import { captureException, captureBreadcrumb } from '../platform/exceptions'; import * as prefs from './prefs'; @@ -57,7 +59,6 @@ import { parseFile } from './accounts/parse-file'; import { exportToCSV, exportQueryToCSV } from './accounts/export-to-csv'; import { getServer, setServer } from './server-config'; import installAPI from './api'; -import injectAPI from '@actual-app/api/injected'; import * as cloudStorage from './cloud-storage'; import encryption from './encryption'; import * as tracking from './tracking/events'; @@ -67,7 +68,6 @@ import { createTestBudget } from '../mocks/budget'; import { runQuery as aqlQuery } from './aql'; import q, { Query } from '../shared/query'; import app from './main-app'; - // Apps import schedulesApp from './schedules/app'; import budgetApp from './budget/app'; @@ -76,6 +76,7 @@ import toolsApp from './tools/app'; const YNAB4 = require('@actual-app/import-ynab4/importer'); const YNAB5 = require('@actual-app/import-ynab5/importer'); + const uuid = require('../platform/uuid'); const connection = require('../platform/server/connection'); const { resolveName, unresolveName } = require('./spreadsheet/util'); diff --git a/packages/loot-core/src/server/migrate/cli.js b/packages/loot-core/src/server/migrate/cli.js index a8a9a72..2ca3f98 100755 --- a/packages/loot-core/src/server/migrate/cli.js +++ b/packages/loot-core/src/server/migrate/cli.js @@ -1,6 +1,5 @@ #!/usr/bin/env node --trace-warnings import * as sqlite from '../../platform/server/sqlite'; - import { getMigrationsDir, withMigrationsDir, @@ -10,6 +9,7 @@ import { getPending, migrate } from './migrations'; + const fs = require('fs'); const path = require('path'); diff --git a/packages/loot-core/src/server/migrate/migrations.js b/packages/loot-core/src/server/migrate/migrations.js index fe2e808..3bf278e 100644 --- a/packages/loot-core/src/server/migrate/migrations.js +++ b/packages/loot-core/src/server/migrate/migrations.js @@ -1,10 +1,9 @@ -import fs from '../../platform/server/fs'; -import * as sqlite from '../../platform/server/sqlite'; - // We have to bundle in JS migrations manually to avoid having to `eval` // them which doesn't play well with CSP. There isn't great, and eventually // we can remove this migration. import m1632571489012 from '../../../migrations/1632571489012_remove_cache.js'; +import fs from '../../platform/server/fs'; +import * as sqlite from '../../platform/server/sqlite'; const uuid = require('../../platform/uuid'); diff --git a/packages/loot-core/src/server/post.js b/packages/loot-core/src/server/post.js index 75fa24c..60d7696 100644 --- a/packages/loot-core/src/server/post.js +++ b/packages/loot-core/src/server/post.js @@ -1,4 +1,5 @@ import Platform from './platform'; + const { PostError } = require('./errors'); const { fetch } = require('../platform/server/fetch'); diff --git a/packages/loot-core/src/server/prefs.js b/packages/loot-core/src/server/prefs.js index fb7df91..495679d 100644 --- a/packages/loot-core/src/server/prefs.js +++ b/packages/loot-core/src/server/prefs.js @@ -1,5 +1,6 @@ import { sendMessages } from './sync'; import { Timestamp } from './crdt'; + const fs = require('../platform/server/fs'); let prefs = null; diff --git a/packages/loot-core/src/server/schedules/app.js b/packages/loot-core/src/server/schedules/app.js index 34f6994..e1b9666 100644 --- a/packages/loot-core/src/server/schedules/app.js +++ b/packages/loot-core/src/server/schedules/app.js @@ -1,5 +1,6 @@ import deepEqual from 'deep-equal'; import * as d from 'date-fns'; + import { createApp } from '../app'; import * as db from '../db'; import * as prefs from '../prefs'; diff --git a/packages/loot-core/src/server/schedules/app.test.js b/packages/loot-core/src/server/schedules/app.test.js index 5ba23b2..8cb0fe7 100644 --- a/packages/loot-core/src/server/schedules/app.test.js +++ b/packages/loot-core/src/server/schedules/app.test.js @@ -1,3 +1,5 @@ +import MockDate from 'mockdate'; + import { runQuery as aqlQuery } from '../aql'; import q from '../../shared/query'; import { loadRules, updateRule } from '../accounts/transaction-rules'; @@ -10,7 +12,6 @@ import { deleteSchedule, setNextDate } from './app'; -import MockDate from 'mockdate'; beforeEach(async () => { await global.emptyDatabase()(); diff --git a/packages/loot-core/src/server/schedules/find-schedules.js b/packages/loot-core/src/server/schedules/find-schedules.js index b40edad..5731aaf 100644 --- a/packages/loot-core/src/server/schedules/find-schedules.js +++ b/packages/loot-core/src/server/schedules/find-schedules.js @@ -1,4 +1,5 @@ import * as d from 'date-fns'; + import * as db from '../db'; import { Schedule as RSchedule } from '../util/rschedule'; import { groupBy } from '../../shared/util'; @@ -9,6 +10,7 @@ import { getApproxNumberThreshold } from '../../shared/rules'; import { recurConfigToRSchedule } from '../../shared/schedules'; import { dayFromDate, parseDate } from '../../shared/months'; import { conditionsToAQL } from '../accounts/transaction-rules'; + const uuid = require('../../platform/uuid'); function takeDates(config) { diff --git a/packages/loot-core/src/server/sheet.js b/packages/loot-core/src/server/sheet.js index 5df2ec4..5619241 100644 --- a/packages/loot-core/src/server/sheet.js +++ b/packages/loot-core/src/server/sheet.js @@ -4,6 +4,7 @@ import { captureBreadcrumb } from '../platform/exceptions'; import * as sqlite from '../platform/server/sqlite'; import { sheetForMonth } from '../shared/months'; import Platform from './platform'; + const { resolveName } = require('./spreadsheet/util'); let globalSheet, globalOnChange; diff --git a/packages/loot-core/src/server/spreadsheet/interpreter.js b/packages/loot-core/src/server/spreadsheet/interpreter.js index d659995..38aecd7 100644 --- a/packages/loot-core/src/server/spreadsheet/interpreter.js +++ b/packages/loot-core/src/server/spreadsheet/interpreter.js @@ -1,4 +1,5 @@ const escodegen = require('@jlongster/escodegen'); + const globals = require('./globals'); // Unfortunately we need to use eval to bypass babel's transform of diff --git a/packages/loot-core/src/server/spreadsheet/new/vm.test.js b/packages/loot-core/src/server/spreadsheet/new/vm.test.js index 6c3a726..bfebe10 100644 --- a/packages/loot-core/src/server/spreadsheet/new/vm.test.js +++ b/packages/loot-core/src/server/spreadsheet/new/vm.test.js @@ -1,4 +1,5 @@ import VM from './vm'; + const { unresolveName } = require('../util'); const db = { diff --git a/packages/loot-core/src/server/spreadsheet/spreadsheet.js b/packages/loot-core/src/server/spreadsheet/spreadsheet.js index c24ccd1..459be7b 100644 --- a/packages/loot-core/src/server/spreadsheet/spreadsheet.js +++ b/packages/loot-core/src/server/spreadsheet/spreadsheet.js @@ -1,4 +1,5 @@ import mitt from 'mitt'; + import { compileQuery, runCompiledQuery, schema, schemaConfig } from '../aql'; const Graph = require('./graph-data-structure'); diff --git a/packages/loot-core/src/server/spreadsheet/tests/data-propagation.js b/packages/loot-core/src/server/spreadsheet/tests/data-propagation.js index 9d8544f..8268ef7 100644 --- a/packages/loot-core/src/server/spreadsheet/tests/data-propagation.js +++ b/packages/loot-core/src/server/spreadsheet/tests/data-propagation.js @@ -1,4 +1,5 @@ const expect = require('expect'); + const propagate = require('../data-compute/propagate.js'); describe('data propagation', () => { diff --git a/packages/loot-core/src/server/spreadsheet/usage.js b/packages/loot-core/src/server/spreadsheet/usage.js index abe6f8c..c053a06 100644 --- a/packages/loot-core/src/server/spreadsheet/usage.js +++ b/packages/loot-core/src/server/spreadsheet/usage.js @@ -1,11 +1,11 @@ const sqlite = require('sqlite3'); const escodegen = require('escodegen'); + const sqlgen = require('./sqlgen'); +const Spreadsheet = require('./spreadsheet'); // Example usage: -const Spreadsheet = require('./spreadsheet'); - const db = new sqlite.Database(__dirname + '/../../db.sqlite'); const sheet = new Spreadsheet({ plugins: { diff --git a/packages/loot-core/src/server/sync/encoder.js b/packages/loot-core/src/server/sync/encoder.js index 82b9c20..b2db4bf 100644 --- a/packages/loot-core/src/server/sync/encoder.js +++ b/packages/loot-core/src/server/sync/encoder.js @@ -1,5 +1,6 @@ import encryption from '../encryption'; import * as prefs from '../prefs'; + let { SyncError } = require('../errors'); let SyncPb = require('./proto/sync_pb'); diff --git a/packages/loot-core/src/server/sync/make-test-message.js b/packages/loot-core/src/server/sync/make-test-message.js index ca02aaf..88ebf1c 100644 --- a/packages/loot-core/src/server/sync/make-test-message.js +++ b/packages/loot-core/src/server/sync/make-test-message.js @@ -1,4 +1,5 @@ import encryption from '../encryption'; + let SyncPb = require('./proto/sync_pb'); async function randomString() { diff --git a/packages/loot-core/src/server/sync/migrate.js b/packages/loot-core/src/server/sync/migrate.js index 40fcaa3..20f055c 100644 --- a/packages/loot-core/src/server/sync/migrate.js +++ b/packages/loot-core/src/server/sync/migrate.js @@ -1,6 +1,7 @@ -import { addSyncListener, applyMessages } from './index'; import { Timestamp } from '../crdt'; +import { addSyncListener, applyMessages } from './index'; + function migrateParentIds(oldValues, newValues) { newValues.forEach((items, table) => { if (table === 'transactions') { diff --git a/packages/loot-core/src/server/sync/migrate.test.js b/packages/loot-core/src/server/sync/migrate.test.js index 9a33561..2042965 100644 --- a/packages/loot-core/src/server/sync/migrate.test.js +++ b/packages/loot-core/src/server/sync/migrate.test.js @@ -1,11 +1,13 @@ import fc from 'fast-check'; + import * as db from '../db'; import { listen, unlisten } from './migrate'; -import { addSyncListener, sendMessages } from './index'; import { execTracer } from '../../shared/test-helpers'; import { convertInputType, schema, schemaConfig } from '../aql'; import arbs from '../../mocks/arbitrary-schema'; +import { addSyncListener, sendMessages } from './index'; + beforeEach(() => { listen(); return global.emptyDatabase()(); diff --git a/packages/loot-core/src/server/sync/reset.js b/packages/loot-core/src/server/sync/reset.js index fda144c..cbd3bff 100644 --- a/packages/loot-core/src/server/sync/reset.js +++ b/packages/loot-core/src/server/sync/reset.js @@ -4,6 +4,7 @@ import * as prefs from '../prefs'; import asyncStorage from '../../platform/server/asyncStorage'; import { captureException } from '../../platform/exceptions'; import { runMutator } from '../mutators'; + const connection = require('../../platform/server/connection'); export default async function resetSync(keyState) { diff --git a/packages/loot-core/src/server/sync/sync.property.test.js b/packages/loot-core/src/server/sync/sync.property.test.js index 0c798c8..943b888 100644 --- a/packages/loot-core/src/server/sync/sync.property.test.js +++ b/packages/loot-core/src/server/sync/sync.property.test.js @@ -1,9 +1,11 @@ import * as prefs from '../prefs'; import * as db from '../db'; import * as sheet from '../sheet'; -import * as sync from './index'; import { merkle, getClock, Timestamp } from '../crdt'; import * as encoder from './encoder'; + +import * as sync from './index'; + const jsc = require('jsverify'); const uuidGenerator = jsc.integer(97, 122).smap( x => String.fromCharCode(x), diff --git a/packages/loot-core/src/server/sync/sync.test.js b/packages/loot-core/src/server/sync/sync.test.js index cea7d05..4778360 100644 --- a/packages/loot-core/src/server/sync/sync.test.js +++ b/packages/loot-core/src/server/sync/sync.test.js @@ -3,8 +3,10 @@ import * as db from '../db'; import * as sheet from '../sheet'; import { getClock, Timestamp } from '../crdt'; import { resolveName } from '../spreadsheet/util'; -import { setSyncingMode, sendMessages, applyMessages, fullSync } from './index'; import * as encoder from './encoder'; + +import { setSyncingMode, sendMessages, applyMessages, fullSync } from './index'; + const mockSyncServer = require('../tests/mockSyncServer'); beforeEach(() => { diff --git a/packages/loot-core/src/server/tests/mockSyncServer.js b/packages/loot-core/src/server/tests/mockSyncServer.js index ceb12d7..d245e45 100644 --- a/packages/loot-core/src/server/tests/mockSyncServer.js +++ b/packages/loot-core/src/server/tests/mockSyncServer.js @@ -1,5 +1,7 @@ import dateFns from 'date-fns'; + import { makeClock, Timestamp, merkle } from '../crdt'; + const defaultMockData = require('./mockData').basic; const SyncPb = require('../sync/proto/sync_pb'); diff --git a/packages/loot-core/src/server/undo.js b/packages/loot-core/src/server/undo.js index bc96741..039c5a0 100644 --- a/packages/loot-core/src/server/undo.js +++ b/packages/loot-core/src/server/undo.js @@ -2,6 +2,7 @@ import { sendMessages } from './sync'; import { getIn } from '../shared/util'; import { Timestamp } from './crdt'; import { withMutatorContext, getMutatorContext } from './mutators'; + const connection = require('../platform/server/connection'); // A marker always sits as the first entry to simplify logic diff --git a/packages/loot-core/src/server/update.js b/packages/loot-core/src/server/update.js index f4e6459..679e8d9 100644 --- a/packages/loot-core/src/server/update.js +++ b/packages/loot-core/src/server/update.js @@ -1,4 +1,5 @@ import md5 from 'md5'; + import * as migrations from './migrate/migrations'; import * as db from './db'; import { schema, schemaConfig, makeViews } from './aql'; diff --git a/packages/loot-core/src/server/util/budget-name.js b/packages/loot-core/src/server/util/budget-name.js index 6163cb1..811904b 100644 --- a/packages/loot-core/src/server/util/budget-name.js +++ b/packages/loot-core/src/server/util/budget-name.js @@ -1,4 +1,5 @@ import fs from '../../platform/server/fs'; + const uuid = require('../../platform/uuid'); export async function uniqueFileName(existingFiles) { diff --git a/packages/loot-core/src/shared/schedules.test.js b/packages/loot-core/src/shared/schedules.test.js index 880899d..a3733b4 100644 --- a/packages/loot-core/src/shared/schedules.test.js +++ b/packages/loot-core/src/shared/schedules.test.js @@ -1,6 +1,7 @@ -import { getRecurringDescription } from './schedules'; import MockDate from 'mockdate'; +import { getRecurringDescription } from './schedules'; + describe('recurring date description', () => { beforeEach(() => { MockDate.set(new Date(2021, 4, 14)); diff --git a/packages/loot-core/src/shared/transactions.js b/packages/loot-core/src/shared/transactions.js index b5bf3fd..97559e9 100644 --- a/packages/loot-core/src/shared/transactions.js +++ b/packages/loot-core/src/shared/transactions.js @@ -1,4 +1,5 @@ import { last, diffItems, applyChanges } from './util'; + const uuid = require('../platform/uuid'); // The amount might be null when adding a new transaction diff --git a/packages/loot-core/src/shared/transactions.test.js b/packages/loot-core/src/shared/transactions.test.js index b95471e..743e553 100644 --- a/packages/loot-core/src/shared/transactions.test.js +++ b/packages/loot-core/src/shared/transactions.test.js @@ -5,6 +5,7 @@ import { addSplitTransaction, makeChild } from './transactions'; + const uuid = require('../platform/uuid'); // const data = { diff --git a/packages/loot-design/src/components/AccountAutocomplete.js b/packages/loot-design/src/components/AccountAutocomplete.js index 2eccf66..764d60f 100644 --- a/packages/loot-design/src/components/AccountAutocomplete.js +++ b/packages/loot-design/src/components/AccountAutocomplete.js @@ -1,5 +1,7 @@ import React from 'react'; + import { useCachedAccounts } from 'loot-core/src/client/data-hooks/accounts'; + import Autocomplete from './Autocomplete'; import { View } from './common'; import { colors } from '../style'; diff --git a/packages/loot-design/src/components/Autocomplete.js b/packages/loot-design/src/components/Autocomplete.js index ccb002f..52c1759 100644 --- a/packages/loot-design/src/components/Autocomplete.js +++ b/packages/loot-design/src/components/Autocomplete.js @@ -1,7 +1,9 @@ import React, { useState, useRef, useEffect } from 'react'; + import lively from '@jlongster/lively'; import Downshift from 'downshift'; import { css } from 'glamor'; + import { colors } from '../style'; import Remove from '../svg/v2/Remove'; import { View, Input, Tooltip, Button } from './common'; diff --git a/packages/loot-design/src/components/Autocomplete.usage.js b/packages/loot-design/src/components/Autocomplete.usage.js index 987a68e..8b50770 100644 --- a/packages/loot-design/src/components/Autocomplete.usage.js +++ b/packages/loot-design/src/components/Autocomplete.usage.js @@ -1,6 +1,8 @@ import React from 'react'; -import Autocomplete, { MultiAutocomplete } from './Autocomplete'; + import Component from '@reactions/component'; + +import Autocomplete, { MultiAutocomplete } from './Autocomplete'; import { Section } from '../guide/components'; let items = [ diff --git a/packages/loot-design/src/components/CategorySelect.js b/packages/loot-design/src/components/CategorySelect.js index f94dd23..599a874 100644 --- a/packages/loot-design/src/components/CategorySelect.js +++ b/packages/loot-design/src/components/CategorySelect.js @@ -1,4 +1,5 @@ import React, { useMemo } from 'react'; + import { View, Text, Select } from './common'; import Autocomplete, { defaultFilterSuggestion } from './Autocomplete'; import { colors } from '../style'; diff --git a/packages/loot-design/src/components/DateSelect.js b/packages/loot-design/src/components/DateSelect.js index db9b998..dbb766b 100644 --- a/packages/loot-design/src/components/DateSelect.js +++ b/packages/loot-design/src/components/DateSelect.js @@ -6,11 +6,11 @@ import React, { useImperativeHandle, useMemo } from 'react'; + import * as d from 'date-fns'; import Pikaday from 'pikaday'; + import 'pikaday/css/pikaday.css'; -import { colors } from '../style'; -import { View, Input, Tooltip } from './common'; import { getDayMonthFormat, getDayMonthRegex, @@ -18,6 +18,8 @@ import { getShortYearRegex } from 'loot-core/src/shared/months'; +import { colors } from '../style'; +import { View, Input, Tooltip } from './common'; import DateSelectLeft from './DateSelect.left.png'; import DateSelectRight from './DateSelect.right.png'; diff --git a/packages/loot-design/src/components/DateSelect.usage.js b/packages/loot-design/src/components/DateSelect.usage.js index c583ae9..64cb218 100644 --- a/packages/loot-design/src/components/DateSelect.usage.js +++ b/packages/loot-design/src/components/DateSelect.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import DateSelect from './DateSelect'; import { Section } from '../guide/components'; diff --git a/packages/loot-design/src/components/FixedSizeList.js b/packages/loot-design/src/components/FixedSizeList.js index 72e902f..d3f341b 100644 --- a/packages/loot-design/src/components/FixedSizeList.js +++ b/packages/loot-design/src/components/FixedSizeList.js @@ -1,5 +1,7 @@ import React from 'react'; + import memoizeOne from 'memoize-one'; + import useResizeObserver from './useResizeObserver'; import { View } from './common'; diff --git a/packages/loot-design/src/components/KeyHandlers.js b/packages/loot-design/src/components/KeyHandlers.js index d784df9..dc31bbe 100644 --- a/packages/loot-design/src/components/KeyHandlers.js +++ b/packages/loot-design/src/components/KeyHandlers.js @@ -1,6 +1,7 @@ -import hotkeys from 'hotkeys-js'; import React, { useEffect, useContext } from 'react'; +import hotkeys from 'hotkeys-js'; + let KeyScopeContext = React.createContext('app'); hotkeys.filter = event => { diff --git a/packages/loot-design/src/components/NotesButton.js b/packages/loot-design/src/components/NotesButton.js index 8ef0b5f..990d1ea 100644 --- a/packages/loot-design/src/components/NotesButton.js +++ b/packages/loot-design/src/components/NotesButton.js @@ -1,8 +1,11 @@ import React, { useState, useEffect, useMemo } from 'react'; + import { css } from 'glamor'; + import { send } from 'loot-core/src/platform/client/fetch'; import { useLiveQuery } from 'loot-core/src/client/query-hooks'; import q from 'loot-core/src/client/query-helpers'; + import { View, Button, Tooltip, useTooltip } from './common'; import CustomNotesPaper from '../svg/v2/CustomNotesPaper'; import { colors } from '../style'; diff --git a/packages/loot-design/src/components/PayeeAutocomplete.js b/packages/loot-design/src/components/PayeeAutocomplete.js index 4c3ee16..e6fd723 100644 --- a/packages/loot-design/src/components/PayeeAutocomplete.js +++ b/packages/loot-design/src/components/PayeeAutocomplete.js @@ -1,9 +1,11 @@ import React, { useState, useMemo, useRef } from 'react'; import { useDispatch } from 'react-redux'; + import { getActivePayees } from 'loot-core/src/client/reducers/queries'; import { createPayee } from 'loot-core/src/client/actions/queries'; import { useCachedPayees } from 'loot-core/src/client/data-hooks/payees'; import { useCachedAccounts } from 'loot-core/src/client/data-hooks/accounts'; + import { View } from './common'; import Add from '../svg/v1/Add'; import Autocomplete, { diff --git a/packages/loot-design/src/components/RecurringSchedulePicker.js b/packages/loot-design/src/components/RecurringSchedulePicker.js index 496b481..351b37b 100644 --- a/packages/loot-design/src/components/RecurringSchedulePicker.js +++ b/packages/loot-design/src/components/RecurringSchedulePicker.js @@ -1,23 +1,17 @@ import React, { useEffect, useReducer, useState } from 'react'; import { useSelector } from 'react-redux'; + import { sendCatch } from 'loot-core/src/platform/client/fetch'; import * as monthUtils from 'loot-core/src/shared/months'; import { getRecurringDescription } from 'loot-core/src/shared/schedules'; -import DateSelect from './DateSelect'; -import { - Button, - Select, - Input, - Tooltip, - View, - Text, - Stack -} from '../components/common'; import { colors } from 'loot-design/src/style'; import { useTooltip } from 'loot-design/src/components/tooltips'; import SubtractIcon from 'loot-design/src/svg/Subtract'; import AddIcon from 'loot-design/src/svg/Add'; +import { Button, Select, Input, Tooltip, View, Text, Stack } from './common'; +import DateSelect from './DateSelect'; + const DATE_FORMAT = 'yyyy-MM-dd'; // ex: There is no 6th Friday of the Month diff --git a/packages/loot-design/src/components/RecurringSchedulePicker.usage.js b/packages/loot-design/src/components/RecurringSchedulePicker.usage.js index 9529de2..c746b21 100644 --- a/packages/loot-design/src/components/RecurringSchedulePicker.usage.js +++ b/packages/loot-design/src/components/RecurringSchedulePicker.usage.js @@ -1,8 +1,9 @@ import React from 'react'; + import RecurringSchedulePicker from './RecurringSchedulePicker'; import { Section } from '../guide/components'; import { Button, View } from './common'; -import { useTooltip } from '../components/tooltips'; +import { useTooltip } from './tooltips'; export default () => { const { isOpen, close, getOpenEvents } = useTooltip(); diff --git a/packages/loot-design/src/components/Stack.js b/packages/loot-design/src/components/Stack.js index d268930..d7108b9 100644 --- a/packages/loot-design/src/components/Stack.js +++ b/packages/loot-design/src/components/Stack.js @@ -1,4 +1,5 @@ import React from 'react'; + import View from './View'; import Text from './Text'; diff --git a/packages/loot-design/src/components/Text.js b/packages/loot-design/src/components/Text.js index 61156f9..7a6fae6 100644 --- a/packages/loot-design/src/components/Text.js +++ b/packages/loot-design/src/components/Text.js @@ -1,4 +1,5 @@ import React from 'react'; + import { css } from 'glamor'; function Text(props) { diff --git a/packages/loot-design/src/components/TutorialPoint.js b/packages/loot-design/src/components/TutorialPoint.js index 2c4466c..c581c36 100644 --- a/packages/loot-design/src/components/TutorialPoint.js +++ b/packages/loot-design/src/components/TutorialPoint.js @@ -1,4 +1,5 @@ import React from 'react'; + import PropTypes from 'prop-types'; class TutorialPoint extends React.Component { diff --git a/packages/loot-design/src/components/View.js b/packages/loot-design/src/components/View.js index 8002dd5..69ea703 100644 --- a/packages/loot-design/src/components/View.js +++ b/packages/loot-design/src/components/View.js @@ -1,4 +1,5 @@ import React from 'react'; + import { css } from 'glamor'; function View(props) { diff --git a/packages/loot-design/src/components/alerts.js b/packages/loot-design/src/components/alerts.js index ae41b94..866bea8 100644 --- a/packages/loot-design/src/components/alerts.js +++ b/packages/loot-design/src/components/alerts.js @@ -1,4 +1,5 @@ import React from 'react'; + import { View, Text } from './common'; import { styles, colors } from '../style'; import InformationOutline from '../svg/v1/InformationOutline'; diff --git a/packages/loot-design/src/components/budget/BalanceWithCarryover.js b/packages/loot-design/src/components/budget/BalanceWithCarryover.js index dabda92..9a0745c 100644 --- a/packages/loot-design/src/components/budget/BalanceWithCarryover.js +++ b/packages/loot-design/src/components/budget/BalanceWithCarryover.js @@ -1,4 +1,5 @@ import React from 'react'; + import useSheetValue from '../spreadsheet/useSheetValue'; import { makeAmountStyle } from './util'; import { View } from '../common'; diff --git a/packages/loot-design/src/components/budget/BudgetMonthCountContext.js b/packages/loot-design/src/components/budget/BudgetMonthCountContext.js index dbb2651..e615369 100644 --- a/packages/loot-design/src/components/budget/BudgetMonthCountContext.js +++ b/packages/loot-design/src/components/budget/BudgetMonthCountContext.js @@ -1,4 +1,5 @@ import React, { useContext, useState } from 'react'; + import mitt from 'mitt'; export let BudgetMonthCountContext = React.createContext(); diff --git a/packages/loot-design/src/components/budget/BudgetSummaries.js b/packages/loot-design/src/components/budget/BudgetSummaries.js index 9bcf2e5..75a65ac 100644 --- a/packages/loot-design/src/components/budget/BudgetSummaries.js +++ b/packages/loot-design/src/components/budget/BudgetSummaries.js @@ -5,10 +5,13 @@ import React, { useCallback, useLayoutEffect } from 'react'; + import { Spring } from 'wobble'; import { css } from 'glamor'; -import { MonthsContext } from './MonthsContext'; + import * as monthUtils from 'loot-core/src/shared/months'; + +import { MonthsContext } from './MonthsContext'; import { View } from '../common'; import useResizeObserver from '../useResizeObserver'; diff --git a/packages/loot-design/src/components/budget/DynamicBudgetTable.js b/packages/loot-design/src/components/budget/DynamicBudgetTable.js index 33f9bd6..fac8f98 100644 --- a/packages/loot-design/src/components/budget/DynamicBudgetTable.js +++ b/packages/loot-design/src/components/budget/DynamicBudgetTable.js @@ -1,10 +1,12 @@ import React, { useEffect } from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; + import { View } from '../common'; -import { BudgetPageHeader, BudgetTable } from './index'; import { CategoryGroupsContext } from './util'; import { useBudgetMonthCount } from './BudgetMonthCountContext'; +import { BudgetPageHeader, BudgetTable } from './index'; + function getNumPossibleMonths(width) { let estimatedTableWidth = width - 200; diff --git a/packages/loot-design/src/components/budget/MonthsContext.js b/packages/loot-design/src/components/budget/MonthsContext.js index d481d71..102a75a 100644 --- a/packages/loot-design/src/components/budget/MonthsContext.js +++ b/packages/loot-design/src/components/budget/MonthsContext.js @@ -1,4 +1,5 @@ import React from 'react'; + import * as monthUtils from 'loot-core/src/shared/months'; export function getValidMonthBounds(bounds, startMonth, endMonth) { diff --git a/packages/loot-design/src/components/budget/index.js b/packages/loot-design/src/components/budget/index.js index 5c0ee22..4f03742 100644 --- a/packages/loot-design/src/components/budget/index.js +++ b/packages/loot-design/src/components/budget/index.js @@ -1,4 +1,9 @@ import React, { useContext, useState, useMemo } from 'react'; + +import { scope } from '@jlongster/lively'; + +import * as monthUtils from 'loot-core/src/shared/months'; + import ElementQuery from '../ElementQuery'; import { View, @@ -16,19 +21,15 @@ import { DropHighlightPosContext } from '../sort.js'; import NamespaceContext from '../spreadsheet/NamespaceContext'; -import { scope } from '@jlongster/lively'; import { styles, colors } from '../../style'; import ArrowThinLeft from '../../svg/v1/ArrowThinLeft'; import ArrowThinRight from '../../svg/v1/ArrowThinRight'; import ExpandArrow from '../../svg/ExpandArrow'; import CheveronDown from '../../svg/v1/CheveronDown'; -import * as monthUtils from 'loot-core/src/shared/months'; import { separateGroups, findSortDown, findSortUp } from './util'; import { MonthsProvider, MonthsContext } from './MonthsContext'; import NotesButton from '../NotesButton'; - import BudgetSummaries from './BudgetSummaries'; - import { INCOME_HEADER_HEIGHT, MONTH_BOX_SHADOW } from './constants'; function getScrollbarWidth() { diff --git a/packages/loot-design/src/components/budget/index.usage.js b/packages/loot-design/src/components/budget/index.usage.js index 025e51d..50e16d7 100644 --- a/packages/loot-design/src/components/budget/index.usage.js +++ b/packages/loot-design/src/components/budget/index.usage.js @@ -1,14 +1,16 @@ import React from 'react'; import { DndProvider } from 'react-dnd'; import Backend from 'react-dnd-html5-backend'; + +import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; +import { generateCategoryGroups } from 'loot-core/src/mocks'; +import * as monthUtils from 'loot-core/src/shared/months'; + import { Section } from '../../guide/components'; import { View } from '../common'; import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; -import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; import DynamicBudgetTable from './DynamicBudgetTable'; import { BudgetMonthCountContext } from './BudgetMonthCountContext'; -import { generateCategoryGroups } from 'loot-core/src/mocks'; -import * as monthUtils from 'loot-core/src/shared/months'; import * as rollover from './rollover/rollover-components'; import { RolloverContext } from './rollover/RolloverContext'; import { colors } from '../../style'; diff --git a/packages/loot-design/src/components/budget/report/BudgetSummary.js b/packages/loot-design/src/components/budget/report/BudgetSummary.js index 57e8da7..585dc46 100644 --- a/packages/loot-design/src/components/budget/report/BudgetSummary.js +++ b/packages/loot-design/src/components/budget/report/BudgetSummary.js @@ -1,7 +1,10 @@ import React, { useState } from 'react'; + import { css } from 'glamor'; + import * as monthUtils from 'loot-core/src/shared/months'; import { reportBudget } from 'loot-core/src/client/queries'; + import NamespaceContext from '../../spreadsheet/NamespaceContext'; import CellValue from '../../spreadsheet/CellValue'; import useSheetValue from '../../spreadsheet/useSheetValue'; diff --git a/packages/loot-design/src/components/budget/report/ReportContext.js b/packages/loot-design/src/components/budget/report/ReportContext.js index 9933ae1..2f5057a 100644 --- a/packages/loot-design/src/components/budget/report/ReportContext.js +++ b/packages/loot-design/src/components/budget/report/ReportContext.js @@ -1,4 +1,5 @@ import React, { useContext } from 'react'; + import * as monthUtils from 'loot-core/src/shared/months'; let Context = React.createContext(null); diff --git a/packages/loot-design/src/components/budget/report/components.js b/packages/loot-design/src/components/budget/report/components.js index b3d87f9..87c73c0 100644 --- a/packages/loot-design/src/components/budget/report/components.js +++ b/packages/loot-design/src/components/budget/report/components.js @@ -1,7 +1,9 @@ import React from 'react'; + import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import evalArithmetic from 'loot-core/src/shared/arithmetic'; import { reportBudget } from 'loot-core/src/client/queries'; + import { styles, colors } from '../../../style'; import { View, Text, Tooltip, Menu, useTooltip } from '../../common'; import { Field, SheetCell } from '../../table'; diff --git a/packages/loot-design/src/components/budget/rollover/BudgetSummary.js b/packages/loot-design/src/components/budget/rollover/BudgetSummary.js index 160fa64..c260017 100644 --- a/packages/loot-design/src/components/budget/rollover/BudgetSummary.js +++ b/packages/loot-design/src/components/budget/rollover/BudgetSummary.js @@ -1,8 +1,11 @@ import React, { useState } from 'react'; + import { css } from 'glamor'; import Component from '@reactions/component'; + import * as monthUtils from 'loot-core/src/shared/months'; import { rolloverBudget } from 'loot-core/src/client/queries'; + import NamespaceContext from '../../spreadsheet/NamespaceContext'; import format from '../../spreadsheet/format'; import SheetValue from '../../spreadsheet/SheetValue'; diff --git a/packages/loot-design/src/components/budget/rollover/HoldTooltip.js b/packages/loot-design/src/components/budget/rollover/HoldTooltip.js index c1ef163..cccbdbc 100644 --- a/packages/loot-design/src/components/budget/rollover/HoldTooltip.js +++ b/packages/loot-design/src/components/budget/rollover/HoldTooltip.js @@ -1,6 +1,8 @@ import React, { useState, useContext, useEffect } from 'react'; + import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import evalArithmetic from 'loot-core/src/shared/arithmetic'; + import { View, Button, Tooltip, InitialFocus, Input } from '../../common'; import SpreadsheetContext from '../../spreadsheet/SpreadsheetContext'; import NamespaceContext from '../../spreadsheet/NamespaceContext'; diff --git a/packages/loot-design/src/components/budget/rollover/RolloverContext.js b/packages/loot-design/src/components/budget/rollover/RolloverContext.js index 7367b1c..2c3c406 100644 --- a/packages/loot-design/src/components/budget/rollover/RolloverContext.js +++ b/packages/loot-design/src/components/budget/rollover/RolloverContext.js @@ -1,4 +1,5 @@ import React, { useContext } from 'react'; + import * as monthUtils from 'loot-core/src/shared/months'; let Context = React.createContext(null); diff --git a/packages/loot-design/src/components/budget/rollover/TransferTooltip.js b/packages/loot-design/src/components/budget/rollover/TransferTooltip.js index ab2bf82..4e7a76d 100644 --- a/packages/loot-design/src/components/budget/rollover/TransferTooltip.js +++ b/packages/loot-design/src/components/budget/rollover/TransferTooltip.js @@ -1,6 +1,8 @@ import React, { useState, useContext, useEffect } from 'react'; + import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import evalArithmetic from 'loot-core/src/shared/arithmetic'; + import { View, Button, Tooltip, InitialFocus, Input } from '../../common'; import SpreadsheetContext from '../../spreadsheet/SpreadsheetContext'; import NamespaceContext from '../../spreadsheet/NamespaceContext'; diff --git a/packages/loot-design/src/components/budget/rollover/rollover-components.js b/packages/loot-design/src/components/budget/rollover/rollover-components.js index 69f22d1..8dfca9e 100644 --- a/packages/loot-design/src/components/budget/rollover/rollover-components.js +++ b/packages/loot-design/src/components/budget/rollover/rollover-components.js @@ -1,7 +1,9 @@ import React, { useContext, useState } from 'react'; + import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import evalArithmetic from 'loot-core/src/shared/arithmetic'; import { rolloverBudget } from 'loot-core/src/client/queries'; + import { styles, colors } from '../../../style'; import { View, diff --git a/packages/loot-design/src/components/budget/util.js b/packages/loot-design/src/components/budget/util.js index 0eb439a..5f26fa8 100644 --- a/packages/loot-design/src/components/budget/util.js +++ b/packages/loot-design/src/components/budget/util.js @@ -1,4 +1,5 @@ import React from 'react'; + import { colors } from '../../style'; export let CategoryGroupsContext = React.createContext([]); diff --git a/packages/loot-design/src/components/common.js b/packages/loot-design/src/components/common.js index 1aea5a5..db86d08 100644 --- a/packages/loot-design/src/components/common.js +++ b/packages/loot-design/src/components/common.js @@ -5,9 +5,7 @@ import React, { useState, useCallback } from 'react'; -import { css } from 'glamor'; import mergeRefs from 'react-merge-refs'; -import hotkeys from 'hotkeys-js'; import ReactModal from 'react-modal'; import { Route, @@ -16,6 +14,9 @@ import { useHistory, useRouteMatch } from 'react-router-dom'; + +import { css } from 'glamor'; +import hotkeys from 'hotkeys-js'; import { ListboxInput, ListboxButton, @@ -23,11 +24,13 @@ import { ListboxList, ListboxOption } from '@reach/listbox'; -import { styles, colors } from '../style'; + import { integerToCurrency } from 'loot-core/src/shared/util'; +import ExpandArrow from 'loot-design/src/svg/ExpandArrow'; + +import { styles, colors } from '../style'; import Delete from '../svg/Delete'; import Loading from '../svg/v1/AnimatedLoading'; -import ExpandArrow from 'loot-design/src/svg/ExpandArrow'; import View from './View'; import Text from './Text'; import { useProperFocus } from './useProperFocus'; diff --git a/packages/loot-design/src/components/common.usage.js b/packages/loot-design/src/components/common.usage.js index d84fd0a..88f6fcf 100644 --- a/packages/loot-design/src/components/common.usage.js +++ b/packages/loot-design/src/components/common.usage.js @@ -1,5 +1,7 @@ import React from 'react'; + import Component from '@reactions/component'; + import { Section, TestModal } from '../guide/components'; import { Input, Modal, View, Button, Stack } from './common'; diff --git a/packages/loot-design/src/components/forms.js b/packages/loot-design/src/components/forms.js index 1697b3a..b37e997 100644 --- a/packages/loot-design/src/components/forms.js +++ b/packages/loot-design/src/components/forms.js @@ -1,5 +1,7 @@ import React from 'react'; + import { css } from 'glamor'; + import { View, Text } from './common'; import { colors } from '../style'; diff --git a/packages/loot-design/src/components/icons.usage.js b/packages/loot-design/src/components/icons.usage.js index e07424c..f7f313a 100644 --- a/packages/loot-design/src/components/icons.usage.js +++ b/packages/loot-design/src/components/icons.usage.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; + import { Section } from '../guide/components'; import { View, Button } from './common'; diff --git a/packages/loot-design/src/components/manager/BudgetList.js b/packages/loot-design/src/components/manager/BudgetList.js index 0ceee3e..13863b2 100644 --- a/packages/loot-design/src/components/manager/BudgetList.js +++ b/packages/loot-design/src/components/manager/BudgetList.js @@ -1,14 +1,16 @@ import React, { useState, useRef } from 'react'; + +import Key from 'loot-design/src/svg/v2/Key'; +import RefreshArrow from 'loot-design/src/svg/v2/RefreshArrow'; +import Loading from 'loot-design/src/svg/v1/AnimatedLoading'; + import { View, Text, Modal, Button, Tooltip, Menu } from '../common'; import { styles, colors } from '../../style'; import CloudCheck from '../../svg/v1/CloudCheck'; import CloudDownload from '../../svg/v1/CloudDownload'; import CloudUnknown from '../../svg/v2/CloudUnknown'; import FileDouble from '../../svg/v1/FileDouble'; -import Key from 'loot-design/src/svg/v2/Key'; import DotsHorizontalTriple from '../../svg/v1/DotsHorizontalTriple'; -import RefreshArrow from 'loot-design/src/svg/v2/RefreshArrow'; -import Loading from 'loot-design/src/svg/v1/AnimatedLoading'; function getFileDescription(file) { if (file.state === 'unknown') { diff --git a/packages/loot-design/src/components/manager/BudgetList.usage.js b/packages/loot-design/src/components/manager/BudgetList.usage.js index bbd358e..22c23f0 100644 --- a/packages/loot-design/src/components/manager/BudgetList.usage.js +++ b/packages/loot-design/src/components/manager/BudgetList.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Section, TestModal } from '../../guide/components'; import { colors } from '../../style'; import BudgetList from './BudgetList'; diff --git a/packages/loot-design/src/components/manager/DeleteFile.js b/packages/loot-design/src/components/manager/DeleteFile.js index 9a15d6b..16c523a 100644 --- a/packages/loot-design/src/components/manager/DeleteFile.js +++ b/packages/loot-design/src/components/manager/DeleteFile.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; + import { View, Text, Modal, ButtonWithLoading } from '../common'; import { colors } from '../../style'; diff --git a/packages/loot-design/src/components/manager/DeleteFile.usage.js b/packages/loot-design/src/components/manager/DeleteFile.usage.js index 7439513..645e491 100644 --- a/packages/loot-design/src/components/manager/DeleteFile.usage.js +++ b/packages/loot-design/src/components/manager/DeleteFile.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Section, TestModal } from '../../guide/components'; import { colors } from '../../style'; import DeleteFile from './DeleteFile'; diff --git a/packages/loot-design/src/components/manager/Import.js b/packages/loot-design/src/components/manager/Import.js index 5b02465..cbf39c8 100644 --- a/packages/loot-design/src/components/manager/Import.js +++ b/packages/loot-design/src/components/manager/Import.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; + import { View, Block, Modal, Button } from '../common'; import { styles, colors } from '../../style'; diff --git a/packages/loot-design/src/components/manager/Import.usage.js b/packages/loot-design/src/components/manager/Import.usage.js index e940db9..e1f278a 100644 --- a/packages/loot-design/src/components/manager/Import.usage.js +++ b/packages/loot-design/src/components/manager/Import.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Section, TestModal } from '../../guide/components'; import { colors } from '../../style'; import Import from './Import'; diff --git a/packages/loot-design/src/components/manager/ImportActual.js b/packages/loot-design/src/components/manager/ImportActual.js index a44926e..850bcde 100644 --- a/packages/loot-design/src/components/manager/ImportActual.js +++ b/packages/loot-design/src/components/manager/ImportActual.js @@ -1,6 +1,8 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; + import { importBudget } from 'loot-core/src/client/actions/budgets'; + import { View, Block, diff --git a/packages/loot-design/src/components/manager/ImportYNAB4.js b/packages/loot-design/src/components/manager/ImportYNAB4.js index dbe9f93..fcb4ed5 100644 --- a/packages/loot-design/src/components/manager/ImportYNAB4.js +++ b/packages/loot-design/src/components/manager/ImportYNAB4.js @@ -1,6 +1,8 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; + import { importBudget } from 'loot-core/src/client/actions/budgets'; + import { View, Block, Modal, Button, ButtonWithLoading, P } from '../common'; import { styles, colors } from '../../style'; diff --git a/packages/loot-design/src/components/manager/ImportYNAB5.js b/packages/loot-design/src/components/manager/ImportYNAB5.js index 009f2b6..c6929d9 100644 --- a/packages/loot-design/src/components/manager/ImportYNAB5.js +++ b/packages/loot-design/src/components/manager/ImportYNAB5.js @@ -1,6 +1,8 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; + import { importBudget } from 'loot-core/src/client/actions/budgets'; + import { View, Block, diff --git a/packages/loot-design/src/components/mobile/AmountInput.js b/packages/loot-design/src/components/mobile/AmountInput.js index 17bf4f8..14cfc6e 100644 --- a/packages/loot-design/src/components/mobile/AmountInput.js +++ b/packages/loot-design/src/components/mobile/AmountInput.js @@ -1,5 +1,4 @@ import React from 'react'; -import mitt from 'mitt'; import { View, Text, @@ -9,16 +8,20 @@ import { StyleSheet } from 'react-native'; import { RectButton } from 'react-native-gesture-handler'; -import { colors } from '../../style'; -import { KeyboardButton } from './common'; -import TextInputWithAccessory from './TextInputWithAccessory'; + +import mitt from 'mitt'; + import { toRelaxedNumber, amountToCurrency, getNumberFormat } from 'loot-core/src/shared/util'; -import MathIcon from '../../svg/Math'; import Platform from 'loot-core/src/client/platform'; + +import { colors } from '../../style'; +import { KeyboardButton } from './common'; +import TextInputWithAccessory from './TextInputWithAccessory'; +import MathIcon from '../../svg/Math'; import Add from '../../svg/v1/Add'; import Subtract from '../../svg/v1/Subtract'; import Equals from '../../svg/v1/Equals'; diff --git a/packages/loot-design/src/components/mobile/AndroidKeyboardAvoidingView.android.js b/packages/loot-design/src/components/mobile/AndroidKeyboardAvoidingView.android.js index ca9c332..d522fa5 100644 --- a/packages/loot-design/src/components/mobile/AndroidKeyboardAvoidingView.android.js +++ b/packages/loot-design/src/components/mobile/AndroidKeyboardAvoidingView.android.js @@ -1,5 +1,6 @@ import React, { useState, useEffect } from 'react'; import { KeyboardAvoidingView, NativeModules, Keyboard } from 'react-native'; + import { AmountAccessoryView } from 'loot-design/src/components/mobile/AmountInput'; import { BudgetAccessoryView } from 'loot-design/src/components/mobile/budget'; diff --git a/packages/loot-design/src/components/mobile/FocusAwareStatusBar.js b/packages/loot-design/src/components/mobile/FocusAwareStatusBar.js index a766fdc..cad53fd 100644 --- a/packages/loot-design/src/components/mobile/FocusAwareStatusBar.js +++ b/packages/loot-design/src/components/mobile/FocusAwareStatusBar.js @@ -1,5 +1,6 @@ import * as React from 'react'; import { StatusBar } from 'react-native'; + import { useIsFocused } from 'mobile/node_modules/@react-navigation/native'; export default function FocusAwareStatusBar(props) { diff --git a/packages/loot-design/src/components/mobile/TextInputWithAccessory.android.js b/packages/loot-design/src/components/mobile/TextInputWithAccessory.android.js index f283142..81e6c24 100644 --- a/packages/loot-design/src/components/mobile/TextInputWithAccessory.android.js +++ b/packages/loot-design/src/components/mobile/TextInputWithAccessory.android.js @@ -1,5 +1,6 @@ import React, { useContext } from 'react'; import { TextInput } from 'react-native'; + import { AccessoryIdContext } from './AndroidKeyboardAvoidingView'; export default React.forwardRef(function TextInputWithAccessory( diff --git a/packages/loot-design/src/components/mobile/account.js b/packages/loot-design/src/components/mobile/account.js index ae3a2fe..2e9bafb 100644 --- a/packages/loot-design/src/components/mobile/account.js +++ b/packages/loot-design/src/components/mobile/account.js @@ -1,5 +1,6 @@ import React, { useMemo } from 'react'; import { View, TextInput } from 'react-native'; + import CellValue from '../spreadsheet/CellValue'; import { TransactionList } from './transaction'; import Search from '../../svg/v1/Search'; diff --git a/packages/loot-design/src/components/mobile/account.usage.js b/packages/loot-design/src/components/mobile/account.usage.js index 5a6af0a..c27b241 100644 --- a/packages/loot-design/src/components/mobile/account.usage.js +++ b/packages/loot-design/src/components/mobile/account.usage.js @@ -1,6 +1,8 @@ import React from 'react'; -import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; + import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; + +import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; import { MobileSection, WithHeader } from '../../guide/components'; import { accounts, categories, transactions } from './accounts.usage'; import { AccountDetails } from './account'; diff --git a/packages/loot-design/src/components/mobile/accounts.js b/packages/loot-design/src/components/mobile/accounts.js index a95c55b..88da1f1 100644 --- a/packages/loot-design/src/components/mobile/accounts.js +++ b/packages/loot-design/src/components/mobile/accounts.js @@ -1,7 +1,9 @@ import React from 'react'; import { View, Text } from 'react-native'; import { RectButton } from 'react-native-gesture-handler'; + import { prettyAccountType } from 'loot-core/src/shared/accounts'; + import { Button, TextOneLine } from './common'; import { TransactionList } from './transaction'; import CellValue from '../spreadsheet/CellValue'; diff --git a/packages/loot-design/src/components/mobile/accounts.usage.js b/packages/loot-design/src/components/mobile/accounts.usage.js index 6abd0ef..f889e76 100644 --- a/packages/loot-design/src/components/mobile/accounts.usage.js +++ b/packages/loot-design/src/components/mobile/accounts.usage.js @@ -1,14 +1,16 @@ import React from 'react'; -import { MobileSection } from '../../guide/components'; -import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; + import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; -import { AccountList } from './accounts'; import { generateAccount, generateCategory, generateTransaction } from 'loot-core/src/mocks'; +import { MobileSection } from '../../guide/components'; +import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; +import { AccountList } from './accounts'; + export const accounts = [ generateAccount('Bank of America', false, null, false), generateAccount('Wells Fargo', false, null, true), diff --git a/packages/loot-design/src/components/mobile/alerts.js b/packages/loot-design/src/components/mobile/alerts.js index 12bf8bf..cb5fa9c 100644 --- a/packages/loot-design/src/components/mobile/alerts.js +++ b/packages/loot-design/src/components/mobile/alerts.js @@ -1,5 +1,6 @@ import React from 'react'; import { View, Text } from 'react-native'; + import InformationSolid from 'loot-design/src/svg/v1/InformationOutline'; import { styles, colors } from 'loot-design/src/style'; diff --git a/packages/loot-design/src/components/mobile/budget.js b/packages/loot-design/src/components/mobile/budget.js index 65033ff..3b5e080 100644 --- a/packages/loot-design/src/components/mobile/budget.js +++ b/packages/loot-design/src/components/mobile/budget.js @@ -14,10 +14,15 @@ import { NativeViewGestureHandler } from 'react-native-gesture-handler'; import Animated, { Easing } from 'react-native-reanimated'; -import AndroidKeyboardAvoidingView from './AndroidKeyboardAvoidingView'; + +import memoizeOne from 'memoize-one'; + import { amountToInteger, integerToAmount } from 'loot-core/src/shared/util'; import * as monthUtils from 'loot-core/src/shared/months'; -import memoizeOne from 'memoize-one'; +import Platform from 'loot-core/src/client/platform'; +import { rolloverBudget, reportBudget } from 'loot-core/src/client/queries'; + +import AndroidKeyboardAvoidingView from './AndroidKeyboardAvoidingView'; import CellValue from '../spreadsheet/CellValue'; import SheetValue from '../spreadsheet/SheetValue'; import useSheetValue from '../spreadsheet/useSheetValue'; @@ -25,15 +30,12 @@ import { colors, mobileStyles as styles } from '../../style'; import format from '../spreadsheet/format'; import { Button, KeyboardButton, Card, Label } from './common'; import { ListItem, ROW_HEIGHT } from './table'; -import Platform from 'loot-core/src/client/platform'; import NamespaceContext from '../spreadsheet/NamespaceContext'; import AmountInput, { MathOperations, AmountAccessoryContext } from './AmountInput'; import { DragDrop, Draggable, Droppable, DragDropHighlight } from './dragdrop'; -import { rolloverBudget, reportBudget } from 'loot-core/src/client/queries'; - import ArrowThinLeft from '../../svg/v1/ArrowThinLeft'; import ArrowThinRight from '../../svg/v1/ArrowThinRight'; import ArrowThinUp from '../../svg/v1/ArrowThinUp'; diff --git a/packages/loot-design/src/components/mobile/budget.test.js b/packages/loot-design/src/components/mobile/budget.test.js index 3fd5929..ea71e35 100644 --- a/packages/loot-design/src/components/mobile/budget.test.js +++ b/packages/loot-design/src/components/mobile/budget.test.js @@ -1,12 +1,15 @@ import React from 'react'; + import { render, fireEvent } from '@testing-library/react'; + +import * as monthUtils from 'loot-core/src/shared/months'; +import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; + import { MobileScreen } from '../../guide/components'; import { categories, categoryGroups } from './budget.usage'; import { BudgetTable, BudgetAccessoryView } from './budget'; import InputAccessoryView from './InputAccessoryView'; import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; -import * as monthUtils from 'loot-core/src/shared/months'; -import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; function makeLoadedSpreadsheet() { let spreadsheet = makeSpreadsheet(); diff --git a/packages/loot-design/src/components/mobile/budget.usage.js b/packages/loot-design/src/components/mobile/budget.usage.js index 6c9b907..01d268e 100644 --- a/packages/loot-design/src/components/mobile/budget.usage.js +++ b/packages/loot-design/src/components/mobile/budget.usage.js @@ -1,11 +1,13 @@ import React from 'react'; import { View } from 'react-native'; + +import { generateCategoryGroups } from 'loot-core/src/mocks'; +import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; + import { MobileSection } from '../../guide/components'; import { BudgetTable, BudgetAccessoryView } from './budget'; import InputAccessoryView from './InputAccessoryView'; -import { generateCategoryGroups } from 'loot-core/src/mocks'; import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; -import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; export const categoryGroups = generateCategoryGroups([ { diff --git a/packages/loot-design/src/components/mobile/common.js b/packages/loot-design/src/components/mobile/common.js index 9f4298b..cb533ee 100644 --- a/packages/loot-design/src/components/mobile/common.js +++ b/packages/loot-design/src/components/mobile/common.js @@ -1,6 +1,7 @@ import React from 'react'; import { Text, View } from 'react-native'; import { RectButton } from 'react-native-gesture-handler'; + import { styles, colors } from '../../style'; import Loading from '../../svg/v1/AnimatedLoading'; diff --git a/packages/loot-design/src/components/mobile/dragdrop.js b/packages/loot-design/src/components/mobile/dragdrop.js index 959af4d..d8372c0 100644 --- a/packages/loot-design/src/components/mobile/dragdrop.js +++ b/packages/loot-design/src/components/mobile/dragdrop.js @@ -9,6 +9,7 @@ import React, { import { View, findNodeHandle } from 'react-native'; import { State, LongPressGestureHandler } from 'react-native-gesture-handler'; import Animated from 'react-native-reanimated'; + import { colors } from '../../style'; export const DragDropContext = React.createContext(null); diff --git a/packages/loot-design/src/components/mobile/forms.js b/packages/loot-design/src/components/mobile/forms.js index 1ea1436..1fe6877 100644 --- a/packages/loot-design/src/components/mobile/forms.js +++ b/packages/loot-design/src/components/mobile/forms.js @@ -1,6 +1,7 @@ import React from 'react'; import { View, Text, TextInput, Switch } from 'react-native'; import { RectButton } from 'react-native-gesture-handler'; + import { colors } from '../../style'; export const EDITING_PADDING = 12; diff --git a/packages/loot-design/src/components/mobile/table.js b/packages/loot-design/src/components/mobile/table.js index a35d157..82eebf8 100644 --- a/packages/loot-design/src/components/mobile/table.js +++ b/packages/loot-design/src/components/mobile/table.js @@ -1,8 +1,10 @@ import React from 'react'; import { View } from 'react-native'; -import { colors } from '../../style'; + import Platform from 'loot-core/src/client/platform'; +import { colors } from '../../style'; + export const ROW_HEIGHT = 50; export const ListItem = React.forwardRef( diff --git a/packages/loot-design/src/components/mobile/transaction.js b/packages/loot-design/src/components/mobile/transaction.js index fcedc83..6b8cc91 100644 --- a/packages/loot-design/src/components/mobile/transaction.js +++ b/packages/loot-design/src/components/mobile/transaction.js @@ -1,5 +1,7 @@ import React from 'react'; import { View, Text, SectionList, ScrollView, Animated } from 'react-native'; +import { Swipeable, RectButton } from 'react-native-gesture-handler'; + import memoizeOne from 'memoize-one'; import { format as formatDate, @@ -7,7 +9,7 @@ import { parseISO, isValid as isValidDate } from 'date-fns'; -import { Swipeable, RectButton } from 'react-native-gesture-handler'; + import * as monthUtils from 'loot-core/src/shared/months'; import { splitTransaction, @@ -23,6 +25,8 @@ import { amountToInteger, groupById } from 'loot-core/src/shared/util'; +import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize'; + import KeyboardAvoidingView from './KeyboardAvoidingView'; import { ListItem } from './table'; import { Button, TextOneLine } from './common'; @@ -39,11 +43,9 @@ import { BooleanField, EDITING_PADDING } from './forms'; - import EditSkull1 from '../../svg/v2/EditSkull1'; import AlertTriangle from '../../svg/v2/AlertTriangle'; import CheckCircle1 from '../../svg/v2/CheckCircle1'; -import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize'; let getPayeesById = memoizeOne(payees => groupById(payees)); let getAccountsById = memoizeOne(accounts => groupById(accounts)); diff --git a/packages/loot-design/src/components/mobile/transaction.usage.js b/packages/loot-design/src/components/mobile/transaction.usage.js index 90830f9..669c48f 100644 --- a/packages/loot-design/src/components/mobile/transaction.usage.js +++ b/packages/loot-design/src/components/mobile/transaction.usage.js @@ -1,12 +1,14 @@ import React from 'react'; -import { Section, MobileSection } from '../../guide/components'; + import * as monthUtils from 'loot-core/src/shared/months'; -import { TransactionList, TransactionEdit } from './transaction'; import { generateAccount, generateCategory, generateTransaction } from 'loot-core/src/mocks'; + +import { Section, MobileSection } from '../../guide/components'; +import { TransactionList, TransactionEdit } from './transaction'; import { colors } from '../../style'; export const accounts = [generateAccount('Checking')]; diff --git a/packages/loot-design/src/components/modals/CloseAccount.js b/packages/loot-design/src/components/modals/CloseAccount.js index b53a8b3..f1963ae 100644 --- a/packages/loot-design/src/components/modals/CloseAccount.js +++ b/packages/loot-design/src/components/modals/CloseAccount.js @@ -1,7 +1,10 @@ import React, { useState } from 'react'; + import { Formik } from 'formik'; -import { View, Text, Modal, Button, P, Select, FormError } from '../common'; + import { integerToCurrency } from 'loot-core/src/shared/util'; + +import { View, Text, Modal, Button, P, Select, FormError } from '../common'; import { colors } from '../../style'; function needsCategory(account, currentTransfer, accounts) { diff --git a/packages/loot-design/src/components/modals/CloseAccount.usage.js b/packages/loot-design/src/components/modals/CloseAccount.usage.js index c191aad..8ef5fc2 100644 --- a/packages/loot-design/src/components/modals/CloseAccount.usage.js +++ b/packages/loot-design/src/components/modals/CloseAccount.usage.js @@ -1,8 +1,10 @@ import React from 'react'; import { MemoryRouter as Router } from 'react-router-dom'; + +import { generateAccount, generateCategoryGroups } from 'loot-core/src/mocks'; + import { Section, TestModal } from '../../guide/components'; import CloseAccount from './CloseAccount'; -import { generateAccount, generateCategoryGroups } from 'loot-core/src/mocks'; const accounts = [ generateAccount('Bank of America', null, null, false), diff --git a/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.js b/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.js index eeb1bc0..045df62 100644 --- a/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.js +++ b/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.js @@ -1,6 +1,5 @@ import React, { useState } from 'react'; -import { View, Text, Modal, Button } from '../common'; -import { styles, colors } from '../../style'; + import { fromPlaidAccountType, determineOffBudget, @@ -8,6 +7,9 @@ import { } from 'loot-core/src/shared/accounts'; import Checkmark from 'loot-design/src/svg/v1/Checkmark'; +import { View, Text, Modal, Button } from '../common'; +import { styles, colors } from '../../style'; + function EmptyMessage() { return null; } diff --git a/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.usage.js b/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.usage.js index 4d7cf3c..faa6fd3 100644 --- a/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.usage.js +++ b/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Section, TestModal } from '../../guide/components'; import ConfigureLinkedAccounts from './ConfigureLinkedAccounts'; diff --git a/packages/loot-design/src/components/modals/CreateLocalAccount.js b/packages/loot-design/src/components/modals/CreateLocalAccount.js index 459f4e1..b5d59b8 100644 --- a/packages/loot-design/src/components/modals/CreateLocalAccount.js +++ b/packages/loot-design/src/components/modals/CreateLocalAccount.js @@ -1,6 +1,10 @@ import React from 'react'; + +import { Formik } from 'formik'; + import { toRelaxedNumber } from 'loot-core/src/shared/util'; import { determineOffBudget } from 'loot-core/src/shared/accounts'; + import { View, Modal, @@ -13,7 +17,6 @@ import { FormError, InitialFocus } from '../common'; -import { Formik } from 'formik'; function CreateLocalAccount({ modalProps, actions, history }) { return ( diff --git a/packages/loot-design/src/components/modals/CreateLocalAccount.usage.js b/packages/loot-design/src/components/modals/CreateLocalAccount.usage.js index 8335b96..6533a22 100644 --- a/packages/loot-design/src/components/modals/CreateLocalAccount.usage.js +++ b/packages/loot-design/src/components/modals/CreateLocalAccount.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Section, TestModal } from '../../guide/components'; import CreateLocalAccount from './CreateLocalAccount'; diff --git a/packages/loot-design/src/components/modals/EditField.js b/packages/loot-design/src/components/modals/EditField.js index 24bff28..5d9e269 100644 --- a/packages/loot-design/src/components/modals/EditField.js +++ b/packages/loot-design/src/components/modals/EditField.js @@ -1,9 +1,12 @@ import React, { useRef } from 'react'; import { connect } from 'react-redux'; + import { parseISO, format as formatDate, parse as parseDate } from 'date-fns'; + import * as actions from 'loot-core/src/client/actions'; import { amountToInteger } from 'loot-core/src/shared/util'; import { currentDay, dayFromDate } from 'loot-core/src/shared/months'; + import { View, Modal, Input } from '../common'; import DateSelect from '../DateSelect'; import CategoryAutocomplete from '../CategorySelect'; diff --git a/packages/loot-design/src/components/modals/ImportTransactions.js b/packages/loot-design/src/components/modals/ImportTransactions.js index ce2df1c..2972847 100644 --- a/packages/loot-design/src/components/modals/ImportTransactions.js +++ b/packages/loot-design/src/components/modals/ImportTransactions.js @@ -1,6 +1,8 @@ import React, { useState, useEffect, useMemo } from 'react'; import { connect } from 'react-redux'; + import * as d from 'date-fns'; + import * as actions from 'loot-core/src/client/actions'; import { format as formatDate_ } from 'loot-core/src/shared/months'; import { @@ -8,6 +10,7 @@ import { amountToInteger, looselyParseAmount } from 'loot-core/src/shared/util'; + import { View, Text, diff --git a/packages/loot-design/src/components/modals/ImportTransactions.usage.js b/packages/loot-design/src/components/modals/ImportTransactions.usage.js index e59f1c4..922d472 100644 --- a/packages/loot-design/src/components/modals/ImportTransactions.usage.js +++ b/packages/loot-design/src/components/modals/ImportTransactions.usage.js @@ -1,8 +1,10 @@ import React from 'react'; + import { TestProvider } from 'loot-core/src/mocks/redux'; +import { generateTransactions } from 'loot-core/src/mocks'; + import { Section, TestModal } from '../../guide/components'; import { ImportTransactions } from './ImportTransactions'; -import { generateTransactions } from 'loot-core/src/mocks'; let transactions = generateTransactions(20, 'acct', 'group'); // The mocks generate "internal" transactions... but we need the diff --git a/packages/loot-design/src/components/modals/LoadBackup.js b/packages/loot-design/src/components/modals/LoadBackup.js index 9548020..8eb66d9 100644 --- a/packages/loot-design/src/components/modals/LoadBackup.js +++ b/packages/loot-design/src/components/modals/LoadBackup.js @@ -1,4 +1,5 @@ import React from 'react'; + import { View, Text, Block, Modal, Button } from '../common'; import { Row, Cell } from '../table'; import { colors } from '../../style'; diff --git a/packages/loot-design/src/components/modals/LoadBackup.usage.js b/packages/loot-design/src/components/modals/LoadBackup.usage.js index ed7b92b..bed8369 100644 --- a/packages/loot-design/src/components/modals/LoadBackup.usage.js +++ b/packages/loot-design/src/components/modals/LoadBackup.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Section, TestModal } from '../../guide/components'; import { colors } from '../../style'; import LoadBackup from './LoadBackup'; diff --git a/packages/loot-design/src/components/modals/PlaidExternalMsg.js b/packages/loot-design/src/components/modals/PlaidExternalMsg.js index edfbb32..0bbce03 100644 --- a/packages/loot-design/src/components/modals/PlaidExternalMsg.js +++ b/packages/loot-design/src/components/modals/PlaidExternalMsg.js @@ -1,4 +1,5 @@ import React, { useState, useRef } from 'react'; + import { View, Text, Modal, Button, P, ModalButtons } from '../common'; import { Error } from '../alerts'; import { colors } from '../../style'; diff --git a/packages/loot-design/src/components/modals/PlaidExternalMsg.usage.js b/packages/loot-design/src/components/modals/PlaidExternalMsg.usage.js index 0c363e8..3ebde8f 100644 --- a/packages/loot-design/src/components/modals/PlaidExternalMsg.usage.js +++ b/packages/loot-design/src/components/modals/PlaidExternalMsg.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Section, TestModal } from '../../guide/components'; import PlaidExternalMsg from './PlaidExternalMsg'; diff --git a/packages/loot-design/src/components/modals/SelectLinkedAccounts.js b/packages/loot-design/src/components/modals/SelectLinkedAccounts.js index 862f3bf..3cba119 100644 --- a/packages/loot-design/src/components/modals/SelectLinkedAccounts.js +++ b/packages/loot-design/src/components/modals/SelectLinkedAccounts.js @@ -1,11 +1,13 @@ import React, { useState } from 'react'; -import { styles, colors } from '../../style'; -import { View, Text, Modal, P, Button } from '../common'; + import { fromPlaidAccountType, prettyAccountType } from 'loot-core/src/shared/accounts'; +import { styles, colors } from '../../style'; +import { View, Text, Modal, P, Button } from '../common'; + let selectedStyle = { color: colors.n1 }; diff --git a/packages/loot-design/src/components/modals/SelectLinkedAccounts.usage.js b/packages/loot-design/src/components/modals/SelectLinkedAccounts.usage.js index 6b2ec16..2b59478 100644 --- a/packages/loot-design/src/components/modals/SelectLinkedAccounts.usage.js +++ b/packages/loot-design/src/components/modals/SelectLinkedAccounts.usage.js @@ -1,4 +1,5 @@ import React from 'react'; + import { Section, TestModal } from '../../guide/components'; import SelectLinkedAccounts from './SelectLinkedAccounts'; diff --git a/packages/loot-design/src/components/payees.js b/packages/loot-design/src/components/payees.js index e917ea7..7805975 100644 --- a/packages/loot-design/src/components/payees.js +++ b/packages/loot-design/src/components/payees.js @@ -7,6 +7,12 @@ import React, { useCallback, useImperativeHandle } from 'react'; + +import memoizeOne from 'memoize-one'; +import Component from '@reactions/component'; + +import { groupById } from 'loot-core/src/shared/util'; + import { useStableCallback, View, @@ -17,9 +23,6 @@ import { Tooltip, Menu } from './common'; -import memoizeOne from 'memoize-one'; -import Component from '@reactions/component'; -import { groupById } from 'loot-core/src/shared/util'; import { colors } from '../style'; import { Table, diff --git a/packages/loot-design/src/components/payees.usage.js b/packages/loot-design/src/components/payees.usage.js index c40aa48..e6c439d 100644 --- a/packages/loot-design/src/components/payees.usage.js +++ b/packages/loot-design/src/components/payees.usage.js @@ -1,10 +1,13 @@ import React from 'react'; + import Component from '@reactions/component'; -import { Section, TestModal } from './../guide/components'; -import { ManagePayees } from './payees'; + import { applyChanges } from 'loot-core/src/shared/util'; import { TestProvider } from 'loot-core/src/mocks/redux'; +import { Section, TestModal } from '../guide/components'; +import { ManagePayees } from './payees'; + let categoryGroups = [ { id: 'foo', diff --git a/packages/loot-design/src/components/sidebar.js b/packages/loot-design/src/components/sidebar.js index 1a7a826..a03f3c7 100644 --- a/packages/loot-design/src/components/sidebar.js +++ b/packages/loot-design/src/components/sidebar.js @@ -1,7 +1,14 @@ import React, { useState, useMemo } from 'react'; import { useDispatch } from 'react-redux'; import { withRouter } from 'react-router-dom'; + import { css } from 'glamor'; + +import { pushModal } from 'loot-core/src/client/actions/modals'; +import { closeBudget } from 'loot-core/src/client/actions/budgets'; +import Platform from 'loot-core/src/client/platform'; +import PiggyBank from 'loot-design/src/svg/v1/PiggyBank'; + import { View, Block, @@ -12,9 +19,6 @@ import { Menu, Tooltip } from './common'; -import { pushModal } from 'loot-core/src/client/actions/modals'; -import { closeBudget } from 'loot-core/src/client/actions/budgets'; -import Platform from 'loot-core/src/client/platform'; import CellValue from './spreadsheet/CellValue'; import Add from '../svg/v1/Add'; import CalendarIcon from '../svg/v2/Calendar'; @@ -22,10 +26,8 @@ import { styles, colors } from '../style'; import Wallet from '../svg/v1/Wallet'; import Reports from '../svg/v1/Reports'; import ArrowButtonLeft1 from '../svg/v2/ArrowButtonLeft1'; -import PiggyBank from 'loot-design/src/svg/v1/PiggyBank'; import Cog from '../svg/v1/Cog'; import DotsHorizontalTriple from '../svg/v1/DotsHorizontalTriple'; - import { useDraggable, useDroppable, DropHighlight } from './sort.js'; export const SIDEBAR_WIDTH = 240; diff --git a/packages/loot-design/src/components/sidebar.usage.js b/packages/loot-design/src/components/sidebar.usage.js index 5c4f0e5..242fa25 100644 --- a/packages/loot-design/src/components/sidebar.usage.js +++ b/packages/loot-design/src/components/sidebar.usage.js @@ -1,14 +1,17 @@ import React from 'react'; -import lively from '@jlongster/lively'; import { MemoryRouter as Router } from 'react-router-dom'; import { DndProvider } from 'react-dnd'; import Backend from 'react-dnd-html5-backend'; -import SpreadsheetContext from './spreadsheet/SpreadsheetContext'; + +import lively from '@jlongster/lively'; + import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; -import { Sidebar } from './sidebar'; -import { Section } from '../guide/components'; import { generateAccount } from 'loot-core/src/mocks'; +import SpreadsheetContext from './spreadsheet/SpreadsheetContext'; +import { Section } from '../guide/components'; +import { Sidebar } from './sidebar'; + function withState(state, render) { const Component = lively(render, { getInitialState: () => state }); return ; diff --git a/packages/loot-design/src/components/sort.js b/packages/loot-design/src/components/sort.js index 8890193..23ea0ed 100644 --- a/packages/loot-design/src/components/sort.js +++ b/packages/loot-design/src/components/sort.js @@ -7,6 +7,7 @@ import React, { useContext } from 'react'; import { useDrag, useDrop } from 'react-dnd'; + import { colors } from '../style'; import { View } from './common'; diff --git a/packages/loot-design/src/components/spreadsheet/CellDebugger.js b/packages/loot-design/src/components/spreadsheet/CellDebugger.js index 1339ced..5eec18b 100644 --- a/packages/loot-design/src/components/spreadsheet/CellDebugger.js +++ b/packages/loot-design/src/components/spreadsheet/CellDebugger.js @@ -1,4 +1,5 @@ import React, { Component } from 'react'; + import * as spreadsheet from '../../sheetql/spreadsheet'; class CellDebugger extends Component { diff --git a/packages/loot-design/src/components/spreadsheet/CellValue.js b/packages/loot-design/src/components/spreadsheet/CellValue.js index 521bae9..ffd4501 100644 --- a/packages/loot-design/src/components/spreadsheet/CellValue.js +++ b/packages/loot-design/src/components/spreadsheet/CellValue.js @@ -1,4 +1,5 @@ import React from 'react'; + import format from './format'; import SheetValue from './SheetValue'; import Text from '../Text'; diff --git a/packages/loot-design/src/components/spreadsheet/SheetValue.js b/packages/loot-design/src/components/spreadsheet/SheetValue.js index 48e0ceb..9f09f6c 100644 --- a/packages/loot-design/src/components/spreadsheet/SheetValue.js +++ b/packages/loot-design/src/components/spreadsheet/SheetValue.js @@ -1,4 +1,5 @@ import { useContext, useState, useRef, useLayoutEffect } from 'react'; + import NamespaceContext from './NamespaceContext.js'; import SpreadsheetContext from './SpreadsheetContext'; diff --git a/packages/loot-design/src/components/spreadsheet/useSheetValue.js b/packages/loot-design/src/components/spreadsheet/useSheetValue.js index 6ed20ef..afb634d 100644 --- a/packages/loot-design/src/components/spreadsheet/useSheetValue.js +++ b/packages/loot-design/src/components/spreadsheet/useSheetValue.js @@ -1,4 +1,5 @@ import { useContext, useState, useRef, useLayoutEffect } from 'react'; + import NamespaceContext from './NamespaceContext.js'; import SpreadsheetContext from './SpreadsheetContext'; diff --git a/packages/loot-design/src/components/table.js b/packages/loot-design/src/components/table.js index 4ff5922..703b2c5 100644 --- a/packages/loot-design/src/components/table.js +++ b/packages/loot-design/src/components/table.js @@ -9,8 +9,10 @@ import React, { useMemo } from 'react'; import { useStore } from 'react-redux'; -import { scope } from '@jlongster/lively'; import AutoSizer from 'react-virtualized-auto-sizer'; + +import { scope } from '@jlongster/lively'; + import { FixedSizeList } from './FixedSizeList'; import { styles, colors } from '../style'; import DeleteIcon from '../svg/Delete'; diff --git a/packages/loot-design/src/components/table.usage.js b/packages/loot-design/src/components/table.usage.js index 04efe45..c7bc5a0 100644 --- a/packages/loot-design/src/components/table.usage.js +++ b/packages/loot-design/src/components/table.usage.js @@ -1,4 +1,5 @@ import React, { useState } from 'react'; + import { Section, Component } from '../guide/components'; import { View, Text } from './common'; import { @@ -8,6 +9,7 @@ import { InputCell, useTableNavigator } from './table'; + let uuid = require('loot-core/src/platform/uuid'); function PersonRow({ person, editing, focusedField, onEdit, onUpdate }) { diff --git a/packages/loot-design/src/components/tooltips.js b/packages/loot-design/src/components/tooltips.js index acd99d3..1543446 100644 --- a/packages/loot-design/src/components/tooltips.js +++ b/packages/loot-design/src/components/tooltips.js @@ -1,6 +1,8 @@ import React, { useState } from 'react'; import ReactDOM from 'react-dom'; + import { css, before } from 'glamor'; + import { styles } from '../style'; export const IntersectionBoundary = React.createContext(); diff --git a/packages/loot-design/src/components/useSelected.js b/packages/loot-design/src/components/useSelected.js index 045b9cb..a2b8783 100644 --- a/packages/loot-design/src/components/useSelected.js +++ b/packages/loot-design/src/components/useSelected.js @@ -5,11 +5,13 @@ import React, { useEffect, useRef } from 'react'; -import { hasModifierKey } from '../util/keys'; import { useSelector } from 'react-redux'; + import * as undo from 'loot-core/src/platform/client/undo'; import { listen } from 'loot-core/src/platform/client/fetch'; +import { hasModifierKey } from '../util/keys'; + function iterateRange(range, func) { let from = Math.min(range.start, range.end); let to = Math.max(range.start, range.end); diff --git a/packages/loot-design/src/guide/components.js b/packages/loot-design/src/guide/components.js index 9f4a7ca..2d2e392 100644 --- a/packages/loot-design/src/guide/components.js +++ b/packages/loot-design/src/guide/components.js @@ -1,4 +1,5 @@ import React from 'react'; + import { css } from 'glamor'; export function Section({ diff --git a/packages/loot-design/src/guide/document.js b/packages/loot-design/src/guide/document.js index 9c75893..0ac8aa0 100644 --- a/packages/loot-design/src/guide/document.js +++ b/packages/loot-design/src/guide/document.js @@ -1,6 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; import { Text, View, render as renderReactNative } from 'react-native'; + import Platform from 'loot-core/src/client/platform'; import { TestProvider } from 'loot-core/src/mocks/redux'; diff --git a/packages/loot-design/src/guide/mocks/react-native-reanimated.js b/packages/loot-design/src/guide/mocks/react-native-reanimated.js index 1c1080e..0840c4b 100644 --- a/packages/loot-design/src/guide/mocks/react-native-reanimated.js +++ b/packages/loot-design/src/guide/mocks/react-native-reanimated.js @@ -1,5 +1,6 @@ import React from 'react'; import { ScrollView } from 'react-native'; + import makeMockObject from './makeMockObject'; let NoopComponent = React.forwardRef(({ children }, ref) => children); diff --git a/packages/loot-design/src/index.js b/packages/loot-design/src/index.js index 6aae266..00d88e3 100644 --- a/packages/loot-design/src/index.js +++ b/packages/loot-design/src/index.js @@ -1,6 +1,7 @@ -import renderDocument from './guide/document'; import { plugins } from 'glamor'; +import renderDocument from './guide/document'; + plugins.clear(); renderDocument(document.getElementById('root')); diff --git a/packages/loot-design/src/setupTests.js b/packages/loot-design/src/setupTests.js index 27fad9d..444eeee 100644 --- a/packages/loot-design/src/setupTests.js +++ b/packages/loot-design/src/setupTests.js @@ -1,5 +1,6 @@ import { fireEvent } from '@testing-library/react'; import { act } from 'react-dom/test-utils'; + import { resetStore } from 'loot-core/src/mocks/redux'; const uuid = require('loot-core/src/platform/uuid'); diff --git a/packages/loot-design/src/svg/Add.web.js b/packages/loot-design/src/svg/Add.web.js index ad94f41..64e6b2f 100644 --- a/packages/loot-design/src/svg/Add.web.js +++ b/packages/loot-design/src/svg/Add.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Add({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/AnimatedLoading.mobile.js b/packages/loot-design/src/svg/AnimatedLoading.mobile.js index 42e4007..ef5906a 100644 --- a/packages/loot-design/src/svg/AnimatedLoading.mobile.js +++ b/packages/loot-design/src/svg/AnimatedLoading.mobile.js @@ -1,7 +1,8 @@ import React from 'react'; -import Loading from './Loading'; import { Animated, Easing } from 'react-native'; +import Loading from './Loading'; + class AnimatedLoading extends React.Component { constructor() { super(); diff --git a/packages/loot-design/src/svg/AnimatedLoading.web.js b/packages/loot-design/src/svg/AnimatedLoading.web.js index 11cd0b1..2f5398a 100644 --- a/packages/loot-design/src/svg/AnimatedLoading.web.js +++ b/packages/loot-design/src/svg/AnimatedLoading.web.js @@ -1,7 +1,9 @@ import React from 'react'; -import Loading from './Loading'; + import { css } from 'glamor'; +import Loading from './Loading'; + const rotation = css.keyframes({ '0%': { transform: 'rotate(-90deg)' }, '100%': { transform: 'rotate(666deg)' } diff --git a/packages/loot-design/src/svg/Bank.web.js b/packages/loot-design/src/svg/Bank.web.js index 3fe1b04..11a5042 100644 --- a/packages/loot-design/src/svg/Bank.web.js +++ b/packages/loot-design/src/svg/Bank.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Bank({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Budget.web.js b/packages/loot-design/src/svg/Budget.web.js index 6fb2f2d..92e42b5 100644 --- a/packages/loot-design/src/svg/Budget.web.js +++ b/packages/loot-design/src/svg/Budget.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Budget({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Check.web.js b/packages/loot-design/src/svg/Check.web.js index e6eff90..c0b6e2e 100644 --- a/packages/loot-design/src/svg/Check.web.js +++ b/packages/loot-design/src/svg/Check.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Check({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Delete.web.js b/packages/loot-design/src/svg/Delete.web.js index 8d52dc0..b9f82b1 100644 --- a/packages/loot-design/src/svg/Delete.web.js +++ b/packages/loot-design/src/svg/Delete.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Delete({ width, height, style, color = 'currentColor', ...props }) { diff --git a/packages/loot-design/src/svg/DownArrow.web.js b/packages/loot-design/src/svg/DownArrow.web.js index cc0c907..864c7f8 100644 --- a/packages/loot-design/src/svg/DownArrow.web.js +++ b/packages/loot-design/src/svg/DownArrow.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function DownArrow({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/DragIOS.web.js b/packages/loot-design/src/svg/DragIOS.web.js index 61c25bf..81b1985 100644 --- a/packages/loot-design/src/svg/DragIOS.web.js +++ b/packages/loot-design/src/svg/DragIOS.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function DragIos({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/ExpandArrow.web.js b/packages/loot-design/src/svg/ExpandArrow.web.js index 85bcc37..77c032c 100644 --- a/packages/loot-design/src/svg/ExpandArrow.web.js +++ b/packages/loot-design/src/svg/ExpandArrow.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function ExpandArrow({ diff --git a/packages/loot-design/src/svg/LeftArrow.web.js b/packages/loot-design/src/svg/LeftArrow.web.js index de28071..24d2212 100644 --- a/packages/loot-design/src/svg/LeftArrow.web.js +++ b/packages/loot-design/src/svg/LeftArrow.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function LeftArrow({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/LeftArrow2.web.js b/packages/loot-design/src/svg/LeftArrow2.web.js index 7d56e5e..f8d3b45 100644 --- a/packages/loot-design/src/svg/LeftArrow2.web.js +++ b/packages/loot-design/src/svg/LeftArrow2.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function LeftArrow2({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/LeftArrow3.web.js b/packages/loot-design/src/svg/LeftArrow3.web.js index 0689982..6ba48fe 100644 --- a/packages/loot-design/src/svg/LeftArrow3.web.js +++ b/packages/loot-design/src/svg/LeftArrow3.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; let x =
; diff --git a/packages/loot-design/src/svg/Loading.web.js b/packages/loot-design/src/svg/Loading.web.js index 82839ac..d6d8798 100644 --- a/packages/loot-design/src/svg/Loading.web.js +++ b/packages/loot-design/src/svg/Loading.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Loading({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Logo.web.js b/packages/loot-design/src/svg/Logo.web.js index e219de3..dbb2b31 100644 --- a/packages/loot-design/src/svg/Logo.web.js +++ b/packages/loot-design/src/svg/Logo.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Logo({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Math.web.js b/packages/loot-design/src/svg/Math.web.js index e61967e..885e134 100644 --- a/packages/loot-design/src/svg/Math.web.js +++ b/packages/loot-design/src/svg/Math.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Math({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Pencil.web.js b/packages/loot-design/src/svg/Pencil.web.js index 1e82041..b6b4f02 100644 --- a/packages/loot-design/src/svg/Pencil.web.js +++ b/packages/loot-design/src/svg/Pencil.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Pencil({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Reports.web.js b/packages/loot-design/src/svg/Reports.web.js index 4dcc521..f7f58ca 100644 --- a/packages/loot-design/src/svg/Reports.web.js +++ b/packages/loot-design/src/svg/Reports.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Reports({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/RightArrow.web.js b/packages/loot-design/src/svg/RightArrow.web.js index 2b1c7d1..97faa57 100644 --- a/packages/loot-design/src/svg/RightArrow.web.js +++ b/packages/loot-design/src/svg/RightArrow.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function RightArrow({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/RightArrow2.web.js b/packages/loot-design/src/svg/RightArrow2.web.js index 40ce7ae..8da88c5 100644 --- a/packages/loot-design/src/svg/RightArrow2.web.js +++ b/packages/loot-design/src/svg/RightArrow2.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function RightArrow2({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Search.web.js b/packages/loot-design/src/svg/Search.web.js index 8e05af7..9e5d883 100644 --- a/packages/loot-design/src/svg/Search.web.js +++ b/packages/loot-design/src/svg/Search.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Search({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Settings.web.js b/packages/loot-design/src/svg/Settings.web.js index b5be76b..a7381e5 100644 --- a/packages/loot-design/src/svg/Settings.web.js +++ b/packages/loot-design/src/svg/Settings.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Settings({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/Subtract.web.js b/packages/loot-design/src/svg/Subtract.web.js index 7245f1b..3d13655 100644 --- a/packages/loot-design/src/svg/Subtract.web.js +++ b/packages/loot-design/src/svg/Subtract.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Subtract({ width, height, style, color = 'black', ...props }) { diff --git a/packages/loot-design/src/svg/merge.web.js b/packages/loot-design/src/svg/merge.web.js index 111e516..9b566d3 100644 --- a/packages/loot-design/src/svg/merge.web.js +++ b/packages/loot-design/src/svg/merge.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Merge({ width, height, style, color = 'currentColor', ...props }) { diff --git a/packages/loot-design/src/svg/split.web.js b/packages/loot-design/src/svg/split.web.js index 93edbfe..72067d8 100644 --- a/packages/loot-design/src/svg/split.web.js +++ b/packages/loot-design/src/svg/split.web.js @@ -1,5 +1,6 @@ /* This file is auto-generated, do not touch! Please edit the SVG file instead. */ import React from 'react'; + import { css } from 'glamor'; function Split({ width, height, style, color = 'currentColor', ...props }) { diff --git a/packages/loot-design/src/svg/v1/AnimatedLoading.mobile.js b/packages/loot-design/src/svg/v1/AnimatedLoading.mobile.js index 1a51cb3..10492d2 100644 --- a/packages/loot-design/src/svg/v1/AnimatedLoading.mobile.js +++ b/packages/loot-design/src/svg/v1/AnimatedLoading.mobile.js @@ -1,7 +1,8 @@ import React from 'react'; -import Loading from './Loading'; import { Animated, Easing } from 'react-native'; +import Loading from './Loading'; + class AnimatedLoading extends React.Component { constructor() { super(); diff --git a/packages/loot-design/src/svg/v1/AnimatedLoading.web.js b/packages/loot-design/src/svg/v1/AnimatedLoading.web.js index 4271552..45b2afa 100644 --- a/packages/loot-design/src/svg/v1/AnimatedLoading.web.js +++ b/packages/loot-design/src/svg/v1/AnimatedLoading.web.js @@ -1,7 +1,9 @@ import React from 'react'; -import Loading from './Loading'; + import { css } from 'glamor'; +import Loading from './Loading'; + const rotation = css.keyframes({ '0%': { transform: 'rotate(-90deg)' }, '100%': { transform: 'rotate(666deg)' } diff --git a/yarn.lock b/yarn.lock index 3bb85ad..eaf4d66 100644 --- a/yarn.lock +++ b/yarn.lock @@ -88,7 +88,7 @@ __metadata: eslint-config-react-app: 3.0.5 eslint-loader: 2.1.1 eslint-plugin-flowtype: 2.50.1 - eslint-plugin-import: 2.14.0 + eslint-plugin-import: ^2.26.0 eslint-plugin-jsx-a11y: 6.1.2 eslint-plugin-prettier: ^3.1.4 eslint-plugin-react: 7.11.1 @@ -3648,6 +3648,13 @@ __metadata: languageName: node linkType: hard +"@types/json5@npm:^0.0.29": + version: 0.0.29 + resolution: "@types/json5@npm:0.0.29" + checksum: e60b153664572116dfea673c5bda7778dbff150498f44f998e34b5886d8afc47f16799280e4b6e241c0472aef1bc36add771c569c68fc5125fc2ae519a3eb9ac + languageName: node + linkType: hard + "@types/keyv@npm:*, @types/keyv@npm:^3.1.1": version: 3.1.4 resolution: "@types/keyv@npm:3.1.4" @@ -4899,6 +4906,19 @@ __metadata: languageName: node linkType: hard +"array-includes@npm:^3.1.4": + version: 3.1.5 + resolution: "array-includes@npm:3.1.5" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + es-abstract: ^1.19.5 + get-intrinsic: ^1.1.1 + is-string: ^1.0.7 + checksum: f6f24d834179604656b7bec3e047251d5cc87e9e87fab7c175c61af48e80e75acd296017abcde21fb52292ab6a2a449ab2ee37213ee48c8709f004d75983f9c5 + languageName: node + linkType: hard + "array-map@npm:~0.0.0": version: 0.0.0 resolution: "array-map@npm:0.0.0" @@ -4943,6 +4963,18 @@ __metadata: languageName: node linkType: hard +"array.prototype.flat@npm:^1.2.5": + version: 1.3.0 + resolution: "array.prototype.flat@npm:1.3.0" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.3 + es-abstract: ^1.19.2 + es-shim-unscopables: ^1.0.0 + checksum: 2a652b3e8dc0bebb6117e42a5ab5738af0203a14c27341d7bb2431467bdb4b348e2c5dc555dfcda8af0a5e4075c400b85311ded73861c87290a71a17c3e0a257 + languageName: node + linkType: hard + "arrify@npm:^1.0.1": version: 1.0.1 resolution: "arrify@npm:1.0.1" @@ -7026,13 +7058,6 @@ __metadata: languageName: node linkType: hard -"contains-path@npm:^0.1.0": - version: 0.1.0 - resolution: "contains-path@npm:0.1.0" - checksum: 94ecfd944e0bc51be8d3fc596dcd17d705bd4c8a1a627952a3a8c5924bac01c7ea19034cf40b4b4f89e576cdead130a7e5fd38f5f7f07ef67b4b261d875871e3 - languageName: node - linkType: hard - "content-disposition@npm:0.5.4": version: 0.5.4 resolution: "content-disposition@npm:0.5.4" @@ -8112,7 +8137,7 @@ __metadata: languageName: node linkType: hard -"debug@npm:2.6.9, debug@npm:^2.1.3, debug@npm:^2.2.0, debug@npm:^2.3.3, debug@npm:^2.6.0, debug@npm:^2.6.8, debug@npm:^2.6.9": +"debug@npm:2.6.9, debug@npm:^2.1.3, debug@npm:^2.2.0, debug@npm:^2.3.3, debug@npm:^2.6.0, debug@npm:^2.6.9": version: 2.6.9 resolution: "debug@npm:2.6.9" dependencies: @@ -8320,6 +8345,16 @@ __metadata: languageName: node linkType: hard +"define-properties@npm:^1.1.4": + version: 1.1.4 + resolution: "define-properties@npm:1.1.4" + dependencies: + has-property-descriptors: ^1.0.0 + object-keys: ^1.1.1 + checksum: ce0aef3f9eb193562b5cfb79b2d2c86b6a109dfc9fdcb5f45d680631a1a908c06824ddcdb72b7573b54e26ace07f0a23420aaba0d5c627b34d2c1de8ef527e2b + languageName: node + linkType: hard + "define-property@npm:^0.2.5": version: 0.2.5 resolution: "define-property@npm:0.2.5" @@ -8614,16 +8649,6 @@ __metadata: languageName: node linkType: hard -"doctrine@npm:1.5.0": - version: 1.5.0 - resolution: "doctrine@npm:1.5.0" - dependencies: - esutils: ^2.0.2 - isarray: ^1.0.0 - checksum: 7ce8102a05cbb9d942d49db5461d2f3dd1208ebfed929bf1c04770a1ef6ef540b792e63c45eae4c51f8b16075e0af4a73581a06bad31c37ceb0988f2e398509b - languageName: node - linkType: hard - "doctrine@npm:^2.1.0": version: 2.1.0 resolution: "doctrine@npm:2.1.0" @@ -9192,6 +9217,37 @@ __metadata: languageName: node linkType: hard +"es-abstract@npm:^1.19.0, es-abstract@npm:^1.19.2, es-abstract@npm:^1.19.5": + version: 1.20.1 + resolution: "es-abstract@npm:1.20.1" + dependencies: + call-bind: ^1.0.2 + es-to-primitive: ^1.2.1 + function-bind: ^1.1.1 + function.prototype.name: ^1.1.5 + get-intrinsic: ^1.1.1 + get-symbol-description: ^1.0.0 + has: ^1.0.3 + has-property-descriptors: ^1.0.0 + has-symbols: ^1.0.3 + internal-slot: ^1.0.3 + is-callable: ^1.2.4 + is-negative-zero: ^2.0.2 + is-regex: ^1.1.4 + is-shared-array-buffer: ^1.0.2 + is-string: ^1.0.7 + is-weakref: ^1.0.2 + object-inspect: ^1.12.0 + object-keys: ^1.1.1 + object.assign: ^4.1.2 + regexp.prototype.flags: ^1.4.3 + string.prototype.trimend: ^1.0.5 + string.prototype.trimstart: ^1.0.5 + unbox-primitive: ^1.0.2 + checksum: 28da27ae0ed9c76df7ee8ef5c278df79dcfdb554415faf7068bb7c58f8ba8e2a16bfb59e586844be6429ab4c302ca7748979d48442224cb1140b051866d74b7f + languageName: node + linkType: hard + "es-get-iterator@npm:^1.1.1": version: 1.1.2 resolution: "es-get-iterator@npm:1.1.2" @@ -9208,6 +9264,15 @@ __metadata: languageName: node linkType: hard +"es-shim-unscopables@npm:^1.0.0": + version: 1.0.0 + resolution: "es-shim-unscopables@npm:1.0.0" + dependencies: + has: ^1.0.3 + checksum: 83e95cadbb6ee44d3644dfad60dcad7929edbc42c85e66c3e99aefd68a3a5c5665f2686885cddb47dfeabfd77bd5ea5a7060f2092a955a729bbd8834f0d86fa1 + languageName: node + linkType: hard + "es-to-primitive@npm:^1.2.1": version: 1.2.1 resolution: "es-to-primitive@npm:1.2.1" @@ -9347,7 +9412,7 @@ __metadata: languageName: node linkType: hard -"eslint-import-resolver-node@npm:^0.3.1": +"eslint-import-resolver-node@npm:^0.3.6": version: 0.3.6 resolution: "eslint-import-resolver-node@npm:0.3.6" dependencies: @@ -9373,13 +9438,15 @@ __metadata: languageName: node linkType: hard -"eslint-module-utils@npm:^2.2.0": - version: 2.7.3 - resolution: "eslint-module-utils@npm:2.7.3" +"eslint-module-utils@npm:^2.7.3": + version: 2.7.4 + resolution: "eslint-module-utils@npm:2.7.4" dependencies: debug: ^3.2.7 - find-up: ^2.1.0 - checksum: 77048263f309167a1e6a1e1b896bfb5ddd1d3859b2e2abbd9c32c432aee13d610d46e6820b1ca81b37fba437cf423a404bc6649be64ace9148a3062d1886a678 + peerDependenciesMeta: + eslint: + optional: true + checksum: 5da13645daff145a5c922896b258f8bba560722c3767254e458d894ff5fbb505d6dfd945bffa932a5b0ae06714da2379bd41011c4c20d2d59cc83e23895360f7 languageName: node linkType: hard @@ -9394,23 +9461,26 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-import@npm:2.14.0": - version: 2.14.0 - resolution: "eslint-plugin-import@npm:2.14.0" +"eslint-plugin-import@npm:^2.26.0": + version: 2.26.0 + resolution: "eslint-plugin-import@npm:2.26.0" dependencies: - contains-path: ^0.1.0 - debug: ^2.6.8 - doctrine: 1.5.0 - eslint-import-resolver-node: ^0.3.1 - eslint-module-utils: ^2.2.0 - has: ^1.0.1 - lodash: ^4.17.4 - minimatch: ^3.0.3 - read-pkg-up: ^2.0.0 - resolve: ^1.6.0 + array-includes: ^3.1.4 + array.prototype.flat: ^1.2.5 + debug: ^2.6.9 + doctrine: ^2.1.0 + eslint-import-resolver-node: ^0.3.6 + eslint-module-utils: ^2.7.3 + has: ^1.0.3 + is-core-module: ^2.8.1 + is-glob: ^4.0.3 + minimatch: ^3.1.2 + object.values: ^1.1.5 + resolve: ^1.22.0 + tsconfig-paths: ^3.14.1 peerDependencies: - eslint: 2.x - 5.x - checksum: 3ae491d18b9684ec19acff82ab3930004d4978b1e418c0ae3046aa649a10ebcd996a6f7f4213b2d8e960c8222506561174f8ad7905f5f46d00706174fc60a55b + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + checksum: 0bf77ad80339554481eafa2b1967449e1f816b94c7a6f9614ce33fb4083c4e6c050f10d241dd50b4975d47922880a34de1e42ea9d8e6fd663ebb768baa67e655 languageName: node linkType: hard @@ -10776,6 +10846,18 @@ __metadata: languageName: node linkType: hard +"function.prototype.name@npm:^1.1.5": + version: 1.1.5 + resolution: "function.prototype.name@npm:1.1.5" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.3 + es-abstract: ^1.19.0 + functions-have-names: ^1.2.2 + checksum: acd21d733a9b649c2c442f067567743214af5fa248dbeee69d8278ce7df3329ea5abac572be9f7470b4ec1cd4d8f1040e3c5caccf98ebf2bf861a0deab735c27 + languageName: node + linkType: hard + "functional-red-black-tree@npm:^1.0.1": version: 1.0.1 resolution: "functional-red-black-tree@npm:1.0.1" @@ -10783,6 +10865,13 @@ __metadata: languageName: node linkType: hard +"functions-have-names@npm:^1.2.2": + version: 1.2.3 + resolution: "functions-have-names@npm:1.2.3" + checksum: c3f1f5ba20f4e962efb71344ce0a40722163e85bee2101ce25f88214e78182d2d2476aa85ef37950c579eb6cf6ee811c17b3101bb84004bb75655f3e33f3fdb5 + languageName: node + linkType: hard + "gauge@npm:^4.0.3": version: 4.0.4 resolution: "gauge@npm:4.0.4" @@ -11312,6 +11401,13 @@ __metadata: languageName: node linkType: hard +"has-bigints@npm:^1.0.2": + version: 1.0.2 + resolution: "has-bigints@npm:1.0.2" + checksum: 390e31e7be7e5c6fe68b81babb73dfc35d413604d7ee5f56da101417027a4b4ce6a27e46eff97ad040c835b5d228676eae99a9b5c3bc0e23c8e81a49241ff45b + languageName: node + linkType: hard + "has-flag@npm:^3.0.0": version: 3.0.0 resolution: "has-flag@npm:3.0.0" @@ -11326,7 +11422,16 @@ __metadata: languageName: node linkType: hard -"has-symbols@npm:^1.0.1, has-symbols@npm:^1.0.2": +"has-property-descriptors@npm:^1.0.0": + version: 1.0.0 + resolution: "has-property-descriptors@npm:1.0.0" + dependencies: + get-intrinsic: ^1.1.1 + checksum: a6d3f0a266d0294d972e354782e872e2fe1b6495b321e6ef678c9b7a06a40408a6891817350c62e752adced73a94ac903c54734fee05bf65b1905ee1368194bb + languageName: node + linkType: hard + +"has-symbols@npm:^1.0.1, has-symbols@npm:^1.0.2, has-symbols@npm:^1.0.3": version: 1.0.3 resolution: "has-symbols@npm:1.0.3" checksum: a054c40c631c0d5741a8285010a0777ea0c068f99ed43e5d6eb12972da223f8af553a455132fdb0801bdcfa0e0f443c0c03a68d8555aa529b3144b446c3f2410 @@ -11395,7 +11500,7 @@ __metadata: languageName: node linkType: hard -"has@npm:^1.0.0, has@npm:^1.0.1, has@npm:^1.0.3": +"has@npm:^1.0.0, has@npm:^1.0.3": version: 1.0.3 resolution: "has@npm:1.0.3" dependencies: @@ -12346,6 +12451,15 @@ __metadata: languageName: node linkType: hard +"is-core-module@npm:^2.9.0": + version: 2.10.0 + resolution: "is-core-module@npm:2.10.0" + dependencies: + has: ^1.0.3 + checksum: 0f3f77811f430af3256fa7bbc806f9639534b140f8ee69476f632c3e1eb4e28a38be0b9d1b8ecf596179c841b53576129279df95e7051d694dac4ceb6f967593 + languageName: node + linkType: hard + "is-data-descriptor@npm:^0.1.4": version: 0.1.4 resolution: "is-data-descriptor@npm:0.1.4" @@ -12473,7 +12587,7 @@ __metadata: languageName: node linkType: hard -"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:~4.0.1": +"is-glob@npm:^4.0.0, is-glob@npm:^4.0.1, is-glob@npm:^4.0.3, is-glob@npm:~4.0.1": version: 4.0.3 resolution: "is-glob@npm:4.0.3" dependencies: @@ -12513,7 +12627,7 @@ __metadata: languageName: node linkType: hard -"is-negative-zero@npm:^2.0.1": +"is-negative-zero@npm:^2.0.1, is-negative-zero@npm:^2.0.2": version: 2.0.2 resolution: "is-negative-zero@npm:2.0.2" checksum: f3232194c47a549da60c3d509c9a09be442507616b69454716692e37ae9f37c4dea264fb208ad0c9f3efd15a796a46b79df07c7e53c6227c32170608b809149a @@ -12666,6 +12780,15 @@ __metadata: languageName: node linkType: hard +"is-shared-array-buffer@npm:^1.0.2": + version: 1.0.2 + resolution: "is-shared-array-buffer@npm:1.0.2" + dependencies: + call-bind: ^1.0.2 + checksum: 9508929cf14fdc1afc9d61d723c6e8d34f5e117f0bffda4d97e7a5d88c3a8681f633a74f8e3ad1fe92d5113f9b921dc5ca44356492079612f9a247efbce7032a + languageName: node + linkType: hard + "is-stream@npm:^1.0.1, is-stream@npm:^1.1.0": version: 1.1.0 resolution: "is-stream@npm:1.1.0" @@ -12732,7 +12855,7 @@ __metadata: languageName: node linkType: hard -"is-weakref@npm:^1.0.1": +"is-weakref@npm:^1.0.1, is-weakref@npm:^1.0.2": version: 1.0.2 resolution: "is-weakref@npm:1.0.2" dependencies: @@ -14570,6 +14693,7 @@ jest-snapshot@test: date-fns: 2.0.0-alpha.27 deep-equal: ^2.0.5 eslint: 5.6.0 + eslint-plugin-import: ^2.26.0 eslint-plugin-prettier: ^3.1.4 esm: ^3.0.82 fake-indexeddb: ^3.1.3 @@ -15483,7 +15607,7 @@ jest-snapshot@test: languageName: node linkType: hard -"minimatch@npm:^3.0.2, minimatch@npm:^3.0.3, minimatch@npm:^3.0.4": +"minimatch@npm:^3.0.2, minimatch@npm:^3.0.4, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" dependencies: @@ -16565,6 +16689,13 @@ jest-snapshot@test: languageName: node linkType: hard +"object-inspect@npm:^1.12.0": + version: 1.12.2 + resolution: "object-inspect@npm:1.12.2" + checksum: a534fc1b8534284ed71f25ce3a496013b7ea030f3d1b77118f6b7b1713829262be9e6243acbcb3ef8c626e2b64186112cb7f6db74e37b2789b9c789ca23048b2 + languageName: node + linkType: hard + "object-is@npm:^1.0.1, object-is@npm:^1.1.4": version: 1.1.5 resolution: "object-is@npm:1.1.5" @@ -16630,7 +16761,7 @@ jest-snapshot@test: languageName: node linkType: hard -"object.values@npm:^1.1.0": +"object.values@npm:^1.1.0, object.values@npm:^1.1.5": version: 1.1.5 resolution: "object.values@npm:1.1.5" dependencies: @@ -19646,6 +19777,17 @@ jest-snapshot@test: languageName: node linkType: hard +"regexp.prototype.flags@npm:^1.4.3": + version: 1.4.3 + resolution: "regexp.prototype.flags@npm:1.4.3" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.3 + functions-have-names: ^1.2.2 + checksum: 51228bae732592adb3ededd5e15426be25f289e9c4ef15212f4da73f4ec3919b6140806374b8894036a86020d054a8d2657d3fee6bb9b4d35d8939c20030b7a6 + languageName: node + linkType: hard + "regexpp@npm:^2.0.0": version: 2.0.1 resolution: "regexpp@npm:2.0.1" @@ -19903,7 +20045,7 @@ jest-snapshot@test: languageName: node linkType: hard -"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.14.2, resolve@npm:^1.20.0, resolve@npm:^1.5.0, resolve@npm:^1.6.0": +"resolve@npm:^1.1.6, resolve@npm:^1.10.0, resolve@npm:^1.14.2, resolve@npm:^1.20.0, resolve@npm:^1.5.0": version: 1.22.0 resolution: "resolve@npm:1.22.0" dependencies: @@ -19916,6 +20058,19 @@ jest-snapshot@test: languageName: node linkType: hard +"resolve@npm:^1.22.0": + version: 1.22.1 + resolution: "resolve@npm:1.22.1" + dependencies: + is-core-module: ^2.9.0 + path-parse: ^1.0.7 + supports-preserve-symlinks-flag: ^1.0.0 + bin: + resolve: bin/resolve + checksum: 07af5fc1e81aa1d866cbc9e9460fbb67318a10fa3c4deadc35c3ad8a898ee9a71a86a65e4755ac3195e0ea0cfbe201eb323ebe655ce90526fd61917313a34e4e + languageName: node + linkType: hard + "resolve@patch:resolve@1.8.1#~builtin": version: 1.8.1 resolution: "resolve@patch:resolve@npm%3A1.8.1#~builtin::version=1.8.1&hash=07638b" @@ -19925,7 +20080,7 @@ jest-snapshot@test: languageName: node linkType: hard -"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.5.0#~builtin, resolve@patch:resolve@^1.6.0#~builtin": +"resolve@patch:resolve@^1.1.6#~builtin, resolve@patch:resolve@^1.10.0#~builtin, resolve@patch:resolve@^1.14.2#~builtin, resolve@patch:resolve@^1.20.0#~builtin, resolve@patch:resolve@^1.5.0#~builtin": version: 1.22.0 resolution: "resolve@patch:resolve@npm%3A1.22.0#~builtin::version=1.22.0&hash=07638b" dependencies: @@ -19938,6 +20093,19 @@ jest-snapshot@test: languageName: node linkType: hard +"resolve@patch:resolve@^1.22.0#~builtin": + version: 1.22.1 + resolution: "resolve@patch:resolve@npm%3A1.22.1#~builtin::version=1.22.1&hash=07638b" + dependencies: + is-core-module: ^2.9.0 + path-parse: ^1.0.7 + supports-preserve-symlinks-flag: ^1.0.0 + bin: + resolve: bin/resolve + checksum: 5656f4d0bedcf8eb52685c1abdf8fbe73a1603bb1160a24d716e27a57f6cecbe2432ff9c89c2bd57542c3a7b9d14b1882b73bfe2e9d7849c9a4c0b8b39f02b8b + languageName: node + linkType: hard + "responselike@npm:^1.0.2": version: 1.0.2 resolution: "responselike@npm:1.0.2" @@ -21344,6 +21512,17 @@ jest-snapshot@test: languageName: node linkType: hard +"string.prototype.trimend@npm:^1.0.5": + version: 1.0.5 + resolution: "string.prototype.trimend@npm:1.0.5" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + es-abstract: ^1.19.5 + checksum: d44f543833112f57224e79182debadc9f4f3bf9d48a0414d6f0cbd2a86f2b3e8c0ca1f95c3f8e5b32ae83e91554d79d932fc746b411895f03f93d89ed3dfb6bc + languageName: node + linkType: hard + "string.prototype.trimstart@npm:^1.0.4": version: 1.0.4 resolution: "string.prototype.trimstart@npm:1.0.4" @@ -21354,6 +21533,17 @@ jest-snapshot@test: languageName: node linkType: hard +"string.prototype.trimstart@npm:^1.0.5": + version: 1.0.5 + resolution: "string.prototype.trimstart@npm:1.0.5" + dependencies: + call-bind: ^1.0.2 + define-properties: ^1.1.4 + es-abstract: ^1.19.5 + checksum: a4857c5399ad709d159a77371eeaa8f9cc284469a0b5e1bfe405de16f1fd4166a8ea6f4180e55032f348d1b679b1599fd4301fbc7a8b72bdb3e795e43f7b1048 + languageName: node + linkType: hard + "string_decoder@npm:^1.0.0, string_decoder@npm:^1.1.1": version: 1.3.0 resolution: "string_decoder@npm:1.3.0" @@ -22160,6 +22350,18 @@ jest-snapshot@test: languageName: node linkType: hard +"tsconfig-paths@npm:^3.14.1": + version: 3.14.1 + resolution: "tsconfig-paths@npm:3.14.1" + dependencies: + "@types/json5": ^0.0.29 + json5: ^1.0.1 + minimist: ^1.2.6 + strip-bom: ^3.0.0 + checksum: 8afa01c673ebb4782ba53d3a12df97fa837ce524f8ad38ee4e2b2fd57f5ac79abc21c574e9e9eb014d93efe7fe8214001b96233b5c6ea75bd1ea82afe17a4c6d + languageName: node + linkType: hard + "tslib@npm:^1.9.0, tslib@npm:^1.9.3": version: 1.14.1 resolution: "tslib@npm:1.14.1" @@ -22408,6 +22610,18 @@ jest-snapshot@test: languageName: node linkType: hard +"unbox-primitive@npm:^1.0.2": + version: 1.0.2 + resolution: "unbox-primitive@npm:1.0.2" + dependencies: + call-bind: ^1.0.2 + has-bigints: ^1.0.2 + has-symbols: ^1.0.3 + which-boxed-primitive: ^1.0.2 + checksum: b7a1cf5862b5e4b5deb091672ffa579aa274f648410009c81cca63fed3b62b610c4f3b773f912ce545bb4e31edc3138975b5bc777fc6e4817dca51affb6380e9 + languageName: node + linkType: hard + "unicode-canonical-property-names-ecmascript@npm:^2.0.0": version: 2.0.0 resolution: "unicode-canonical-property-names-ecmascript@npm:2.0.0" From 9c0df36e16d031501474bc3ee738af24479a02a1 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Fri, 2 Sep 2022 15:07:24 +0100 Subject: [PATCH 9/9] Sort import in alphabetical order (#238) * style: enforce sorting of imports * style: alphabetize imports * style: merge duplicated imports --- .eslintrc.js | 4 + packages/desktop-client/src/components/App.js | 8 +- .../src/components/AppBackground.js | 2 +- .../desktop-client/src/components/Debugger.js | 2 +- .../src/components/FinancesApp.js | 43 ++++++----- .../desktop-client/src/components/Modals.js | 24 +++--- .../src/components/Notifications.js | 2 +- .../desktop-client/src/components/Settings.js | 8 +- .../src/components/SidebarWithData.js | 6 +- .../src/components/SpreadsheetInterface.js | 2 +- .../desktop-client/src/components/Titlebar.js | 14 ++-- .../desktop-client/src/components/Tutorial.js | 14 ++-- .../src/components/accounts/Account.js | 64 ++++++++-------- .../components/accounts/AccountSyncCheck.js | 2 +- .../src/components/accounts/Filters.js | 26 +++---- .../accounts/SimpleTransactionsTable.js | 12 +-- .../components/accounts/TransactionList.js | 2 +- .../components/accounts/TransactionsTable.js | 42 +++++------ .../accounts/TransactionsTable.test.js | 6 +- .../components/budget/MonthCountSelector.js | 4 +- .../src/components/budget/index.js | 20 ++--- .../src/components/manager/ConfigServer.js | 4 +- .../src/components/manager/ManagementApp.js | 14 ++-- .../src/components/manager/Modals.js | 10 +-- .../src/components/manager/ServerURL.js | 2 +- .../components/manager/subscribe/Bootstrap.js | 8 +- .../manager/subscribe/ChangePassword.js | 4 +- .../src/components/manager/subscribe/Login.js | 6 +- .../components/manager/subscribe/common.js | 2 +- .../modals/ConfirmCategoryDelete.js | 2 +- .../components/modals/CreateEncryptionKey.js | 4 +- .../src/components/modals/EditRule.js | 38 +++++----- .../src/components/modals/FixEncryptionKey.js | 4 +- .../src/components/modals/ManageRules.js | 26 +++---- .../components/modals/MergeUnusedPayees.js | 6 +- .../components/payees/ManagePayeesWithData.js | 4 +- .../src/components/reports/CashFlow.js | 13 ++-- .../src/components/reports/Change.js | 3 +- .../src/components/reports/DateRange.js | 2 +- .../src/components/reports/Header.js | 4 +- .../src/components/reports/NetWorth.js | 17 ++--- .../src/components/reports/Overview.js | 16 ++-- .../src/components/reports/Tooltip.js | 2 +- .../reports/graphs/CashFlowGraph.js | 4 +- .../reports/graphs/NetWorthGraph.js | 4 +- .../reports/graphs/cash-flow-spreadsheet.js | 6 +- .../reports/graphs/net-worth-spreadsheet.js | 4 +- .../src/components/reports/index.js | 4 +- .../components/schedules/DiscoverSchedules.js | 6 +- .../src/components/schedules/EditSchedule.js | 23 +++--- .../components/schedules/SchedulesTable.js | 6 +- .../src/components/schedules/StatusBadge.js | 10 +-- .../src/components/schedules/index.js | 4 +- .../src/components/tools/FixSplitsTool.js | 2 +- .../components/tutorial/BudgetCategories.js | 2 +- .../components/tutorial/BudgetNewIncome.js | 2 +- .../components/tutorial/BudgetNextMonth.js | 2 +- .../src/components/tutorial/BudgetSummary.js | 2 +- .../components/tutorial/CategoryBalance.js | 2 +- .../components/tutorial/DeleteTransactions.js | 2 +- .../src/components/tutorial/Overspending.js | 8 +- .../src/components/tutorial/TransactionAdd.js | 2 +- .../components/tutorial/TransactionEnter.js | 4 +- .../tutorial/TransactionFinalize.js | 2 +- .../src/components/util/DisplayId.js | 2 +- .../src/components/util/GenericInput.js | 4 +- packages/desktop-client/src/global-events.js | 2 +- packages/desktop-client/src/index.js | 10 +-- .../src/client/SpreadsheetProvider.js | 3 +- .../loot-core/src/client/actions/account.js | 2 +- .../loot-core/src/client/actions/budgets.js | 6 +- .../loot-core/src/client/actions/prefs.js | 2 +- .../loot-core/src/client/actions/queries.js | 2 +- packages/loot-core/src/client/actions/sync.js | 4 +- packages/loot-core/src/client/actions/user.js | 2 +- .../src/client/data-hooks/schedules.js | 2 +- packages/loot-core/src/client/queries.js | 2 +- .../src/client/query-helpers.test.js | 6 +- .../loot-core/src/client/reducers/index.js | 10 +-- .../loot-core/src/client/reducers/prefs.js | 2 +- .../loot-core/src/client/reducers/queries.js | 2 +- packages/loot-core/src/mocks/budget.js | 14 ++-- packages/loot-core/src/mocks/redux.js | 2 +- packages/loot-core/src/mocks/setup.js | 14 ++-- .../platform/client/fetch/index.browser.js | 2 +- .../src/platform/client/fetch/index.web.js | 2 +- .../src/platform/client/undo/index.web.js | 2 +- .../src/platform/server/fs/index.web.js | 2 +- .../src/server/accounts/export-to-csv.js | 2 +- .../loot-core/src/server/accounts/link.js | 8 +- .../src/server/accounts/parse-file.js | 2 +- .../src/server/accounts/parse-file.test.js | 6 +- .../loot-core/src/server/accounts/rules.js | 4 +- .../loot-core/src/server/accounts/sync.js | 14 ++-- .../src/server/accounts/sync.test.js | 4 +- .../src/server/accounts/transaction-rules.js | 33 ++++---- .../server/accounts/transaction-rules.test.js | 6 +- .../src/server/accounts/transactions.js | 4 +- .../src/server/accounts/transfer.test.js | 2 +- packages/loot-core/src/server/api.js | 30 ++++---- .../loot-core/src/server/aql/exec.test.js | 2 +- .../src/server/aql/schema-helpers.js | 2 +- .../src/server/aql/schema/executors.js | 2 +- .../src/server/aql/schema/executors.test.js | 12 +-- .../src/server/aql/schema/run-query.js | 4 +- packages/loot-core/src/server/backups.js | 4 +- .../loot-core/src/server/budget/actions.js | 2 +- packages/loot-core/src/server/budget/base.js | 6 +- .../loot-core/src/server/budget/base.test.js | 4 +- .../loot-core/src/server/budget/rollover.js | 2 +- .../loot-core/src/server/cloud-storage.js | 12 +-- packages/loot-core/src/server/db/index.js | 27 ++++--- packages/loot-core/src/server/main.js | 75 +++++++++---------- packages/loot-core/src/server/main.test.js | 12 +-- .../src/server/migrate/migrations.test.js | 2 +- packages/loot-core/src/server/mutators.js | 2 +- packages/loot-core/src/server/post.js | 2 +- packages/loot-core/src/server/prefs.js | 2 +- .../loot-core/src/server/schedules/app.js | 32 ++++---- .../src/server/schedules/app.test.js | 2 +- .../src/server/schedules/find-schedules.js | 12 +-- packages/loot-core/src/server/sheet.js | 4 +- packages/loot-core/src/server/sheet.test.js | 2 +- .../src/server/spreadsheet/new/compiler.js | 6 +- .../server/spreadsheet/spreadsheet.test.js | 4 +- .../loot-core/src/server/spreadsheet/usage.js | 4 +- packages/loot-core/src/server/sync/index.js | 24 +++--- .../loot-core/src/server/sync/migrate.test.js | 6 +- packages/loot-core/src/server/sync/repair.js | 2 +- packages/loot-core/src/server/sync/reset.js | 6 +- .../src/server/sync/sync.property.test.js | 6 +- .../loot-core/src/server/sync/sync.test.js | 6 +- .../src/server/tests/mockSyncServer.js | 2 +- packages/loot-core/src/server/tools/app.js | 4 +- packages/loot-core/src/server/undo.js | 2 +- packages/loot-core/src/server/update.js | 4 +- .../src/components/AccountAutocomplete.js | 2 +- .../src/components/Autocomplete.usage.js | 2 +- .../src/components/CategorySelect.js | 4 +- .../src/components/DateSelect.usage.js | 2 +- .../src/components/FixedSizeList.js | 2 +- .../loot-design/src/components/NotesButton.js | 8 +- .../src/components/PayeeAutocomplete.js | 8 +- .../src/components/RecurringSchedulePicker.js | 4 +- .../RecurringSchedulePicker.usage.js | 2 +- packages/loot-design/src/components/Stack.js | 2 +- packages/loot-design/src/components/alerts.js | 4 +- .../components/budget/BalanceWithCarryover.js | 6 +- .../src/components/budget/BudgetSummaries.js | 4 +- .../components/budget/DynamicBudgetTable.js | 2 +- .../src/components/budget/index.js | 20 ++--- .../src/components/budget/index.usage.js | 6 +- .../components/budget/report/BudgetSummary.js | 20 ++--- .../components/budget/report/components.js | 14 ++-- .../budget/rollover/BudgetSummary.js | 24 +++--- .../components/budget/rollover/HoldTooltip.js | 4 +- .../budget/rollover/TransferTooltip.js | 11 ++- .../budget/rollover/rollover-components.js | 16 ++-- packages/loot-design/src/components/common.js | 6 +- packages/loot-design/src/components/forms.js | 2 +- .../src/components/manager/BudgetList.js | 8 +- .../src/components/manager/DeleteFile.js | 2 +- .../src/components/manager/Import.js | 2 +- .../src/components/manager/ImportActual.js | 2 +- .../src/components/manager/ImportYNAB4.js | 2 +- .../src/components/manager/ImportYNAB5.js | 2 +- .../src/components/mobile/AmountInput.js | 8 +- .../src/components/mobile/account.js | 8 +- .../src/components/mobile/account.usage.js | 4 +- .../src/components/mobile/accounts.js | 6 +- .../src/components/mobile/accounts.usage.js | 2 +- .../src/components/mobile/alerts.js | 2 +- .../src/components/mobile/budget.js | 28 +++---- .../src/components/mobile/budget.test.js | 8 +- .../src/components/mobile/budget.usage.js | 2 +- .../src/components/mobile/transaction.js | 14 ++-- .../components/mobile/transaction.usage.js | 4 +- .../src/components/modals/CloseAccount.js | 2 +- .../modals/ConfigureLinkedAccounts.js | 2 +- .../components/modals/CreateLocalAccount.js | 2 +- .../src/components/modals/EditField.js | 10 +-- .../components/modals/ImportTransactions.js | 5 +- .../modals/ImportTransactions.usage.js | 2 +- .../src/components/modals/LoadBackup.js | 2 +- .../src/components/modals/PlaidExternalMsg.js | 4 +- packages/loot-design/src/components/payees.js | 12 +-- .../src/components/payees.usage.js | 2 +- .../loot-design/src/components/sidebar.js | 20 ++--- .../src/components/sidebar.usage.js | 6 +- .../src/components/spreadsheet/CellValue.js | 4 +- packages/loot-design/src/components/table.js | 10 +-- .../loot-design/src/components/useSelected.js | 2 +- .../src/components/manager/TransitionView.js | 3 +- .../modals/GenericSearchableSelect.js | 3 +- 194 files changed, 745 insertions(+), 742 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 46cbd36..6c47a52 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -11,6 +11,10 @@ module.exports = { 'import/order': [ 'error', { + alphabetize: { + caseInsensitive: true, + order: 'asc' + }, groups: [ 'builtin', // Built-in types are first 'external', diff --git a/packages/desktop-client/src/components/App.js b/packages/desktop-client/src/components/App.js index 1f4d8f8..1698d20 100644 --- a/packages/desktop-client/src/components/App.js +++ b/packages/desktop-client/src/components/App.js @@ -11,12 +11,12 @@ import { import { styles, hasHiddenScrollbars } from 'loot-design/src/style'; import installPolyfills from '../polyfills'; -import FatalError from './FatalError'; -import ManagementApp from './manager/ManagementApp'; -import FinancesApp from './FinancesApp'; import AppBackground from './AppBackground'; -import UpdateNotification from './UpdateNotification'; +import FatalError from './FatalError'; +import FinancesApp from './FinancesApp'; +import ManagementApp from './manager/ManagementApp'; import MobileWebMessage from './MobileWebMessage'; +import UpdateNotification from './UpdateNotification'; class App extends React.Component { state = { diff --git a/packages/desktop-client/src/components/AppBackground.js b/packages/desktop-client/src/components/AppBackground.js index c617e4f..ba8a1f1 100644 --- a/packages/desktop-client/src/components/AppBackground.js +++ b/packages/desktop-client/src/components/AppBackground.js @@ -3,8 +3,8 @@ import React from 'react'; import { css } from 'glamor'; import { View, Block } from 'loot-design/src/components/common'; -import AnimatedLoading from 'loot-design/src/svg/v1/AnimatedLoading'; import { colors } from 'loot-design/src/style'; +import AnimatedLoading from 'loot-design/src/svg/v1/AnimatedLoading'; import Background from './Background'; diff --git a/packages/desktop-client/src/components/Debugger.js b/packages/desktop-client/src/components/Debugger.js index eb37911..de887c3 100644 --- a/packages/desktop-client/src/components/Debugger.js +++ b/packages/desktop-client/src/components/Debugger.js @@ -2,11 +2,11 @@ import React from 'react'; import CodeMirror from 'codemirror'; +import * as spreadsheet from 'loot-core/src/client/sheetql/spreadsheet'; import { send, init as initConnection } from 'loot-core/src/platform/client/fetch'; -import * as spreadsheet from 'loot-core/src/client/sheetql/spreadsheet'; import { View, Button, diff --git a/packages/desktop-client/src/components/FinancesApp.js b/packages/desktop-client/src/components/FinancesApp.js index 04cd497..eccbab1 100644 --- a/packages/desktop-client/src/components/FinancesApp.js +++ b/packages/desktop-client/src/components/FinancesApp.js @@ -1,42 +1,41 @@ import React, { useMemo } from 'react'; -import { Router, Route, Redirect, Switch, useLocation } from 'react-router-dom'; -import { connect } from 'react-redux'; import { DndProvider } from 'react-dnd'; import Backend from 'react-dnd-html5-backend'; +import { connect } from 'react-redux'; +import { Router, Route, Redirect, Switch, useLocation } from 'react-router-dom'; import { createBrowserHistory } from 'history'; import hotkeys from 'hotkeys-js'; import * as actions from 'loot-core/src/client/actions'; +import { AccountsProvider } from 'loot-core/src/client/data-hooks/accounts'; +import { PayeesProvider } from 'loot-core/src/client/data-hooks/payees'; import { SpreadsheetProvider } from 'loot-core/src/client/SpreadsheetProvider'; import checkForUpgradeNotifications from 'loot-core/src/client/upgrade-notifications'; -import { colors } from 'loot-design/src/style'; -import { View } from 'loot-design/src/components/common'; -import { BudgetMonthCountProvider } from 'loot-design/src/components/budget/BudgetMonthCountContext'; import * as undo from 'loot-core/src/platform/client/undo'; -import { PayeesProvider } from 'loot-core/src/client/data-hooks/payees'; -import { AccountsProvider } from 'loot-core/src/client/data-hooks/accounts'; +import { BudgetMonthCountProvider } from 'loot-design/src/components/budget/BudgetMonthCountContext'; +import { View } from 'loot-design/src/components/common'; +import { colors } from 'loot-design/src/style'; -import { getLocationState } from '../util/location-state'; -import { makeLocationState } from '../util/location-state'; -import { PageTypeProvider } from './Page'; +import { getLocationState, makeLocationState } from '../util/location-state'; +import Account from './accounts/Account'; import { ActiveLocationProvider } from './ActiveLocation'; import BankSyncStatus from './BankSyncStatus'; -import Titlebar, { TitlebarProvider } from './Titlebar'; -import FloatableSidebar, { SidebarProvider } from './FloatableSidebar'; -import Account from './accounts/Account'; import Budget from './budget'; -import Reports from './reports'; -import Schedules from './schedules'; -import EditSchedule from './schedules/EditSchedule'; -import LinkSchedule from './schedules/LinkSchedule'; -import DiscoverSchedules from './schedules/DiscoverSchedules'; -import PostsOfflineNotification from './schedules/PostsOfflineNotification'; -import FixSplitsTool from './tools/FixSplitsTool'; -import Settings from './Settings'; +import FloatableSidebar, { SidebarProvider } from './FloatableSidebar'; +import GlobalKeys from './GlobalKeys'; import Modals from './Modals'; import Notifications from './Notifications'; -import GlobalKeys from './GlobalKeys'; +import { PageTypeProvider } from './Page'; +import Reports from './reports'; +import Schedules from './schedules'; +import DiscoverSchedules from './schedules/DiscoverSchedules'; +import EditSchedule from './schedules/EditSchedule'; +import LinkSchedule from './schedules/LinkSchedule'; +import PostsOfflineNotification from './schedules/PostsOfflineNotification'; +import Settings from './Settings'; +import Titlebar, { TitlebarProvider } from './Titlebar'; +import FixSplitsTool from './tools/FixSplitsTool'; // import Debugger from './Debugger'; function URLBar() { diff --git a/packages/desktop-client/src/components/Modals.js b/packages/desktop-client/src/components/Modals.js index ee19f3a..2dc967f 100644 --- a/packages/desktop-client/src/components/Modals.js +++ b/packages/desktop-client/src/components/Modals.js @@ -2,30 +2,30 @@ import React from 'react'; import { connect } from 'react-redux'; import { Route, Switch } from 'react-router-dom'; -import { bindActionCreators } from 'redux'; -import { createLocation } from 'history'; import Component from '@reactions/component'; +import { createLocation } from 'history'; +import { bindActionCreators } from 'redux'; import * as actions from 'loot-core/src/client/actions'; import { send, listen, unlisten } from 'loot-core/src/platform/client/fetch'; -import CreateLocalAccount from 'loot-design/src/components/modals/CreateLocalAccount'; import CloseAccount from 'loot-design/src/components/modals/CloseAccount'; -import SelectLinkedAccounts from 'loot-design/src/components/modals/SelectLinkedAccounts'; import ConfigureLinkedAccounts from 'loot-design/src/components/modals/ConfigureLinkedAccounts'; +import CreateLocalAccount from 'loot-design/src/components/modals/CreateLocalAccount'; +import EditField from 'loot-design/src/components/modals/EditField'; +import ImportTransactions from 'loot-design/src/components/modals/ImportTransactions'; import LoadBackup from 'loot-design/src/components/modals/LoadBackup'; import PlaidExternalMsg from 'loot-design/src/components/modals/PlaidExternalMsg'; -import ImportTransactions from 'loot-design/src/components/modals/ImportTransactions'; -import EditField from 'loot-design/src/components/modals/EditField'; +import SelectLinkedAccounts from 'loot-design/src/components/modals/SelectLinkedAccounts'; -import CreateAccount from './modals/CreateAccount'; -import ManagePayeesWithData from './payees/ManagePayeesWithData'; -import ManageRules from './modals/ManageRules'; -import EditRule from './modals/EditRule'; -import MergeUnusedPayees from './modals/MergeUnusedPayees'; import ConfirmCategoryDelete from './modals/ConfirmCategoryDelete'; -import WelcomeScreen from './modals/WelcomeScreen'; +import CreateAccount from './modals/CreateAccount'; import CreateEncryptionKey from './modals/CreateEncryptionKey'; +import EditRule from './modals/EditRule'; import FixEncryptionKey from './modals/FixEncryptionKey'; +import ManageRules from './modals/ManageRules'; +import MergeUnusedPayees from './modals/MergeUnusedPayees'; +import WelcomeScreen from './modals/WelcomeScreen'; +import ManagePayeesWithData from './payees/ManagePayeesWithData'; function Modals({ history, diff --git a/packages/desktop-client/src/components/Notifications.js b/packages/desktop-client/src/components/Notifications.js index 3875c49..c8ae15c 100644 --- a/packages/desktop-client/src/components/Notifications.js +++ b/packages/desktop-client/src/components/Notifications.js @@ -12,9 +12,9 @@ import { Stack, ExternalLink } from 'loot-design/src/components/common'; +import { styles, colors } from 'loot-design/src/style'; import Delete from 'loot-design/src/svg/Delete'; import Loading from 'loot-design/src/svg/v1/AnimatedLoading'; -import { styles, colors } from 'loot-design/src/style'; function compileMessage(message, actions, setLoading, onRemove) { return ( diff --git a/packages/desktop-client/src/components/Settings.js b/packages/desktop-client/src/components/Settings.js index f2cb991..616daca 100644 --- a/packages/desktop-client/src/components/Settings.js +++ b/packages/desktop-client/src/components/Settings.js @@ -5,6 +5,10 @@ import { Route, Switch, Redirect } from 'react-router-dom'; import { css } from 'glamor'; import * as actions from 'loot-core/src/client/actions'; +import Platform from 'loot-core/src/client/platform'; +import { send, listen } from 'loot-core/src/platform/client/fetch'; +import { numberFormats } from 'loot-core/src/shared/util'; +import { Information } from 'loot-design/src/components/alerts'; import { View, Text, @@ -12,12 +16,8 @@ import { ButtonWithLoading, AnchorLink } from 'loot-design/src/components/common'; -import { send, listen } from 'loot-core/src/platform/client/fetch'; -import { numberFormats } from 'loot-core/src/shared/util'; import { styles, colors } from 'loot-design/src/style'; -import { Information } from 'loot-design/src/components/alerts'; import ExpandArrow from 'loot-design/src/svg/ExpandArrow'; -import Platform from 'loot-core/src/client/platform'; import useServerVersion from '../hooks/useServerVersion'; diff --git a/packages/desktop-client/src/components/SidebarWithData.js b/packages/desktop-client/src/components/SidebarWithData.js index 1943bbb..0c35a02 100644 --- a/packages/desktop-client/src/components/SidebarWithData.js +++ b/packages/desktop-client/src/components/SidebarWithData.js @@ -4,8 +4,9 @@ import { withRouter } from 'react-router-dom'; import { bindActionCreators } from 'redux'; +import * as actions from 'loot-core/src/client/actions'; +import * as queries from 'loot-core/src/client/queries'; import { send } from 'loot-core/src/platform/client/fetch'; -import { styles, colors } from 'loot-design/src/style'; import { Button, Input, @@ -13,8 +14,7 @@ import { Text } from 'loot-design/src/components/common'; import { Sidebar } from 'loot-design/src/components/sidebar'; -import * as actions from 'loot-core/src/client/actions'; -import * as queries from 'loot-core/src/client/queries'; +import { styles, colors } from 'loot-design/src/style'; function EditableBudgetName({ prefs, savePrefs }) { const [editing, setEditing] = useState(false); diff --git a/packages/desktop-client/src/components/SpreadsheetInterface.js b/packages/desktop-client/src/components/SpreadsheetInterface.js index 4066530..d21e32c 100644 --- a/packages/desktop-client/src/components/SpreadsheetInterface.js +++ b/packages/desktop-client/src/components/SpreadsheetInterface.js @@ -1,7 +1,7 @@ import React from 'react'; -import Cell from 'loot-design/src/components/spreadsheet/Cell'; import { View } from 'loot-design/src/components/common'; +import Cell from 'loot-design/src/components/spreadsheet/Cell'; function SpreadsheetInterface() { return ( diff --git a/packages/desktop-client/src/components/Titlebar.js b/packages/desktop-client/src/components/Titlebar.js index dcbdd8f..c0b807c 100644 --- a/packages/desktop-client/src/components/Titlebar.js +++ b/packages/desktop-client/src/components/Titlebar.js @@ -1,12 +1,11 @@ import React, { useState, useEffect, useRef, useContext } from 'react'; -import { Switch, Route, withRouter } from 'react-router-dom'; import { connect } from 'react-redux'; +import { Switch, Route, withRouter } from 'react-router-dom'; import * as actions from 'loot-core/src/client/actions'; +import Platform from 'loot-core/src/client/platform'; import * as queries from 'loot-core/src/client/queries'; import { listen } from 'loot-core/src/platform/client/fetch'; -import Platform from 'loot-core/src/client/platform'; -import { colors } from 'loot-design/src/style'; import { View, Text, @@ -17,16 +16,17 @@ import { P } from 'loot-design/src/components/common'; import SheetValue from 'loot-design/src/components/spreadsheet/SheetValue'; -import ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1'; -import NavigationMenu from 'loot-design/src/svg/v2/NavigationMenu'; +import { colors } from 'loot-design/src/style'; import ArrowLeft from 'loot-design/src/svg/v1/ArrowLeft'; import AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle'; +import ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1'; +import NavigationMenu from 'loot-design/src/svg/v2/NavigationMenu'; -import { MonthCountSelector } from './budget/MonthCountSelector'; import AccountSyncCheck from './accounts/AccountSyncCheck'; -import LoggedInUser from './LoggedInUser'; import AnimatedRefresh from './AnimatedRefresh'; +import { MonthCountSelector } from './budget/MonthCountSelector'; import { useSidebar } from './FloatableSidebar'; +import LoggedInUser from './LoggedInUser'; export let TitlebarContext = React.createContext(); diff --git a/packages/desktop-client/src/components/Tutorial.js b/packages/desktop-client/src/components/Tutorial.js index 3cbe6e9..9f70791 100644 --- a/packages/desktop-client/src/components/Tutorial.js +++ b/packages/desktop-client/src/components/Tutorial.js @@ -7,17 +7,17 @@ import { bindActionCreators } from 'redux'; import * as actions from 'loot-core/src/client/actions'; -import Intro from './tutorial/Intro'; -import BudgetSummary from './tutorial/BudgetSummary'; import BudgetCategories from './tutorial/BudgetCategories'; import BudgetInitial from './tutorial/BudgetInitial'; +import BudgetNewIncome from './tutorial/BudgetNewIncome'; +import BudgetNextMonth from './tutorial/BudgetNextMonth'; +import BudgetSummary from './tutorial/BudgetSummary'; +import CategoryBalance from './tutorial/CategoryBalance'; +import Final from './tutorial/Final'; +import Intro from './tutorial/Intro'; +import Overspending from './tutorial/Overspending'; import TransactionAdd from './tutorial/TransactionAdd'; import TransactionEnter from './tutorial/TransactionEnter'; -import BudgetNewIncome from './tutorial/BudgetNewIncome'; -import CategoryBalance from './tutorial/CategoryBalance'; -import Overspending from './tutorial/Overspending'; -import BudgetNextMonth from './tutorial/BudgetNextMonth'; -import Final from './tutorial/Final'; function generatePath(innerRect, outerRect) { const i = innerRect; diff --git a/packages/desktop-client/src/components/accounts/Account.js b/packages/desktop-client/src/components/accounts/Account.js index 636f557..1486142 100644 --- a/packages/desktop-client/src/components/accounts/Account.js +++ b/packages/desktop-client/src/components/accounts/Account.js @@ -2,11 +2,27 @@ import React, { useState, useEffect, useRef, useMemo } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { Redirect, useParams, useHistory, useLocation } from 'react-router-dom'; -import { bindActionCreators } from 'redux'; import { debounce } from 'debounce'; +import { bindActionCreators } from 'redux'; -import { send, listen } from 'loot-core/src/platform/client/fetch'; import * as actions from 'loot-core/src/client/actions'; +import { + SchedulesProvider, + useCachedSchedules +} from 'loot-core/src/client/data-hooks/schedules'; +import * as queries from 'loot-core/src/client/queries'; +import q, { runQuery, pagedQuery } from 'loot-core/src/client/query-helpers'; +import { send, listen } from 'loot-core/src/platform/client/fetch'; +import { + deleteTransaction, + updateTransaction, + ungroupTransactions +} from 'loot-core/src/shared/transactions'; +import { + currencyToInteger, + applyChanges, + groupById +} from 'loot-core/src/shared/util'; import { View, Text, @@ -18,46 +34,30 @@ import { Menu, Stack } from 'loot-design/src/components/common'; -import { - currencyToInteger, - applyChanges, - groupById -} from 'loot-core/src/shared/util'; -import DotsHorizontalTriple from 'loot-design/src/svg/v1/DotsHorizontalTriple'; -import Pencil1 from 'loot-design/src/svg/v2/Pencil1'; -import SearchAlternate from 'loot-design/src/svg/v2/SearchAlternate'; -import DownloadThickBottom from 'loot-design/src/svg/v2/DownloadThickBottom'; -import Add from 'loot-design/src/svg/v1/Add'; +import { KeyHandlers } from 'loot-design/src/components/KeyHandlers'; +import CellValue from 'loot-design/src/components/spreadsheet/CellValue'; import format from 'loot-design/src/components/spreadsheet/format'; import useSheetValue from 'loot-design/src/components/spreadsheet/useSheetValue'; -import CellValue from 'loot-design/src/components/spreadsheet/CellValue'; -import ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1'; -import CheckCircle1 from 'loot-design/src/svg/v2/CheckCircle1'; -import Loading from 'loot-design/src/svg/v1/AnimatedLoading'; -import ArrowsExpand3 from 'loot-design/src/svg/v2/ArrowsExpand3'; -import ArrowsShrink3 from 'loot-design/src/svg/v2/ArrowsShrink3'; -import * as queries from 'loot-core/src/client/queries'; -import q, { runQuery, pagedQuery } from 'loot-core/src/client/query-helpers'; import { SelectedItemsButton } from 'loot-design/src/components/table'; -import { - deleteTransaction, - updateTransaction, - ungroupTransactions -} from 'loot-core/src/shared/transactions'; -import { styles, colors } from 'loot-design/src/style'; import { SelectedProviderWithItems, useSelectedItems } from 'loot-design/src/components/useSelected'; -import { KeyHandlers } from 'loot-design/src/components/KeyHandlers'; -import { - SchedulesProvider, - useCachedSchedules -} from 'loot-core/src/client/data-hooks/schedules'; +import { styles, colors } from 'loot-design/src/style'; +import Add from 'loot-design/src/svg/v1/Add'; +import Loading from 'loot-design/src/svg/v1/AnimatedLoading'; +import DotsHorizontalTriple from 'loot-design/src/svg/v1/DotsHorizontalTriple'; +import ArrowButtonRight1 from 'loot-design/src/svg/v2/ArrowButtonRight1'; +import ArrowsExpand3 from 'loot-design/src/svg/v2/ArrowsExpand3'; +import ArrowsShrink3 from 'loot-design/src/svg/v2/ArrowsShrink3'; +import CheckCircle1 from 'loot-design/src/svg/v2/CheckCircle1'; +import DownloadThickBottom from 'loot-design/src/svg/v2/DownloadThickBottom'; +import Pencil1 from 'loot-design/src/svg/v2/Pencil1'; +import SearchAlternate from 'loot-design/src/svg/v2/SearchAlternate'; import { authorizeBank } from '../../plaid'; -import AnimatedRefresh from '../AnimatedRefresh'; import { useActiveLocation } from '../ActiveLocation'; +import AnimatedRefresh from '../AnimatedRefresh'; import { FilterButton, AppliedFilters } from './Filters'; import TransactionList from './TransactionList'; import { diff --git a/packages/desktop-client/src/components/accounts/AccountSyncCheck.js b/packages/desktop-client/src/components/accounts/AccountSyncCheck.js index c6e6955..04d25b1 100644 --- a/packages/desktop-client/src/components/accounts/AccountSyncCheck.js +++ b/packages/desktop-client/src/components/accounts/AccountSyncCheck.js @@ -3,8 +3,8 @@ import { connect } from 'react-redux'; import * as actions from 'loot-core/src/client/actions'; import { View, Button, Tooltip } from 'loot-design/src/components/common'; -import ExclamationOutline from 'loot-design/src/svg/v1/ExclamationOutline'; import { colors } from 'loot-design/src/style'; +import ExclamationOutline from 'loot-design/src/svg/v1/ExclamationOutline'; import { reauthorizeBank } from '../../plaid'; diff --git a/packages/desktop-client/src/components/accounts/Filters.js b/packages/desktop-client/src/components/accounts/Filters.js index 495bfe7..d366dd6 100644 --- a/packages/desktop-client/src/components/accounts/Filters.js +++ b/packages/desktop-client/src/components/accounts/Filters.js @@ -1,25 +1,15 @@ import React, { useState, useRef, useEffect, useReducer } from 'react'; import { useSelector } from 'react-redux'; -import scopeTab from 'react-modal/lib/helpers/scopeTab'; import { parse as parseDate, format as formatDate, isValid as isDateValid } from 'date-fns'; +import scopeTab from 'react-modal/lib/helpers/scopeTab'; import { send } from 'loot-core/src/platform/client/fetch'; import { getMonthYearFormat } from 'loot-core/src/shared/months'; -import { titleFirst } from 'loot-core/src/shared/util'; -import { - View, - Text, - Tooltip, - Stack, - Button, - Menu, - CustomSelect -} from 'loot-design/src/components/common'; import { mapField, friendlyOp, @@ -30,12 +20,22 @@ import { FIELD_TYPES, TYPE_INFO } from 'loot-core/src/shared/rules'; +import { titleFirst } from 'loot-core/src/shared/util'; +import { + View, + Text, + Tooltip, + Stack, + Button, + Menu, + CustomSelect +} from 'loot-design/src/components/common'; +import { colors } from 'loot-design/src/style'; import DeleteIcon from 'loot-design/src/svg/Delete'; import SettingsSliderAlternate from 'loot-design/src/svg/v2/SettingsSliderAlternate'; -import { colors } from 'loot-design/src/style'; -import GenericInput from '../util/GenericInput'; import { Value } from '../modals/ManageRules'; +import GenericInput from '../util/GenericInput'; let filterFields = [ 'date', diff --git a/packages/desktop-client/src/components/accounts/SimpleTransactionsTable.js b/packages/desktop-client/src/components/accounts/SimpleTransactionsTable.js index 1db3fa0..819b3ca 100644 --- a/packages/desktop-client/src/components/accounts/SimpleTransactionsTable.js +++ b/packages/desktop-client/src/components/accounts/SimpleTransactionsTable.js @@ -7,6 +7,11 @@ import { isValid as isDateValid } from 'date-fns'; +import { + getAccountsById, + getCategoriesById +} from 'loot-core/src/client/reducers/queries'; +import { integerToCurrency } from 'loot-core/src/shared/util'; import { Table, Row, @@ -18,13 +23,8 @@ import { useSelectedItems, useSelectedDispatch } from 'loot-design/src/components/useSelected'; -import { integerToCurrency } from 'loot-core/src/shared/util'; -import { - getAccountsById, - getCategoriesById -} from 'loot-core/src/client/reducers/queries'; -import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize'; import { styles } from 'loot-design/src/style'; +import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize'; import DisplayId from '../util/DisplayId'; diff --git a/packages/desktop-client/src/components/accounts/TransactionList.js b/packages/desktop-client/src/components/accounts/TransactionList.js index 7ea870d..8e2f16b 100644 --- a/packages/desktop-client/src/components/accounts/TransactionList.js +++ b/packages/desktop-client/src/components/accounts/TransactionList.js @@ -1,6 +1,7 @@ import React, { useRef, useEffect, useCallback, useLayoutEffect } from 'react'; import { useDispatch } from 'react-redux'; +import { send } from 'loot-core/src/platform/client/fetch'; import { splitTransaction, updateTransaction, @@ -8,7 +9,6 @@ import { realizeTempTransactions, applyTransactionDiff } from 'loot-core/src/shared/transactions'; -import { send } from 'loot-core/src/platform/client/fetch'; import { getChangedValues, applyChanges } from 'loot-core/src/shared/util'; import { TransactionTable } from './TransactionsTable'; diff --git a/packages/desktop-client/src/components/accounts/TransactionsTable.js b/packages/desktop-client/src/components/accounts/TransactionsTable.js index 0fd3469..3613391 100644 --- a/packages/desktop-client/src/components/accounts/TransactionsTable.js +++ b/packages/desktop-client/src/components/accounts/TransactionsTable.js @@ -16,36 +16,31 @@ import { isValid as isDateValid } from 'date-fns'; -import { View, Text, Tooltip, Button } from 'loot-design/src/components/common'; -import CategoryAutocomplete from 'loot-design/src/components/CategorySelect'; -import PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete'; -import AccountAutocomplete from 'loot-design/src/components/AccountAutocomplete'; -import DateSelect from 'loot-design/src/components/DateSelect'; -import RightArrow2 from 'loot-design/src/svg/RightArrow2'; -import LeftArrow2 from 'loot-design/src/svg/LeftArrow2'; -import Hyperlink2 from 'loot-design/src/svg/v2/Hyperlink2'; -import CheveronDown from 'loot-design/src/svg/v1/CheveronDown'; -import CalendarIcon from 'loot-design/src/svg/v2/Calendar'; -import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize'; -import { - integerToCurrency, - amountToInteger, - titleFirst -} from 'loot-core/src/shared/util'; -import evalArithmetic from 'loot-core/src/shared/arithmetic'; +import { useCachedSchedules } from 'loot-core/src/client/data-hooks/schedules'; import { getAccountsById, getPayeesById, getCategoriesById } from 'loot-core/src/client/reducers/queries'; +import evalArithmetic from 'loot-core/src/shared/arithmetic'; import { currentDay } from 'loot-core/src/shared/months'; +import { getScheduledAmount } from 'loot-core/src/shared/schedules'; import { splitTransaction, updateTransaction, deleteTransaction, addSplitTransaction } from 'loot-core/src/shared/transactions'; -import { styles, colors } from 'loot-design/src/style'; +import { + integerToCurrency, + amountToInteger, + titleFirst +} from 'loot-core/src/shared/util'; +import AccountAutocomplete from 'loot-design/src/components/AccountAutocomplete'; +import CategoryAutocomplete from 'loot-design/src/components/CategorySelect'; +import { View, Text, Tooltip, Button } from 'loot-design/src/components/common'; +import DateSelect from 'loot-design/src/components/DateSelect'; +import PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete'; import { Cell, Field, @@ -58,13 +53,18 @@ import { useTableNavigator, Table } from 'loot-design/src/components/table'; +import { useMergedRefs } from 'loot-design/src/components/useMergedRefs'; import { useSelectedDispatch, useSelectedItems } from 'loot-design/src/components/useSelected'; -import { useMergedRefs } from 'loot-design/src/components/useMergedRefs'; -import { useCachedSchedules } from 'loot-core/src/client/data-hooks/schedules'; -import { getScheduledAmount } from 'loot-core/src/shared/schedules'; +import { styles, colors } from 'loot-design/src/style'; +import LeftArrow2 from 'loot-design/src/svg/LeftArrow2'; +import RightArrow2 from 'loot-design/src/svg/RightArrow2'; +import CheveronDown from 'loot-design/src/svg/v1/CheveronDown'; +import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize'; +import CalendarIcon from 'loot-design/src/svg/v2/Calendar'; +import Hyperlink2 from 'loot-design/src/svg/v2/Hyperlink2'; import { getStatusProps } from '../schedules/StatusBadge'; diff --git a/packages/desktop-client/src/components/accounts/TransactionsTable.test.js b/packages/desktop-client/src/components/accounts/TransactionsTable.test.js index f3f5519..fef6ec8 100644 --- a/packages/desktop-client/src/components/accounts/TransactionsTable.test.js +++ b/packages/desktop-client/src/components/accounts/TransactionsTable.test.js @@ -1,23 +1,23 @@ import React from 'react'; -import { act } from 'react-dom/test-utils'; import { render, fireEvent } from '@testing-library/react'; import { format as formatDate, parse as parseDate } from 'date-fns'; +import { act } from 'react-dom/test-utils'; -import { integerToCurrency } from 'loot-core/src/shared/util'; -import { initServer } from 'loot-core/src/platform/client/fetch'; import { generateTransaction, generateAccount, generateCategoryGroups, TestProvider } from 'loot-core/src/mocks'; +import { initServer } from 'loot-core/src/platform/client/fetch'; import { addSplitTransaction, realizeTempTransactions, splitTransaction, updateTransaction } from 'loot-core/src/shared'; +import { integerToCurrency } from 'loot-core/src/shared/util'; import { SelectedProviderWithItems } from 'loot-design/src/components'; import { SplitsExpandedProvider, TransactionTable } from './TransactionsTable'; diff --git a/packages/desktop-client/src/components/budget/MonthCountSelector.js b/packages/desktop-client/src/components/budget/MonthCountSelector.js index b11b28b..b944948 100644 --- a/packages/desktop-client/src/components/budget/MonthCountSelector.js +++ b/packages/desktop-client/src/components/budget/MonthCountSelector.js @@ -1,8 +1,8 @@ import React from 'react'; -import { colors } from 'loot-design/src/style'; -import { View } from 'loot-design/src/components/common'; import { useBudgetMonthCount } from 'loot-design/src/components/budget/BudgetMonthCountContext'; +import { View } from 'loot-design/src/components/common'; +import { colors } from 'loot-design/src/style'; import CalendarIcon from 'loot-design/src/svg/v2/Calendar'; function Calendar({ color, onClick }) { diff --git a/packages/desktop-client/src/components/budget/index.js b/packages/desktop-client/src/components/budget/index.js index a063fe8..5a73395 100644 --- a/packages/desktop-client/src/components/budget/index.js +++ b/packages/desktop-client/src/components/budget/index.js @@ -3,16 +3,6 @@ import { connect } from 'react-redux'; import * as actions from 'loot-core/src/client/actions'; import { send, listen } from 'loot-core/src/platform/client/fetch'; -import * as monthUtils from 'loot-core/src/shared/months'; -import { getValidMonthBounds } from 'loot-design/src/components/budget/MonthsContext'; -import * as rollover from 'loot-design/src/components/budget/rollover/rollover-components'; -import { RolloverContext } from 'loot-design/src/components/budget/rollover/RolloverContext'; -import * as report from 'loot-design/src/components/budget/report/components'; -import { ReportProvider } from 'loot-design/src/components/budget/report/ReportContext'; -import DynamicBudgetTable from 'loot-design/src/components/budget/DynamicBudgetTable'; -import SpreadsheetContext from 'loot-design/src/components/spreadsheet/SpreadsheetContext'; -import { View } from 'loot-design/src/components/common'; -import { styles } from 'loot-design/src/style'; import { addCategory, updateCategory, @@ -23,6 +13,16 @@ import { updateGroup, deleteGroup } from 'loot-core/src/shared/categories.js'; +import * as monthUtils from 'loot-core/src/shared/months'; +import DynamicBudgetTable from 'loot-design/src/components/budget/DynamicBudgetTable'; +import { getValidMonthBounds } from 'loot-design/src/components/budget/MonthsContext'; +import * as report from 'loot-design/src/components/budget/report/components'; +import { ReportProvider } from 'loot-design/src/components/budget/report/ReportContext'; +import * as rollover from 'loot-design/src/components/budget/rollover/rollover-components'; +import { RolloverContext } from 'loot-design/src/components/budget/rollover/RolloverContext'; +import { View } from 'loot-design/src/components/common'; +import SpreadsheetContext from 'loot-design/src/components/spreadsheet/SpreadsheetContext'; +import { styles } from 'loot-design/src/style'; import { TitlebarContext } from '../Titlebar'; diff --git a/packages/desktop-client/src/components/manager/ConfigServer.js b/packages/desktop-client/src/components/manager/ConfigServer.js index 81ca32e..9ab0660 100644 --- a/packages/desktop-client/src/components/manager/ConfigServer.js +++ b/packages/desktop-client/src/components/manager/ConfigServer.js @@ -2,6 +2,8 @@ import React, { useState, useEffect } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; +import { signOut, loggedIn } from 'loot-core/src/client/actions/user'; +import { send } from 'loot-core/src/platform/client/fetch'; import { View, Text, @@ -9,8 +11,6 @@ import { ButtonWithLoading } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import { signOut, loggedIn } from 'loot-core/src/client/actions/user'; -import { send } from 'loot-core/src/platform/client/fetch'; import { Title, Input } from './subscribe/common'; diff --git a/packages/desktop-client/src/components/manager/ManagementApp.js b/packages/desktop-client/src/components/manager/ManagementApp.js index 4bb4b1a..f053515 100644 --- a/packages/desktop-client/src/components/manager/ManagementApp.js +++ b/packages/desktop-client/src/components/manager/ManagementApp.js @@ -8,16 +8,16 @@ import * as actions from 'loot-core/src/client/actions'; import { View, Text } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; +import useServerVersion from '../../hooks/useServerVersion'; import LoggedInUser from '../LoggedInUser'; import Notifications from '../Notifications'; -import useServerVersion from '../../hooks/useServerVersion'; -import ServerURL from './ServerURL'; -import Modals from './Modals'; -import Login from './subscribe/Login'; -import Bootstrap from './subscribe/Bootstrap'; -import Error from './subscribe/Error'; -import ChangePassword from './subscribe/ChangePassword'; import ConfigServer from './ConfigServer'; +import Modals from './Modals'; +import ServerURL from './ServerURL'; +import Bootstrap from './subscribe/Bootstrap'; +import ChangePassword from './subscribe/ChangePassword'; +import Error from './subscribe/Error'; +import Login from './subscribe/Login'; function Version() { const version = useServerVersion(); diff --git a/packages/desktop-client/src/components/manager/Modals.js b/packages/desktop-client/src/components/manager/Modals.js index 6fa892a..e5f1a5d 100644 --- a/packages/desktop-client/src/components/manager/Modals.js +++ b/packages/desktop-client/src/components/manager/Modals.js @@ -1,19 +1,19 @@ import React from 'react'; import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; import Component from '@reactions/component'; +import { bindActionCreators } from 'redux'; -import { send } from 'loot-core/src/platform/client/fetch'; import * as actions from 'loot-core/src/client/actions'; +import { send } from 'loot-core/src/platform/client/fetch'; import { View } from 'loot-design/src/components/common'; import BudgetList from 'loot-design/src/components/manager/BudgetList'; -import LoadBackup from 'loot-design/src/components/modals/LoadBackup'; +import DeleteFile from 'loot-design/src/components/manager/DeleteFile'; import Import from 'loot-design/src/components/manager/Import'; +import ImportActual from 'loot-design/src/components/manager/ImportActual'; import ImportYNAB4 from 'loot-design/src/components/manager/ImportYNAB4'; import ImportYNAB5 from 'loot-design/src/components/manager/ImportYNAB5'; -import ImportActual from 'loot-design/src/components/manager/ImportActual'; -import DeleteFile from 'loot-design/src/components/manager/DeleteFile'; +import LoadBackup from 'loot-design/src/components/modals/LoadBackup'; import CreateEncryptionKey from '../modals/CreateEncryptionKey'; import FixEncryptionKey from '../modals/FixEncryptionKey'; diff --git a/packages/desktop-client/src/components/manager/ServerURL.js b/packages/desktop-client/src/components/manager/ServerURL.js index ef3f6f0..16a8db2 100644 --- a/packages/desktop-client/src/components/manager/ServerURL.js +++ b/packages/desktop-client/src/components/manager/ServerURL.js @@ -1,7 +1,7 @@ import React, { useState, useEffect } from 'react'; -import { View, Text, AnchorLink } from 'loot-design/src/components/common'; import { send } from 'loot-core/src/platform/client/fetch'; +import { View, Text, AnchorLink } from 'loot-design/src/components/common'; export default function ServerURL() { let [url, setUrl] = useState(null); diff --git a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.js b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.js index 7824a3f..00d0cdd 100644 --- a/packages/desktop-client/src/components/manager/subscribe/Bootstrap.js +++ b/packages/desktop-client/src/components/manager/subscribe/Bootstrap.js @@ -2,14 +2,14 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; +import { createBudget } from 'loot-core/src/client/actions/budgets'; +import { loggedIn } from 'loot-core/src/client/actions/user'; +import { send } from 'loot-core/src/platform/client/fetch'; import { View, Text, Button } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import { loggedIn } from 'loot-core/src/client/actions/user'; -import { createBudget } from 'loot-core/src/client/actions/budgets'; -import { send } from 'loot-core/src/platform/client/fetch'; -import { ConfirmPasswordForm } from './ConfirmPasswordForm'; import { useBootstrapped, Title } from './common'; +import { ConfirmPasswordForm } from './ConfirmPasswordForm'; export default function Bootstrap() { let dispatch = useDispatch(); diff --git a/packages/desktop-client/src/components/manager/subscribe/ChangePassword.js b/packages/desktop-client/src/components/manager/subscribe/ChangePassword.js index b77834a..abda7d4 100644 --- a/packages/desktop-client/src/components/manager/subscribe/ChangePassword.js +++ b/packages/desktop-client/src/components/manager/subscribe/ChangePassword.js @@ -2,12 +2,12 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; +import { send } from 'loot-core/src/platform/client/fetch'; import { View, Text, Button } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import { send } from 'loot-core/src/platform/client/fetch'; -import { ConfirmPasswordForm } from './ConfirmPasswordForm'; import { Title } from './common'; +import { ConfirmPasswordForm } from './ConfirmPasswordForm'; export default function ChangePassword() { let dispatch = useDispatch(); diff --git a/packages/desktop-client/src/components/manager/subscribe/Login.js b/packages/desktop-client/src/components/manager/subscribe/Login.js index 0844a46..b0629a9 100644 --- a/packages/desktop-client/src/components/manager/subscribe/Login.js +++ b/packages/desktop-client/src/components/manager/subscribe/Login.js @@ -2,6 +2,9 @@ import React, { useState } from 'react'; import { useDispatch } from 'react-redux'; import { useHistory } from 'react-router-dom'; +import { createBudget } from 'loot-core/src/client/actions/budgets'; +import { loggedIn } from 'loot-core/src/client/actions/user'; +import { send } from 'loot-core/src/platform/client/fetch'; import { View, Text, @@ -9,9 +12,6 @@ import { ButtonWithLoading } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import { loggedIn } from 'loot-core/src/client/actions/user'; -import { createBudget } from 'loot-core/src/client/actions/budgets'; -import { send } from 'loot-core/src/platform/client/fetch'; import { useBootstrapped, Title, Input } from './common'; diff --git a/packages/desktop-client/src/components/manager/subscribe/common.js b/packages/desktop-client/src/components/manager/subscribe/common.js index 2d0778f..9d2ca11 100644 --- a/packages/desktop-client/src/components/manager/subscribe/common.js +++ b/packages/desktop-client/src/components/manager/subscribe/common.js @@ -1,13 +1,13 @@ import React, { useEffect, useState } from 'react'; import { useHistory, useLocation } from 'react-router-dom'; +import { send } from 'loot-core/src/platform/client/fetch'; import { Text, Button, Input as BaseInput } from 'loot-design/src/components/common'; import { colors, styles } from 'loot-design/src/style'; -import { send } from 'loot-core/src/platform/client/fetch'; // There are two URLs that dance with each other: `/login` and // `/bootstrap`. Both of these URLs check the state of the the server diff --git a/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js b/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js index 74af79b..d737bf1 100644 --- a/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js +++ b/packages/desktop-client/src/components/modals/ConfirmCategoryDelete.js @@ -1,5 +1,6 @@ import React from 'react'; +import { NativeCategorySelect } from 'loot-design/src/components/CategorySelect'; import { View, Text, @@ -8,7 +9,6 @@ import { Button } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import { NativeCategorySelect } from 'loot-design/src/components/CategorySelect'; class ConfirmCategoryDelete extends React.Component { state = { transferCategory: null, error: null }; diff --git a/packages/desktop-client/src/components/modals/CreateEncryptionKey.js b/packages/desktop-client/src/components/modals/CreateEncryptionKey.js index ff5ad00..c1c0619 100644 --- a/packages/desktop-client/src/components/modals/CreateEncryptionKey.js +++ b/packages/desktop-client/src/components/modals/CreateEncryptionKey.js @@ -2,6 +2,8 @@ import React, { useState } from 'react'; import { css } from 'glamor'; +import { send } from 'loot-core/src/platform/client/fetch'; +import { getCreateKeyError } from 'loot-core/src/shared/errors'; import { View, Text, @@ -13,9 +15,7 @@ import { Input, InitialFocus } from 'loot-design/src/components/common'; -import { send } from 'loot-core/src/platform/client/fetch'; import { colors } from 'loot-design/src/style'; -import { getCreateKeyError } from 'loot-core/src/shared/errors'; export default function CreateEncryptionKey({ modalProps, diff --git a/packages/desktop-client/src/components/modals/EditRule.js b/packages/desktop-client/src/components/modals/EditRule.js index 9d33ca0..abfdd1e 100644 --- a/packages/desktop-client/src/components/modals/EditRule.js +++ b/packages/desktop-client/src/components/modals/EditRule.js @@ -5,21 +5,10 @@ import { initiallyLoadPayees, setUndoEnabled } from 'loot-core/src/client/actions/queries'; +import { useSchedules } from 'loot-core/src/client/data-hooks/schedules'; import q, { runQuery } from 'loot-core/src/client/query-helpers'; -import { - View, - Text, - Modal, - Button, - Stack, - CustomSelect, - Tooltip -} from 'loot-design/src/components/common'; import { send } from 'loot-core/src/platform/client/fetch'; -import { colors } from 'loot-design/src/style'; -import SubtractIcon from 'loot-design/src/svg/Subtract'; -import AddIcon from 'loot-design/src/svg/Add'; -import InformationOutline from 'loot-design/src/svg/v1/InformationOutline'; +import * as monthUtils from 'loot-core/src/shared/months'; import { mapField, friendlyOp, @@ -30,22 +19,33 @@ import { FIELD_TYPES, TYPE_INFO } from 'loot-core/src/shared/rules'; -import useSelected, { - SelectedProvider -} from 'loot-design/src/components/useSelected'; -import { useSchedules } from 'loot-core/src/client/data-hooks/schedules'; import { integerToCurrency, integerToAmount, amountToInteger } from 'loot-core/src/shared/util'; -import * as monthUtils from 'loot-core/src/shared/months'; +import { + View, + Text, + Modal, + Button, + Stack, + CustomSelect, + Tooltip +} from 'loot-design/src/components/common'; +import useSelected, { + SelectedProvider +} from 'loot-design/src/components/useSelected'; +import { colors } from 'loot-design/src/style'; +import AddIcon from 'loot-design/src/svg/Add'; +import SubtractIcon from 'loot-design/src/svg/Subtract'; +import InformationOutline from 'loot-design/src/svg/v1/InformationOutline'; import SimpleTransactionsTable from '../accounts/SimpleTransactionsTable'; import { StatusBadge } from '../schedules/StatusBadge'; +import { BetweenAmountInput } from '../util/AmountInput'; import DisplayId from '../util/DisplayId'; import GenericInput from '../util/GenericInput'; -import { BetweenAmountInput } from '../util/AmountInput'; function updateValue(array, value, update) { return array.map(v => (v === value ? update() : v)); diff --git a/packages/desktop-client/src/components/modals/FixEncryptionKey.js b/packages/desktop-client/src/components/modals/FixEncryptionKey.js index b196ee4..8f695e7 100644 --- a/packages/desktop-client/src/components/modals/FixEncryptionKey.js +++ b/packages/desktop-client/src/components/modals/FixEncryptionKey.js @@ -1,5 +1,7 @@ import React, { useState } from 'react'; +import { send } from 'loot-core/src/platform/client/fetch'; +import { getTestKeyError } from 'loot-core/src/shared/errors'; import { View, Text, @@ -12,9 +14,7 @@ import { InitialFocus, ExternalLink } from 'loot-design/src/components/common'; -import { send } from 'loot-core/src/platform/client/fetch'; import { colors } from 'loot-design/src/style'; -import { getTestKeyError } from 'loot-core/src/shared/errors'; export default function FixEncryptionKey({ modalProps, diff --git a/packages/desktop-client/src/components/modals/ManageRules.js b/packages/desktop-client/src/components/modals/ManageRules.js index 3fdd12c..7a31188 100644 --- a/packages/desktop-client/src/components/modals/ManageRules.js +++ b/packages/desktop-client/src/components/modals/ManageRules.js @@ -1,13 +1,23 @@ import React, { useState, useEffect, useRef, useCallback } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { css } from 'glamor'; import { format as formatDate, parseISO } from 'date-fns'; +import { css } from 'glamor'; -import * as undo from 'loot-core/src/platform/client/undo'; +import { pushModal } from 'loot-core/src/client/actions/modals'; import { initiallyLoadPayees } from 'loot-core/src/client/actions/queries'; import q from 'loot-core/src/client/query-helpers'; import { liveQueryContext } from 'loot-core/src/client/query-hooks'; +import { getPayeesById } from 'loot-core/src/client/reducers/queries'; +import { send } from 'loot-core/src/platform/client/fetch'; +import * as undo from 'loot-core/src/platform/client/undo'; +import { getMonthYearFormat } from 'loot-core/src/shared/months'; +import { mapField, friendlyOp } from 'loot-core/src/shared/rules'; +import { + extractScheduleConds, + getRecurringDescription +} from 'loot-core/src/shared/schedules'; +import { integerToCurrency } from 'loot-core/src/shared/util'; import { View, Text, @@ -30,18 +40,8 @@ import useSelected, { useSelectedItems, SelectedProvider } from 'loot-design/src/components/useSelected'; -import { integerToCurrency } from 'loot-core/src/shared/util'; -import { send } from 'loot-core/src/platform/client/fetch'; -import { pushModal } from 'loot-core/src/client/actions/modals'; -import { mapField, friendlyOp } from 'loot-core/src/shared/rules'; -import ArrowRight from 'loot-design/src/svg/RightArrow2'; import { colors } from 'loot-design/src/style'; -import { getMonthYearFormat } from 'loot-core/src/shared/months'; -import { - extractScheduleConds, - getRecurringDescription -} from 'loot-core/src/shared/schedules'; -import { getPayeesById } from 'loot-core/src/client/reducers/queries'; +import ArrowRight from 'loot-design/src/svg/RightArrow2'; let SchedulesQuery = liveQueryContext(q('schedules').select('*')); diff --git a/packages/desktop-client/src/components/modals/MergeUnusedPayees.js b/packages/desktop-client/src/components/modals/MergeUnusedPayees.js index 0f705e9..e76e85c 100644 --- a/packages/desktop-client/src/components/modals/MergeUnusedPayees.js +++ b/packages/desktop-client/src/components/modals/MergeUnusedPayees.js @@ -1,6 +1,9 @@ import React, { useState, useRef, useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; +import { replaceModal } from 'loot-core/src/client/actions/modals'; +import { send } from 'loot-core/src/platform/client/fetch'; +import { Information } from 'loot-design/src/components/alerts'; import { View, Text, @@ -9,10 +12,7 @@ import { Button, P } from 'loot-design/src/components/common'; -import { Information } from 'loot-design/src/components/alerts'; import { colors } from 'loot-design/src/style'; -import { send } from 'loot-core/src/platform/client/fetch'; -import { replaceModal } from 'loot-core/src/client/actions/modals'; let highlightStyle = { color: colors.p5 }; diff --git a/packages/desktop-client/src/components/payees/ManagePayeesWithData.js b/packages/desktop-client/src/components/payees/ManagePayeesWithData.js index 89be6a2..2b7c566 100644 --- a/packages/desktop-client/src/components/payees/ManagePayeesWithData.js +++ b/packages/desktop-client/src/components/payees/ManagePayeesWithData.js @@ -2,10 +2,10 @@ import React, { useState, useEffect, useRef } from 'react'; import { connect } from 'react-redux'; import * as actions from 'loot-core/src/client/actions'; -import * as undo from 'loot-core/src/platform/client/undo'; import { send, listen } from 'loot-core/src/platform/client/fetch'; -import { ManagePayees } from 'loot-design/src/components/payees'; +import * as undo from 'loot-core/src/platform/client/undo'; import { applyChanges } from 'loot-core/src/shared/util'; +import { ManagePayees } from 'loot-design/src/components/payees'; function ManagePayeesWithData({ history, diff --git a/packages/desktop-client/src/components/reports/CashFlow.js b/packages/desktop-client/src/components/reports/CashFlow.js index a970144..ec99a1a 100644 --- a/packages/desktop-client/src/components/reports/CashFlow.js +++ b/packages/desktop-client/src/components/reports/CashFlow.js @@ -2,6 +2,9 @@ import React, { useState, useEffect } from 'react'; import * as d from 'date-fns'; +import { send } from 'loot-core/src/platform/client/fetch'; +import * as monthUtils from 'loot-core/src/shared/months'; +import { integerToCurrency } from 'loot-core/src/shared/util'; import { View, Text, @@ -9,16 +12,12 @@ import { P, AlignedText } from 'loot-design/src/components/common'; -import { styles } from 'loot-design/src/style'; -import { send } from 'loot-core/src/platform/client/fetch'; -import * as monthUtils from 'loot-core/src/shared/months'; -import { integerToCurrency } from 'loot-core/src/shared/util'; -import { colors } from 'loot-design/src/style'; +import { colors, styles } from 'loot-design/src/style'; -import Header from './Header'; import Change from './Change'; -import CashFlowGraph from './graphs/CashFlowGraph'; import { cashFlowByDate } from './graphs/cash-flow-spreadsheet'; +import CashFlowGraph from './graphs/CashFlowGraph'; +import Header from './Header'; import useReport from './useReport'; import { useArgsMemo } from './util'; diff --git a/packages/desktop-client/src/components/reports/Change.js b/packages/desktop-client/src/components/reports/Change.js index cbdfc0f..09af126 100644 --- a/packages/desktop-client/src/components/reports/Change.js +++ b/packages/desktop-client/src/components/reports/Change.js @@ -1,9 +1,8 @@ import React from 'react'; -import { styles } from 'loot-design/src/style'; import { integerToCurrency } from 'loot-core/src/shared/util'; import { Block } from 'loot-design/src/components/common'; -import { colors } from 'loot-design/src/style'; +import { colors, styles } from 'loot-design/src/style'; function Change({ amount, style }) { return ( diff --git a/packages/desktop-client/src/components/reports/DateRange.js b/packages/desktop-client/src/components/reports/DateRange.js index 0a98466..e4c53df 100644 --- a/packages/desktop-client/src/components/reports/DateRange.js +++ b/packages/desktop-client/src/components/reports/DateRange.js @@ -2,8 +2,8 @@ import React from 'react'; import * as d from 'date-fns'; -import { colors } from 'loot-design/src/style'; import { Block } from 'loot-design/src/components/common'; +import { colors } from 'loot-design/src/style'; function DateRange({ start, end }) { start = d.parseISO(start); diff --git a/packages/desktop-client/src/components/reports/Header.js b/packages/desktop-client/src/components/reports/Header.js index 546f7c4..f834401 100644 --- a/packages/desktop-client/src/components/reports/Header.js +++ b/packages/desktop-client/src/components/reports/Header.js @@ -1,13 +1,13 @@ import React from 'react'; -import { styles } from 'loot-design/src/style'; +import * as monthUtils from 'loot-core/src/shared/months'; import { View, Select, Button, ButtonLink } from 'loot-design/src/components/common'; -import * as monthUtils from 'loot-core/src/shared/months'; +import { styles } from 'loot-design/src/style'; import ArrowLeft from 'loot-design/src/svg/v1/ArrowLeft'; function validateStart(allMonths, start, end) { diff --git a/packages/desktop-client/src/components/reports/NetWorth.js b/packages/desktop-client/src/components/reports/NetWorth.js index f2ffec7..9a17a1e 100644 --- a/packages/desktop-client/src/components/reports/NetWorth.js +++ b/packages/desktop-client/src/components/reports/NetWorth.js @@ -1,23 +1,22 @@ import React, { useState, useEffect } from 'react'; import { connect } from 'react-redux'; -import { bindActionCreators } from 'redux'; import * as d from 'date-fns'; +import { bindActionCreators } from 'redux'; import * as actions from 'loot-core/src/client/actions'; -import { View, P } from 'loot-design/src/components/common'; -import { styles } from 'loot-design/src/style'; +import { send } from 'loot-core/src/platform/client/fetch'; import * as monthUtils from 'loot-core/src/shared/months'; import { integerToCurrency } from 'loot-core/src/shared/util'; -import { send } from 'loot-core/src/platform/client/fetch'; +import { View, P } from 'loot-design/src/components/common'; +import { styles } from 'loot-design/src/style'; -import Header from './Header'; -import { fromDateRepr } from './util'; -import useReport from './useReport'; +import Change from './Change'; import netWorthSpreadsheet from './graphs/net-worth-spreadsheet'; import NetWorthGraph from './graphs/NetWorthGraph'; -import Change from './Change'; -import { useArgsMemo } from './util'; +import Header from './Header'; +import useReport from './useReport'; +import { fromDateRepr, useArgsMemo } from './util'; function NetWorth({ accounts }) { const [earliestMonth, setEarliestMonth] = useState(null); diff --git a/packages/desktop-client/src/components/reports/Overview.js b/packages/desktop-client/src/components/reports/Overview.js index 456a52c..8005e6c 100644 --- a/packages/desktop-client/src/components/reports/Overview.js +++ b/packages/desktop-client/src/components/reports/Overview.js @@ -5,21 +5,21 @@ import { bindActionCreators } from 'redux'; import { VictoryBar, VictoryGroup, VictoryVoronoiContainer } from 'victory'; import * as actions from 'loot-core/src/client/actions'; -import { View, Block, AnchorLink } from 'loot-design/src/components/common'; -import { colors, styles } from 'loot-design/src/style'; import * as monthUtils from 'loot-core/src/shared/months'; import { integerToCurrency } from 'loot-core/src/shared/util'; +import { View, Block, AnchorLink } from 'loot-design/src/components/common'; +import { colors, styles } from 'loot-design/src/style'; -import { useArgsMemo } from './util'; +import Change from './Change'; import theme from './chart-theme'; import Container from './Container'; +import DateRange from './DateRange'; +import { simpleCashFlow } from './graphs/cash-flow-spreadsheet'; +import netWorthSpreadsheet from './graphs/net-worth-spreadsheet'; +import NetWorthGraph from './graphs/NetWorthGraph'; import Tooltip from './Tooltip'; import useReport from './useReport'; -import netWorthSpreadsheet from './graphs/net-worth-spreadsheet'; -import { simpleCashFlow } from './graphs/cash-flow-spreadsheet'; -import NetWorthGraph from './graphs/NetWorthGraph'; -import Change from './Change'; -import DateRange from './DateRange'; +import { useArgsMemo } from './util'; function Card({ flex, to, style, children }) { const containerProps = { flex, margin: 15 }; diff --git a/packages/desktop-client/src/components/reports/Tooltip.js b/packages/desktop-client/src/components/reports/Tooltip.js index 254b9a2..81eb277 100644 --- a/packages/desktop-client/src/components/reports/Tooltip.js +++ b/packages/desktop-client/src/components/reports/Tooltip.js @@ -1,8 +1,8 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { VictoryTooltip } from 'victory'; import { css, before } from 'glamor'; +import { VictoryTooltip } from 'victory'; import { colors } from 'loot-design/src/style'; diff --git a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.js b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.js index 3091921..17da3c8 100644 --- a/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.js +++ b/packages/desktop-client/src/components/reports/graphs/CashFlowGraph.js @@ -1,5 +1,6 @@ import React from 'react'; +import * as d from 'date-fns'; import { VictoryChart, VictoryBar, @@ -8,13 +9,12 @@ import { VictoryVoronoiContainer, VictoryGroup } from 'victory'; -import * as d from 'date-fns'; import { colors } from 'loot-design/src/style'; +import theme from '../chart-theme'; import Container from '../Container'; import Tooltip from '../Tooltip'; -import theme from '../chart-theme'; function CashFlowGraph({ style, start, end, graphData, isConcise, compact }) { return ( diff --git a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js index 43502f5..93a8c17 100644 --- a/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js +++ b/packages/desktop-client/src/components/reports/graphs/NetWorthGraph.js @@ -1,5 +1,6 @@ import React from 'react'; +import * as d from 'date-fns'; import { VictoryChart, VictoryBar, @@ -8,11 +9,10 @@ import { VictoryVoronoiContainer, VictoryGroup } from 'victory'; -import * as d from 'date-fns'; +import theme from '../chart-theme'; import Container from '../Container'; import Tooltip from '../Tooltip'; -import theme from '../chart-theme'; function Area({ start, end, data, style, scale, range }) { const zero = scale.y(0); diff --git a/packages/desktop-client/src/components/reports/graphs/cash-flow-spreadsheet.js b/packages/desktop-client/src/components/reports/graphs/cash-flow-spreadsheet.js index a632d81..c555067 100644 --- a/packages/desktop-client/src/components/reports/graphs/cash-flow-spreadsheet.js +++ b/packages/desktop-client/src/components/reports/graphs/cash-flow-spreadsheet.js @@ -2,10 +2,10 @@ import React from 'react'; import * as d from 'date-fns'; -import * as monthUtils from 'loot-core/src/shared/months'; -import { AlignedText } from 'loot-design/src/components/common'; -import { integerToCurrency, integerToAmount } from 'loot-core/src/shared/util'; import q from 'loot-core/src/client/query-helpers'; +import * as monthUtils from 'loot-core/src/shared/months'; +import { integerToCurrency, integerToAmount } from 'loot-core/src/shared/util'; +import { AlignedText } from 'loot-design/src/components/common'; import { fromDateRepr, fromDateReprToDay, runAll, index } from '../util'; diff --git a/packages/desktop-client/src/components/reports/graphs/net-worth-spreadsheet.js b/packages/desktop-client/src/components/reports/graphs/net-worth-spreadsheet.js index 58135c5..b3de61c 100644 --- a/packages/desktop-client/src/components/reports/graphs/net-worth-spreadsheet.js +++ b/packages/desktop-client/src/components/reports/graphs/net-worth-spreadsheet.js @@ -2,14 +2,14 @@ import React from 'react'; import * as d from 'date-fns'; -import * as monthUtils from 'loot-core/src/shared/months'; -import { AlignedText } from 'loot-design/src/components/common'; import q, { runQuery } from 'loot-core/src/client/query-helpers'; +import * as monthUtils from 'loot-core/src/shared/months'; import { integerToCurrency, integerToAmount, amountToInteger } from 'loot-core/src/shared/util'; +import { AlignedText } from 'loot-design/src/components/common'; import { index } from '../util'; diff --git a/packages/desktop-client/src/components/reports/index.js b/packages/desktop-client/src/components/reports/index.js index 07f2f1d..2c50538 100644 --- a/packages/desktop-client/src/components/reports/index.js +++ b/packages/desktop-client/src/components/reports/index.js @@ -3,9 +3,9 @@ import { Route } from 'react-router-dom'; import { View } from 'loot-design/src/components/common'; -import Overview from './Overview'; -import NetWorth from './NetWorth'; import CashFlow from './CashFlow'; +import NetWorth from './NetWorth'; +import Overview from './Overview'; class Reports extends React.Component { render() { diff --git a/packages/desktop-client/src/components/schedules/DiscoverSchedules.js b/packages/desktop-client/src/components/schedules/DiscoverSchedules.js index 86c5d52..f9fff59 100644 --- a/packages/desktop-client/src/components/schedules/DiscoverSchedules.js +++ b/packages/desktop-client/src/components/schedules/DiscoverSchedules.js @@ -1,9 +1,10 @@ import React, { useState, useEffect } from 'react'; import { useLocation, useHistory } from 'react-router-dom'; -import q, { runQuery } from 'loot-core/src/client/query-helpers'; import Platform from 'loot-core/src/client/platform'; +import q, { runQuery } from 'loot-core/src/client/query-helpers'; import { send } from 'loot-core/src/platform/client/fetch'; +import { getRecurringDescription } from 'loot-core/src/shared/schedules'; import { View, Stack, @@ -18,13 +19,12 @@ import { Field, SelectCell } from 'loot-design/src/components/table'; -import { getRecurringDescription } from 'loot-core/src/shared/schedules'; -import { colors } from 'loot-design/src/style'; import useSelected, { useSelectedDispatch, useSelectedItems, SelectedProvider } from 'loot-design/src/components/useSelected'; +import { colors } from 'loot-design/src/style'; import { Page } from '../Page'; import DisplayId from '../util/DisplayId'; diff --git a/packages/desktop-client/src/components/schedules/EditSchedule.js b/packages/desktop-client/src/components/schedules/EditSchedule.js index 8af6f50..3433222 100644 --- a/packages/desktop-client/src/components/schedules/EditSchedule.js +++ b/packages/desktop-client/src/components/schedules/EditSchedule.js @@ -1,33 +1,32 @@ import React, { useEffect, useReducer } from 'react'; -import { useParams, useHistory } from 'react-router-dom'; import { useDispatch, useSelector } from 'react-redux'; +import { useParams, useHistory } from 'react-router-dom'; import { pushModal } from 'loot-core/src/client/actions/modals'; -import { send, sendCatch } from 'loot-core/src/platform/client/fetch'; -import q, { runQuery, liveQuery } from 'loot-core/src/client/query-helpers'; -import { extractScheduleConds } from 'loot-core/src/shared/schedules'; -import * as monthUtils from 'loot-core/src/shared/months'; import { useCachedPayees } from 'loot-core/src/client/data-hooks/payees'; +import q, { runQuery, liveQuery } from 'loot-core/src/client/query-helpers'; +import { send, sendCatch } from 'loot-core/src/platform/client/fetch'; +import * as monthUtils from 'loot-core/src/shared/months'; +import { extractScheduleConds } from 'loot-core/src/shared/schedules'; +import AccountAutocomplete from 'loot-design/src/components/AccountAutocomplete'; +import { Stack, View, Text, Button } from 'loot-design/src/components/common'; +import DateSelect from 'loot-design/src/components/DateSelect'; import { FormField, FormLabel, Checkbox } from 'loot-design/src/components/forms'; -import { colors } from 'loot-design/src/style'; import PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete'; -import AccountAutocomplete from 'loot-design/src/components/AccountAutocomplete'; -import { Stack, View, Text, Button } from 'loot-design/src/components/common'; -import DateSelect from 'loot-design/src/components/DateSelect'; +import RecurringSchedulePicker from 'loot-design/src/components/RecurringSchedulePicker'; import { SelectedItemsButton } from 'loot-design/src/components/table'; import useSelected, { SelectedProvider } from 'loot-design/src/components/useSelected'; -import RecurringSchedulePicker from 'loot-design/src/components/RecurringSchedulePicker'; +import { colors } from 'loot-design/src/style'; import SimpleTransactionsTable from '../accounts/SimpleTransactionsTable'; -import { usePageType } from '../Page'; -import { Page } from '../Page'; import { OpSelect } from '../modals/EditRule'; +import { Page, usePageType } from '../Page'; import { AmountInput, BetweenAmountInput } from '../util/AmountInput'; function mergeFields(defaults, initial) { diff --git a/packages/desktop-client/src/components/schedules/SchedulesTable.js b/packages/desktop-client/src/components/schedules/SchedulesTable.js index 6d8d732..023361c 100644 --- a/packages/desktop-client/src/components/schedules/SchedulesTable.js +++ b/packages/desktop-client/src/components/schedules/SchedulesTable.js @@ -1,8 +1,9 @@ import React, { useState, useMemo } from 'react'; import { useSelector } from 'react-redux'; +import * as monthUtils from 'loot-core/src/shared/months'; +import { getScheduledAmount } from 'loot-core/src/shared/schedules'; import { integerToCurrency } from 'loot-core/src/shared/util'; -import { colors } from 'loot-design/src/style'; import { View, Text, @@ -17,8 +18,7 @@ import { Field, Cell } from 'loot-design/src/components/table'; -import * as monthUtils from 'loot-core/src/shared/months'; -import { getScheduledAmount } from 'loot-core/src/shared/schedules'; +import { colors } from 'loot-design/src/style'; import DotsHorizontalTriple from 'loot-design/src/svg/v1/DotsHorizontalTriple'; import Check from 'loot-design/src/svg/v2/Check'; diff --git a/packages/desktop-client/src/components/schedules/StatusBadge.js b/packages/desktop-client/src/components/schedules/StatusBadge.js index 2f97a04..19ada2b 100644 --- a/packages/desktop-client/src/components/schedules/StatusBadge.js +++ b/packages/desktop-client/src/components/schedules/StatusBadge.js @@ -1,14 +1,14 @@ import React from 'react'; -import { colors } from 'loot-design/src/style'; -import { View, Text } from 'loot-design/src/components/common'; import { titleFirst } from 'loot-core/src/shared/util'; -import EditSkull1 from 'loot-design/src/svg/v2/EditSkull1'; +import { View, Text } from 'loot-design/src/components/common'; +import { colors } from 'loot-design/src/style'; import AlertTriangle from 'loot-design/src/svg/v2/AlertTriangle'; import CalendarIcon from 'loot-design/src/svg/v2/Calendar'; -import ValidationCheck from 'loot-design/src/svg/v2/ValidationCheck'; -import FavoriteStar from 'loot-design/src/svg/v2/FavoriteStar'; import CheckCircle1 from 'loot-design/src/svg/v2/CheckCircle1'; +import EditSkull1 from 'loot-design/src/svg/v2/EditSkull1'; +import FavoriteStar from 'loot-design/src/svg/v2/FavoriteStar'; +import ValidationCheck from 'loot-design/src/svg/v2/ValidationCheck'; export function getStatusProps(status) { let color, backgroundColor, Icon; diff --git a/packages/desktop-client/src/components/schedules/index.js b/packages/desktop-client/src/components/schedules/index.js index 2e39691..96fdf05 100644 --- a/packages/desktop-client/src/components/schedules/index.js +++ b/packages/desktop-client/src/components/schedules/index.js @@ -1,9 +1,9 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; -import { View, Button } from 'loot-design/src/components/common'; -import { send } from 'loot-core/src/platform/client/fetch'; import { useSchedules } from 'loot-core/src/client/data-hooks/schedules'; +import { send } from 'loot-core/src/platform/client/fetch'; +import { View, Button } from 'loot-design/src/components/common'; import { Page } from '../Page'; import { SchedulesTable, ROW_HEIGHT } from './SchedulesTable'; diff --git a/packages/desktop-client/src/components/tools/FixSplitsTool.js b/packages/desktop-client/src/components/tools/FixSplitsTool.js index 2d82c85..0b8a36e 100644 --- a/packages/desktop-client/src/components/tools/FixSplitsTool.js +++ b/packages/desktop-client/src/components/tools/FixSplitsTool.js @@ -1,8 +1,8 @@ import React, { useState } from 'react'; import { send } from 'loot-core/src/platform/client/fetch'; -import { colors } from 'loot-design/src/style'; import { View, P, ButtonWithLoading } from 'loot-design/src/components/common'; +import { colors } from 'loot-design/src/style'; import { Page } from '../Page'; diff --git a/packages/desktop-client/src/components/tutorial/BudgetCategories.js b/packages/desktop-client/src/components/tutorial/BudgetCategories.js index fbda816..bf7beb1 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetCategories.js +++ b/packages/desktop-client/src/components/tutorial/BudgetCategories.js @@ -3,8 +3,8 @@ import React from 'react'; import { Tooltip, Pointer, P } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import Navigation from './Navigation'; import { Title } from './common'; +import Navigation from './Navigation'; function BudgetInitial({ targetRect, navigationProps }) { return ( diff --git a/packages/desktop-client/src/components/tutorial/BudgetNewIncome.js b/packages/desktop-client/src/components/tutorial/BudgetNewIncome.js index 9222b2e..70d9218 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetNewIncome.js +++ b/packages/desktop-client/src/components/tutorial/BudgetNewIncome.js @@ -3,8 +3,8 @@ import React from 'react'; import { Tooltip, Pointer, P } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import Navigation from './Navigation'; import { Title } from './common'; +import Navigation from './Navigation'; function BudgetSummary({ targetRect, navigationProps }) { return ( diff --git a/packages/desktop-client/src/components/tutorial/BudgetNextMonth.js b/packages/desktop-client/src/components/tutorial/BudgetNextMonth.js index 708368f..24a2e3d 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetNextMonth.js +++ b/packages/desktop-client/src/components/tutorial/BudgetNextMonth.js @@ -6,8 +6,8 @@ import { bindActionCreators } from 'redux'; import * as actions from 'loot-core/src/client/actions'; import { View, P, Button } from 'loot-design/src/components/common'; -import Navigation from './Navigation'; import { Standalone, Title, useMinimized } from './common'; +import Navigation from './Navigation'; function BudgetNextMonth({ stepTwo, navigationProps }) { let [minimized, toggle] = useMinimized(); diff --git a/packages/desktop-client/src/components/tutorial/BudgetSummary.js b/packages/desktop-client/src/components/tutorial/BudgetSummary.js index dae0ae7..e20bc28 100644 --- a/packages/desktop-client/src/components/tutorial/BudgetSummary.js +++ b/packages/desktop-client/src/components/tutorial/BudgetSummary.js @@ -3,8 +3,8 @@ import React from 'react'; import { Tooltip, Pointer, P } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import Navigation from './Navigation'; import { Title } from './common'; +import Navigation from './Navigation'; function BudgetSummary({ fromYNAB, targetRect, navigationProps }) { return ( diff --git a/packages/desktop-client/src/components/tutorial/CategoryBalance.js b/packages/desktop-client/src/components/tutorial/CategoryBalance.js index 861c55b..fcee158 100644 --- a/packages/desktop-client/src/components/tutorial/CategoryBalance.js +++ b/packages/desktop-client/src/components/tutorial/CategoryBalance.js @@ -2,8 +2,8 @@ import React from 'react'; import { P, Button } from 'loot-design/src/components/common'; -import Navigation from './Navigation'; import { Standalone, Title, useMinimized } from './common'; +import Navigation from './Navigation'; function CategoryBalance({ targetRect, navigationProps }) { let [minimized, toggle] = useMinimized(); diff --git a/packages/desktop-client/src/components/tutorial/DeleteTransactions.js b/packages/desktop-client/src/components/tutorial/DeleteTransactions.js index 69eb52f..2d9b7b7 100644 --- a/packages/desktop-client/src/components/tutorial/DeleteTransactions.js +++ b/packages/desktop-client/src/components/tutorial/DeleteTransactions.js @@ -2,8 +2,8 @@ import React from 'react'; import { P } from 'loot-design/src/components/common'; -import Navigation from './Navigation'; import { Standalone, Title } from './common'; +import Navigation from './Navigation'; function DeleteTransactions({ targetRect, navigationProps }) { return ( diff --git a/packages/desktop-client/src/components/tutorial/Overspending.js b/packages/desktop-client/src/components/tutorial/Overspending.js index bb7dd06..fd4881c 100644 --- a/packages/desktop-client/src/components/tutorial/Overspending.js +++ b/packages/desktop-client/src/components/tutorial/Overspending.js @@ -4,14 +4,14 @@ import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import * as actions from 'loot-core/src/client/actions'; -import SheetValue from 'loot-design/src/components/spreadsheet/SheetValue'; -import NamespaceContext from 'loot-design/src/components/spreadsheet/NamespaceContext'; -import { P, View, Text, Button } from 'loot-design/src/components/common'; import * as monthUtils from 'loot-core/src/shared/months'; import { integerToCurrency } from 'loot-core/src/shared/util'; +import { P, View, Text, Button } from 'loot-design/src/components/common'; +import NamespaceContext from 'loot-design/src/components/spreadsheet/NamespaceContext'; +import SheetValue from 'loot-design/src/components/spreadsheet/SheetValue'; -import Navigation from './Navigation'; import { Standalone, Title, useMinimized } from './common'; +import Navigation from './Navigation'; function Overspending({ navigationProps, stepTwo }) { let currentMonth = monthUtils.currentMonth(); diff --git a/packages/desktop-client/src/components/tutorial/TransactionAdd.js b/packages/desktop-client/src/components/tutorial/TransactionAdd.js index d97118e..6ae808e 100644 --- a/packages/desktop-client/src/components/tutorial/TransactionAdd.js +++ b/packages/desktop-client/src/components/tutorial/TransactionAdd.js @@ -3,8 +3,8 @@ import React from 'react'; import { Tooltip, Pointer, P } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; -import Navigation from './Navigation'; import { Title } from './common'; +import Navigation from './Navigation'; function TransactionAdd({ targetRect, navigationProps }) { return ( diff --git a/packages/desktop-client/src/components/tutorial/TransactionEnter.js b/packages/desktop-client/src/components/tutorial/TransactionEnter.js index f70e32d..00db523 100644 --- a/packages/desktop-client/src/components/tutorial/TransactionEnter.js +++ b/packages/desktop-client/src/components/tutorial/TransactionEnter.js @@ -1,10 +1,10 @@ import React from 'react'; -import { P } from 'loot-design/src/components/common'; import * as monthUtils from 'loot-core/src/shared/months'; +import { P } from 'loot-design/src/components/common'; -import Navigation from './Navigation'; import { Standalone, Title } from './common'; +import Navigation from './Navigation'; function TransactionEnter({ fromYNAB, navigationProps }) { const currentDay = monthUtils.currentDay(); diff --git a/packages/desktop-client/src/components/tutorial/TransactionFinalize.js b/packages/desktop-client/src/components/tutorial/TransactionFinalize.js index deebba9..847aa82 100644 --- a/packages/desktop-client/src/components/tutorial/TransactionFinalize.js +++ b/packages/desktop-client/src/components/tutorial/TransactionFinalize.js @@ -4,8 +4,8 @@ import { css } from 'glamor'; import { P } from 'loot-design/src/components/common'; -import Navigation from './Navigation'; import { Standalone } from './common'; +import Navigation from './Navigation'; function TransactionFinalize({ navigationProps }) { return ( diff --git a/packages/desktop-client/src/components/util/DisplayId.js b/packages/desktop-client/src/components/util/DisplayId.js index c3bef77..3275096 100644 --- a/packages/desktop-client/src/components/util/DisplayId.js +++ b/packages/desktop-client/src/components/util/DisplayId.js @@ -1,7 +1,7 @@ import React from 'react'; -import { CachedPayees } from 'loot-core/src/client/data-hooks/payees'; import { CachedAccounts } from 'loot-core/src/client/data-hooks/accounts'; +import { CachedPayees } from 'loot-core/src/client/data-hooks/payees'; import { Text } from 'loot-design/src/components/common'; import { colors } from 'loot-design/src/style'; diff --git a/packages/desktop-client/src/components/util/GenericInput.js b/packages/desktop-client/src/components/util/GenericInput.js index f4a2cd3..8d8c6ae 100644 --- a/packages/desktop-client/src/components/util/GenericInput.js +++ b/packages/desktop-client/src/components/util/GenericInput.js @@ -2,12 +2,12 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { getMonthYearFormat } from 'loot-core/src/shared/months'; -import { View, Input } from 'loot-design/src/components/common'; -import PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete'; import AccountAutocomplete from 'loot-design/src/components/AccountAutocomplete'; import Autocomplete from 'loot-design/src/components/Autocomplete'; import CategoryAutocomplete from 'loot-design/src/components/CategorySelect'; +import { View, Input } from 'loot-design/src/components/common'; import DateSelect from 'loot-design/src/components/DateSelect'; +import PayeeAutocomplete from 'loot-design/src/components/PayeeAutocomplete'; import RecurringSchedulePicker from 'loot-design/src/components/RecurringSchedulePicker'; export default function GenericInput({ diff --git a/packages/desktop-client/src/global-events.js b/packages/desktop-client/src/global-events.js index 95b8392..d465c39 100644 --- a/packages/desktop-client/src/global-events.js +++ b/packages/desktop-client/src/global-events.js @@ -1,6 +1,6 @@ +import * as sharedListeners from 'loot-core/src/client/shared-listeners'; import { send, listen } from 'loot-core/src/platform/client/fetch'; import * as undo from 'loot-core/src/platform/client/undo'; -import * as sharedListeners from 'loot-core/src/client/shared-listeners'; export function handleGlobalEvents(actions, store) { global.Actual.onEventFromMain('update-downloaded', (event, info) => { diff --git a/packages/desktop-client/src/index.js b/packages/desktop-client/src/index.js index 067cc2d..b22f4dd 100644 --- a/packages/desktop-client/src/index.js +++ b/packages/desktop-client/src/index.js @@ -17,15 +17,15 @@ import { } from 'redux'; import thunk from 'redux-thunk'; -import constants from 'loot-core/src/client/constants'; -import reducers from 'loot-core/src/client/reducers'; -import { send } from 'loot-core/src/platform/client/fetch'; -import q, { runQuery } from 'loot-core/src/client/query-helpers'; import * as actions from 'loot-core/src/client/actions'; +import constants from 'loot-core/src/client/constants'; +import q, { runQuery } from 'loot-core/src/client/query-helpers'; +import reducers from 'loot-core/src/client/reducers'; import { initialState as initialAppState } from 'loot-core/src/client/reducers/app'; +import { send } from 'loot-core/src/platform/client/fetch'; -import { handleGlobalEvents } from './global-events'; import App from './components/App'; +import { handleGlobalEvents } from './global-events'; // See https://github.com/WICG/focus-visible. Only makes the blue // focus outline appear from keyboard events. diff --git a/packages/loot-core/src/client/SpreadsheetProvider.js b/packages/loot-core/src/client/SpreadsheetProvider.js index cf6e884..dd0bc45 100644 --- a/packages/loot-core/src/client/SpreadsheetProvider.js +++ b/packages/loot-core/src/client/SpreadsheetProvider.js @@ -1,5 +1,4 @@ -import * as React from 'react'; -import { useEffect, useMemo } from 'react'; +import React, { useEffect, useMemo } from 'react'; import LRU from 'lru-cache'; diff --git a/packages/loot-core/src/client/actions/account.js b/packages/loot-core/src/client/actions/account.js index 980f4dd..13b7643 100644 --- a/packages/loot-core/src/client/actions/account.js +++ b/packages/loot-core/src/client/actions/account.js @@ -1,7 +1,7 @@ import { send } from '../../platform/client/fetch'; import constants from '../constants'; -import { getPayees, getAccounts } from './queries'; import { addNotification } from './notifications'; +import { getPayees, getAccounts } from './queries'; export function setAccountsSyncing(name) { return { diff --git a/packages/loot-core/src/client/actions/budgets.js b/packages/loot-core/src/client/actions/budgets.js index 3a20240..0a84351 100644 --- a/packages/loot-core/src/client/actions/budgets.js +++ b/packages/loot-core/src/client/actions/budgets.js @@ -1,10 +1,10 @@ +import { send } from '../../platform/client/fetch'; +import { getDownloadError } from '../../shared/errors'; import constants from '../constants'; +import { setAppState } from './app'; import { closeModal, pushModal } from './modals'; import { loadPrefs, loadGlobalPrefs } from './prefs'; -import { send } from '../../platform/client/fetch'; -import { setAppState } from './app'; import { startTutorialFirstTime } from './tutorial'; -import { getDownloadError } from '../../shared/errors'; const uuid = require('../../platform/uuid'); diff --git a/packages/loot-core/src/client/actions/prefs.js b/packages/loot-core/src/client/actions/prefs.js index f2a6388..5bda315 100644 --- a/packages/loot-core/src/client/actions/prefs.js +++ b/packages/loot-core/src/client/actions/prefs.js @@ -1,6 +1,6 @@ +import { send } from '../../platform/client/fetch'; import constants from '../constants'; import { closeModal } from './modals'; -import { send } from '../../platform/client/fetch'; export function loadPrefs() { return async (dispatch, getState) => { diff --git a/packages/loot-core/src/client/actions/queries.js b/packages/loot-core/src/client/actions/queries.js index 363ee35..2fa3fc8 100644 --- a/packages/loot-core/src/client/actions/queries.js +++ b/packages/loot-core/src/client/actions/queries.js @@ -2,8 +2,8 @@ import throttle from 'throttleit'; import { send } from '../../platform/client/fetch'; import constants from '../constants'; -import { addNotification, addGenericErrorNotification } from './notifications'; import { pushModal } from './modals'; +import { addNotification, addGenericErrorNotification } from './notifications'; export function applyBudgetAction(month, type, args) { return async function() { diff --git a/packages/loot-core/src/client/actions/sync.js b/packages/loot-core/src/client/actions/sync.js index f081689..14e5254 100644 --- a/packages/loot-core/src/client/actions/sync.js +++ b/packages/loot-core/src/client/actions/sync.js @@ -1,9 +1,9 @@ import { send } from '../../platform/client/fetch'; +import { getUploadError } from '../../shared/errors'; import constants from '../constants'; -import { loadPrefs } from './prefs'; import { syncAccounts } from './account'; import { pushModal } from './modals'; -import { getUploadError } from '../../shared/errors'; +import { loadPrefs } from './prefs'; export function unregister() { return async dispatch => { diff --git a/packages/loot-core/src/client/actions/user.js b/packages/loot-core/src/client/actions/user.js index 5666b2f..a3168f1 100644 --- a/packages/loot-core/src/client/actions/user.js +++ b/packages/loot-core/src/client/actions/user.js @@ -1,7 +1,7 @@ import { send } from '../../platform/client/fetch'; import constants from '../constants'; -import { loadGlobalPrefs } from './prefs'; import { loadAllFiles, closeBudget } from './budgets'; +import { loadGlobalPrefs } from './prefs'; export function getUserData() { return async dispatch => { diff --git a/packages/loot-core/src/client/data-hooks/schedules.js b/packages/loot-core/src/client/data-hooks/schedules.js index b7d5f63..6cb01a4 100644 --- a/packages/loot-core/src/client/data-hooks/schedules.js +++ b/packages/loot-core/src/client/data-hooks/schedules.js @@ -1,10 +1,10 @@ import React, { useEffect, useState, useContext } from 'react'; +import q, { liveQuery } from 'loot-core/src/client/query-helpers'; import { getStatus, getHasTransactionsQuery } from 'loot-core/src/shared/schedules'; -import q, { liveQuery } from 'loot-core/src/client/query-helpers'; function loadStatuses(schedules, onData) { return liveQuery(getHasTransactionsQuery(schedules), onData, { diff --git a/packages/loot-core/src/client/queries.js b/packages/loot-core/src/client/queries.js index b783b5a..f109196 100644 --- a/packages/loot-core/src/client/queries.js +++ b/packages/loot-core/src/client/queries.js @@ -1,6 +1,5 @@ import { parse as parseDate, isValid as isDateValid } from 'date-fns'; -import { currencyToAmount, amountToInteger } from '../shared/util'; import { dayFromDate, getDayMonthRegex, @@ -9,6 +8,7 @@ import { getShortYearFormat } from '../shared/months'; import q from '../shared/query'; +import { currencyToAmount, amountToInteger } from '../shared/util'; function isInteger(num) { return (num | 0) === num; diff --git a/packages/loot-core/src/client/query-helpers.test.js b/packages/loot-core/src/client/query-helpers.test.js index 5f92afa..0c68ccb 100644 --- a/packages/loot-core/src/client/query-helpers.test.js +++ b/packages/loot-core/src/client/query-helpers.test.js @@ -1,8 +1,8 @@ import { initServer, serverPush } from '../platform/client/fetch'; -import q from '../shared/query'; -import { runQuery, liveQuery, pagedQuery } from './query-helpers'; -import { tracer } from '../shared/test-helpers'; import { subDays } from '../shared/months'; +import q from '../shared/query'; +import { tracer } from '../shared/test-helpers'; +import { runQuery, liveQuery, pagedQuery } from './query-helpers'; function wait(n) { return new Promise(resolve => setTimeout(() => resolve(`wait(${n})`), n)); diff --git a/packages/loot-core/src/client/reducers/index.js b/packages/loot-core/src/client/reducers/index.js index dbdab50..bd61c35 100644 --- a/packages/loot-core/src/client/reducers/index.js +++ b/packages/loot-core/src/client/reducers/index.js @@ -1,12 +1,12 @@ -import app from './app'; -import queries from './queries'; import account from './account'; +import app from './app'; +import budgets from './budgets'; import debug from './debug'; -import profile from './profile'; -import prefs from './prefs'; import modals from './modals'; import notifications from './notifications'; -import budgets from './budgets'; +import prefs from './prefs'; +import profile from './profile'; +import queries from './queries'; import tutorial from './tutorial'; import user from './user'; diff --git a/packages/loot-core/src/client/reducers/prefs.js b/packages/loot-core/src/client/reducers/prefs.js index 5874d8e..80c8048 100644 --- a/packages/loot-core/src/client/reducers/prefs.js +++ b/packages/loot-core/src/client/reducers/prefs.js @@ -1,5 +1,5 @@ -import constants from '../constants'; import { setNumberFormat } from '../../shared/util.js'; +import constants from '../constants'; const initialState = { local: null, diff --git a/packages/loot-core/src/client/reducers/queries.js b/packages/loot-core/src/client/reducers/queries.js index 87dff6c..bcb6fa2 100644 --- a/packages/loot-core/src/client/reducers/queries.js +++ b/packages/loot-core/src/client/reducers/queries.js @@ -1,7 +1,7 @@ import memoizeOne from 'memoize-one'; -import constants from '../constants'; import { groupById } from '../../shared/util'; +import constants from '../constants'; const initialState = { newTransactions: [], diff --git a/packages/loot-core/src/mocks/budget.js b/packages/loot-core/src/mocks/budget.js index 3143be3..1439639 100644 --- a/packages/loot-core/src/mocks/budget.js +++ b/packages/loot-core/src/mocks/budget.js @@ -1,13 +1,13 @@ -import * as monthUtils from '../shared/months'; -import * as sheet from '../server/sheet'; +import { addTransactions } from '../server/accounts/sync'; +import { runQuery as aqlQuery } from '../server/aql'; +import * as budgetActions from '../server/budget/actions'; import * as budget from '../server/budget/base'; import * as db from '../server/db'; -import * as prefs from '../server/prefs'; -import * as budgetActions from '../server/budget/actions'; -import { runQuery as aqlQuery } from '../server/aql'; -import { batchMessages, setSyncingMode } from '../server/sync'; import { runHandler, runMutator } from '../server/mutators'; -import { addTransactions } from '../server/accounts/sync'; +import * as prefs from '../server/prefs'; +import * as sheet from '../server/sheet'; +import { batchMessages, setSyncingMode } from '../server/sync'; +import * as monthUtils from '../shared/months'; import q from '../shared/query'; function pickRandom(list) { diff --git a/packages/loot-core/src/mocks/redux.js b/packages/loot-core/src/mocks/redux.js index 47f1124..f47efea 100644 --- a/packages/loot-core/src/mocks/redux.js +++ b/packages/loot-core/src/mocks/redux.js @@ -1,8 +1,8 @@ import React from 'react'; import { Provider } from 'react-redux'; -import thunk from 'redux-thunk'; import { createStore, combineReducers, applyMiddleware } from 'redux'; +import thunk from 'redux-thunk'; import reducers from '../client/reducers'; diff --git a/packages/loot-core/src/mocks/setup.js b/packages/loot-core/src/mocks/setup.js index 861ba58..40ef7b4 100644 --- a/packages/loot-core/src/mocks/setup.js +++ b/packages/loot-core/src/mocks/setup.js @@ -1,16 +1,16 @@ -import * as sqlite from '../platform/server/sqlite'; import * as fetchClient from '../platform/client/fetch'; -import * as db from '../server/db'; -import * as sheet from '../server/sheet'; +import * as sqlite from '../platform/server/sqlite'; import * as rules from '../server/accounts/transaction-rules'; -import * as tracking from '../server/tracking/events'; -import { setSyncingMode } from '../server/sync'; -import { updateVersion } from '../server/update'; -import { resetTracer, tracer } from '../shared/test-helpers'; +import * as db from '../server/db'; import { enableGlobalMutations, disableGlobalMutations } from '../server/mutators'; +import * as sheet from '../server/sheet'; +import { setSyncingMode } from '../server/sync'; +import * as tracking from '../server/tracking/events'; +import { updateVersion } from '../server/update'; +import { resetTracer, tracer } from '../shared/test-helpers'; jest.mock('../server/post'); diff --git a/packages/loot-core/src/platform/client/fetch/index.browser.js b/packages/loot-core/src/platform/client/fetch/index.browser.js index a375a3a..369c2dc 100644 --- a/packages/loot-core/src/platform/client/fetch/index.browser.js +++ b/packages/loot-core/src/platform/client/fetch/index.browser.js @@ -1,6 +1,6 @@ -const undo = require('../undo'); const { captureException, captureBreadcrumb } = require('../../exceptions'); const uuid = require('../../uuid'); +const undo = require('../undo'); let replyHandlers = new Map(); let listeners = new Map(); let messageQueue = []; diff --git a/packages/loot-core/src/platform/client/fetch/index.web.js b/packages/loot-core/src/platform/client/fetch/index.web.js index 37d8880..c52f65a 100644 --- a/packages/loot-core/src/platform/client/fetch/index.web.js +++ b/packages/loot-core/src/platform/client/fetch/index.web.js @@ -1,5 +1,5 @@ -const undo = require('../undo'); const uuid = require('../../uuid'); +const undo = require('../undo'); let replyHandlers = new Map(); let listeners = new Map(); let messageQueue = []; diff --git a/packages/loot-core/src/platform/client/undo/index.web.js b/packages/loot-core/src/platform/client/undo/index.web.js index 0e716a2..bd57f41 100644 --- a/packages/loot-core/src/platform/client/undo/index.web.js +++ b/packages/loot-core/src/platform/client/undo/index.web.js @@ -1,5 +1,5 @@ -const uuid = require('../../uuid'); const { getChangedValues } = require('../../../shared/util'); +const uuid = require('../../uuid'); // List of recently used states. We don't use a true MRU structure // because our needs are simple and we also do some custom reordering. diff --git a/packages/loot-core/src/platform/server/fs/index.web.js b/packages/loot-core/src/platform/server/fs/index.web.js index f775c0f..cdb0853 100644 --- a/packages/loot-core/src/platform/server/fs/index.web.js +++ b/packages/loot-core/src/platform/server/fs/index.web.js @@ -2,8 +2,8 @@ let { SQLiteFS } = require('absurd-sql'); let IndexedDBBackend = require('absurd-sql/dist/indexeddb-backend').default; let connection = require('../connection'); -let { _getModule } = require('../sqlite'); let idb = require('../indexeddb'); +let { _getModule } = require('../sqlite'); let baseAPI = require('./index.electron.js'); let join = require('./path-join'); diff --git a/packages/loot-core/src/server/accounts/export-to-csv.js b/packages/loot-core/src/server/accounts/export-to-csv.js index 3716f00..6ca03cd 100644 --- a/packages/loot-core/src/server/accounts/export-to-csv.js +++ b/packages/loot-core/src/server/accounts/export-to-csv.js @@ -1,7 +1,7 @@ import csvStringify from 'csv-stringify/lib/sync'; -import { runQuery as aqlQuery } from '../aql'; import { integerToAmount } from '../../shared/util'; +import { runQuery as aqlQuery } from '../aql'; export async function exportToCSV( transactions, diff --git a/packages/loot-core/src/server/accounts/link.js b/packages/loot-core/src/server/accounts/link.js index bcd7899..9ba08b2 100644 --- a/packages/loot-core/src/server/accounts/link.js +++ b/packages/loot-core/src/server/accounts/link.js @@ -1,11 +1,11 @@ import asyncStorage from '../../platform/server/asyncStorage'; -import * as db from '../db'; -import { getServer } from '../server-config'; -import * as bankSync from './sync'; import { fromPlaidAccountType } from '../../shared/accounts'; import { amountToInteger } from '../../shared/util'; -import { post } from '../post'; +import * as db from '../db'; import { runMutator } from '../mutators'; +import { post } from '../post'; +import { getServer } from '../server-config'; +import * as bankSync from './sync'; const uuid = require('../../platform/uuid'); diff --git a/packages/loot-core/src/server/accounts/parse-file.js b/packages/loot-core/src/server/accounts/parse-file.js index 62f1e28..dfa461e 100644 --- a/packages/loot-core/src/server/accounts/parse-file.js +++ b/packages/loot-core/src/server/accounts/parse-file.js @@ -1,9 +1,9 @@ import csv2json from 'csv-parse/lib/sync'; import fs from '../../platform/server/fs'; -import qif2json from './qif2json'; import { dayFromDate } from '../../shared/months'; import { looselyParseAmount } from '../../shared/util'; +import qif2json from './qif2json'; export function parseFile(filepath, options) { let errors = []; diff --git a/packages/loot-core/src/server/accounts/parse-file.test.js b/packages/loot-core/src/server/accounts/parse-file.test.js index 6354852..ee3cc1a 100644 --- a/packages/loot-core/src/server/accounts/parse-file.test.js +++ b/packages/loot-core/src/server/accounts/parse-file.test.js @@ -1,10 +1,10 @@ import * as d from 'date-fns'; +import { amountToInteger } from '../../shared/util'; +import * as db from '../db'; +import * as prefs from '../prefs'; import { parseFile } from './parse-file'; import { reconcileTransactions } from './sync'; -import * as prefs from '../prefs'; -import * as db from '../db'; -import { amountToInteger } from '../../shared/util'; beforeEach(global.emptyDatabase()); diff --git a/packages/loot-core/src/server/accounts/rules.js b/packages/loot-core/src/server/accounts/rules.js index f14a9b2..3667bf0 100644 --- a/packages/loot-core/src/server/accounts/rules.js +++ b/packages/loot-core/src/server/accounts/rules.js @@ -1,6 +1,5 @@ import * as dateFns from 'date-fns'; -import { RuleError } from '../errors'; import { monthFromDate, yearFromDate, @@ -10,9 +9,10 @@ import { subDays, parseDate } from '../../shared/months'; -import { fastSetMerge } from '../../shared/util'; import { sortNumbers, getApproxNumberThreshold } from '../../shared/rules'; import { recurConfigToRSchedule } from '../../shared/schedules'; +import { fastSetMerge } from '../../shared/util'; +import { RuleError } from '../errors'; import { Schedule as RSchedule } from '../util/rschedule'; function safeNumber(n) { diff --git a/packages/loot-core/src/server/accounts/sync.js b/packages/loot-core/src/server/accounts/sync.js index ce2d643..b242d02 100644 --- a/packages/loot-core/src/server/accounts/sync.js +++ b/packages/loot-core/src/server/accounts/sync.js @@ -1,23 +1,23 @@ -import title from './title'; -import * as db from '../db'; -import { hasFieldsChanged, amountToInteger } from '../../shared/util'; +import * as monthUtils from '../../shared/months'; import { makeChild as makeChildTransaction, recalculateSplit } from '../../shared/transactions'; -import * as monthUtils from '../../shared/months'; +import { hasFieldsChanged, amountToInteger } from '../../shared/util'; +import * as db from '../db'; +import { runMutator } from '../mutators'; import { getServer } from '../server-config'; import { batchMessages } from '../sync'; -import { runMutator } from '../mutators'; import { getStartingBalancePayee } from './payees'; +import title from './title'; import { runRules } from './transaction-rules'; import { batchUpdateTransactions } from './transactions'; -const dateFns = require('date-fns'); const levenshtein = require('damerau-levenshtein'); +const dateFns = require('date-fns'); -const { post } = require('../post'); const uuid = require('../../platform/uuid'); +const { post } = require('../post'); // Plaid article about API options: // https://support.plaid.com/customer/en/portal/articles/2612155-transactions-returned-per-request diff --git a/packages/loot-core/src/server/accounts/sync.test.js b/packages/loot-core/src/server/accounts/sync.test.js index 2f904f9..2f14a55 100644 --- a/packages/loot-core/src/server/accounts/sync.test.js +++ b/packages/loot-core/src/server/accounts/sync.test.js @@ -1,3 +1,4 @@ +import * as monthUtils from '../../shared/months'; import * as db from '../db'; import { loadMappings } from '../db/mappings'; import { getServer } from '../server-config'; @@ -7,9 +8,8 @@ import { addTransactions, fromPlaid } from './sync'; -import * as monthUtils from '../../shared/months'; -import * as transfer from './transfer'; import { loadRules, insertRule } from './transaction-rules'; +import * as transfer from './transfer'; const snapshotDiff = require('snapshot-diff'); diff --git a/packages/loot-core/src/server/accounts/transaction-rules.js b/packages/loot-core/src/server/accounts/transaction-rules.js index dab58d4..26309cb 100644 --- a/packages/loot-core/src/server/accounts/transaction-rules.js +++ b/packages/loot-core/src/server/accounts/transaction-rules.js @@ -1,4 +1,23 @@ +import { + currentDay, + addDays, + subDays, + parseDate, + dayFromDate +} from '../../shared/months'; +import { + FIELD_TYPES, + sortNumbers, + getApproxNumberThreshold +} from '../../shared/rules'; +import { partitionByField, fastSetMerge } from '../../shared/util'; +import { schemaConfig } from '../aql'; import * as db from '../db'; +import { getMappings } from '../db/mappings'; +import { RuleError } from '../errors'; +import { requiredFields, toDateRepr } from '../models'; +import { setSyncingMode, batchMessages } from '../sync'; +import { addSyncListener } from '../sync/index'; import { Condition, Action, @@ -8,20 +27,6 @@ import { migrateIds, iterateIds } from './rules'; -import { getMappings } from '../db/mappings'; -import { addDays, subDays, parseDate, dayFromDate } from '../../shared/months'; -import { addSyncListener } from '../sync/index'; -import { RuleError } from '../errors'; -import { - FIELD_TYPES, - sortNumbers, - getApproxNumberThreshold -} from '../../shared/rules'; -import { requiredFields, toDateRepr } from '../models'; -import { currentDay } from '../../shared/months'; -import { partitionByField, fastSetMerge } from '../../shared/util'; -import { setSyncingMode, batchMessages } from '../sync'; -import { schemaConfig } from '../aql'; // TODO: Detect if it looks like the user is creating a rename rule // and prompt to create it in the pre phase instead diff --git a/packages/loot-core/src/server/accounts/transaction-rules.test.js b/packages/loot-core/src/server/accounts/transaction-rules.test.js index e6dc3d4..eb57fe4 100644 --- a/packages/loot-core/src/server/accounts/transaction-rules.test.js +++ b/packages/loot-core/src/server/accounts/transaction-rules.test.js @@ -1,4 +1,7 @@ +import q from '../../shared/query'; +import { runQuery } from '../aql'; import * as db from '../db'; +import { loadMappings } from '../db/mappings'; import { getRules, loadRules, @@ -13,9 +16,6 @@ import { updateCategoryRules, migrateOldRules } from './transaction-rules'; -import { loadMappings } from '../db/mappings'; -import { runQuery } from '../aql'; -import q from '../../shared/query'; // TODO: write tests to make sure payee renaming is "pre" and category // setting is "null" stage diff --git a/packages/loot-core/src/server/accounts/transactions.js b/packages/loot-core/src/server/accounts/transactions.js index d8e71c8..e7a8744 100644 --- a/packages/loot-core/src/server/accounts/transactions.js +++ b/packages/loot-core/src/server/accounts/transactions.js @@ -1,8 +1,8 @@ -import { batchMessages } from '../sync'; import * as db from '../db'; import { incrFetch, whereIn } from '../db/util'; -import * as transfer from './transfer'; +import { batchMessages } from '../sync'; import * as rules from './transaction-rules'; +import * as transfer from './transfer'; const connection = require('../../platform/server/connection'); diff --git a/packages/loot-core/src/server/accounts/transfer.test.js b/packages/loot-core/src/server/accounts/transfer.test.js index 9caf19d..7d3b6e2 100644 --- a/packages/loot-core/src/server/accounts/transfer.test.js +++ b/packages/loot-core/src/server/accounts/transfer.test.js @@ -1,6 +1,6 @@ +import { expectSnapshotWithDiffer } from '../../mocks/util'; import * as db from '../db'; import * as transfer from './transfer'; -import { expectSnapshotWithDiffer } from '../../mocks/util'; beforeEach(global.emptyDatabase()); diff --git a/packages/loot-core/src/server/api.js b/packages/loot-core/src/server/api.js index 2ca0b75..a798482 100644 --- a/packages/loot-core/src/server/api.js +++ b/packages/loot-core/src/server/api.js @@ -1,3 +1,11 @@ +import * as monthUtils from '../shared/months'; +import q from '../shared/query'; +import { + ungroupTransactions, + updateTransaction, + deleteTransaction +} from '../shared/transactions'; +import { integerToAmount } from '../shared/util'; import { addTransactions } from './accounts/sync'; import { accountModel, @@ -6,22 +14,14 @@ import { payeeModel, payeeRuleModel } from './api-models'; -import { - ungroupTransactions, - updateTransaction, - deleteTransaction -} from '../shared/transactions'; -import * as db from './db'; -import * as sheet from './sheet'; -import * as prefs from './prefs'; -import * as monthUtils from '../shared/months'; -import * as cloudStorage from './cloud-storage'; -import { setSyncingMode, batchMessages } from './sync'; -import { getClock } from './crdt'; -import { runMutator } from './mutators'; -import { integerToAmount } from '../shared/util'; import { runQuery as aqlQuery } from './aql'; -import q from '../shared/query'; +import * as cloudStorage from './cloud-storage'; +import { getClock } from './crdt'; +import * as db from './db'; +import { runMutator } from './mutators'; +import * as prefs from './prefs'; +import * as sheet from './sheet'; +import { setSyncingMode, batchMessages } from './sync'; const connection = require('../platform/server/connection'); diff --git a/packages/loot-core/src/server/aql/exec.test.js b/packages/loot-core/src/server/aql/exec.test.js index e7a3c40..7f854ba 100644 --- a/packages/loot-core/src/server/aql/exec.test.js +++ b/packages/loot-core/src/server/aql/exec.test.js @@ -1,6 +1,6 @@ -import * as db from '../db'; import query from '../../shared/query'; import { makeChild } from '../../shared/transactions'; +import * as db from '../db'; import * as aql from './exec'; import { schema, schemaConfig } from './schema'; diff --git a/packages/loot-core/src/server/aql/schema-helpers.js b/packages/loot-core/src/server/aql/schema-helpers.js index 4140f7c..ef48c5f 100644 --- a/packages/loot-core/src/server/aql/schema-helpers.js +++ b/packages/loot-core/src/server/aql/schema-helpers.js @@ -1,5 +1,5 @@ -import { toDateRepr, fromDateRepr } from '../models'; import { dayFromDate } from '../../shared/months'; +import { toDateRepr, fromDateRepr } from '../models'; function isRequired(name, fieldDesc) { return fieldDesc.required || name === 'id'; diff --git a/packages/loot-core/src/server/aql/schema/executors.js b/packages/loot-core/src/server/aql/schema/executors.js index 5ab925f..d389eff 100644 --- a/packages/loot-core/src/server/aql/schema/executors.js +++ b/packages/loot-core/src/server/aql/schema/executors.js @@ -1,8 +1,8 @@ import * as db from '../../db'; import { whereIn } from '../../db/util'; import { isAggregateQuery } from '../compiler'; -import { convertOutputType } from '../schema-helpers'; import { execQuery } from '../exec'; +import { convertOutputType } from '../schema-helpers'; // Transactions executor diff --git a/packages/loot-core/src/server/aql/schema/executors.test.js b/packages/loot-core/src/server/aql/schema/executors.test.js index 547ab86..6995358 100644 --- a/packages/loot-core/src/server/aql/schema/executors.test.js +++ b/packages/loot-core/src/server/aql/schema/executors.test.js @@ -1,13 +1,13 @@ import fc from 'fast-check'; -import * as db from '../../db'; -import query from '../../../shared/query'; -import { batchMessages, setSyncingMode } from '../../sync/index'; -import { setClock } from '../../crdt'; -import { groupById } from '../../../shared/util'; import arbs from '../../../mocks/arbitrary-schema'; -import { runQuery } from './run-query'; +import query from '../../../shared/query'; +import { groupById } from '../../../shared/util'; +import { setClock } from '../../crdt'; +import * as db from '../../db'; +import { batchMessages, setSyncingMode } from '../../sync/index'; import { isHappyPathQuery } from './executors'; +import { runQuery } from './run-query'; beforeEach(global.emptyDatabase()); diff --git a/packages/loot-core/src/server/aql/schema/run-query.js b/packages/loot-core/src/server/aql/schema/run-query.js index 80ec3cc..ec47f5b 100644 --- a/packages/loot-core/src/server/aql/schema/run-query.js +++ b/packages/loot-core/src/server/aql/schema/run-query.js @@ -1,9 +1,9 @@ -import schemaExecutors from './executors'; +import { Query } from '../../../shared/query'; import { runQuery as _runQuery, runCompiledQuery as _runCompiledQuery } from '../exec'; -import { Query } from '../../../shared/query'; +import schemaExecutors from './executors'; import { schema, schemaConfig } from './index'; diff --git a/packages/loot-core/src/server/backups.js b/packages/loot-core/src/server/backups.js index da5a8af..5a46237 100644 --- a/packages/loot-core/src/server/backups.js +++ b/packages/loot-core/src/server/backups.js @@ -1,8 +1,8 @@ import fs from '../platform/server/fs'; -import * as monthUtils from '../shared/months'; import * as sqlite from '../platform/server/sqlite'; -import * as prefs from './prefs'; +import * as monthUtils from '../shared/months'; import * as cloudStorage from './cloud-storage'; +import * as prefs from './prefs'; const dateFns = require('date-fns'); diff --git a/packages/loot-core/src/server/budget/actions.js b/packages/loot-core/src/server/budget/actions.js index 1f20a7a..e3201ca 100644 --- a/packages/loot-core/src/server/budget/actions.js +++ b/packages/loot-core/src/server/budget/actions.js @@ -1,8 +1,8 @@ import * as monthUtils from '../../shared/months'; import * as db from '../db'; -import { batchMessages } from '../sync'; import * as prefs from '../prefs'; import * as sheet from '../sheet'; +import { batchMessages } from '../sync'; async function getSheetValue(sheetName, cell) { const node = await sheet.getCell(sheetName, cell); diff --git a/packages/loot-core/src/server/budget/base.js b/packages/loot-core/src/server/budget/base.js index c1c95e6..5aa4a04 100644 --- a/packages/loot-core/src/server/budget/base.js +++ b/packages/loot-core/src/server/budget/base.js @@ -1,12 +1,12 @@ -import * as sheet from '../sheet'; -import * as db from '../db'; import * as monthUtils from '../../shared/months'; import { getChangedValues } from '../../shared/util'; +import * as db from '../db'; +import * as sheet from '../sheet'; import { resolveName } from '../spreadsheet/util'; +import * as budgetActions from './actions'; import * as report from './report'; import * as rollover from './rollover'; import { sumAmounts } from './util'; -import * as budgetActions from './actions'; function mergeUpdates(updates) { const merged = {}; diff --git a/packages/loot-core/src/server/budget/base.test.js b/packages/loot-core/src/server/budget/base.test.js index 6424c8d..0c58dea 100644 --- a/packages/loot-core/src/server/budget/base.test.js +++ b/packages/loot-core/src/server/budget/base.test.js @@ -1,6 +1,6 @@ -import * as sheet from '../sheet'; -import * as db from '../db'; import * as monthUtils from '../../shared/months'; +import * as db from '../db'; +import * as sheet from '../sheet'; import { createAllBudgets } from './base'; beforeEach(() => { diff --git a/packages/loot-core/src/server/budget/rollover.js b/packages/loot-core/src/server/budget/rollover.js index 4b2734b..1df8260 100644 --- a/packages/loot-core/src/server/budget/rollover.js +++ b/packages/loot-core/src/server/budget/rollover.js @@ -1,5 +1,5 @@ -import * as sheet from '../sheet'; import * as monthUtils from '../../shared/months'; +import * as sheet from '../sheet'; import { number, sumAmounts, flatten2, unflatten2 } from './util'; const { resolveName } = require('../spreadsheet/util'); diff --git a/packages/loot-core/src/server/cloud-storage.js b/packages/loot-core/src/server/cloud-storage.js index 9670290..bf41351 100644 --- a/packages/loot-core/src/server/cloud-storage.js +++ b/packages/loot-core/src/server/cloud-storage.js @@ -1,19 +1,19 @@ -import fs from '../platform/server/fs'; import asyncStorage from '../platform/server/asyncStorage'; import { fetch } from '../platform/server/fetch'; -import * as monthUtils from '../shared/months'; +import fs from '../platform/server/fs'; import * as sqlite from '../platform/server/sqlite'; -import * as prefs from './prefs'; -import { getServer } from './server-config'; -import { runMutator } from './mutators'; +import * as monthUtils from '../shared/months'; +import encryption from './encryption'; import { HTTPError, PostError, FileDownloadError, FileUploadError } from './errors'; -import encryption from './encryption'; +import { runMutator } from './mutators'; import { post } from './post'; +import * as prefs from './prefs'; +import { getServer } from './server-config'; let AdmZip = require('adm-zip'); diff --git a/packages/loot-core/src/server/db/index.js b/packages/loot-core/src/server/db/index.js index 7b96f29..0fb1d1c 100644 --- a/packages/loot-core/src/server/db/index.js +++ b/packages/loot-core/src/server/db/index.js @@ -1,17 +1,15 @@ import LRU from 'lru-cache'; -import * as sqlite from '../../platform/server/sqlite'; import fs from '../../platform/server/fs'; -import { sendMessages, batchMessages } from '../sync'; -import { schema, schemaConfig } from '../aql'; -import { - accountModel, - categoryModel, - categoryGroupModel, - payeeModel, - payeeRuleModel -} from '../models'; +import * as sqlite from '../../platform/server/sqlite'; import { groupById } from '../../shared/util'; +import { + schema, + schemaConfig, + convertForInsert, + convertForUpdate, + convertFromSelect +} from '../aql'; import { makeClock, setClock, @@ -20,7 +18,14 @@ import { makeClientId, Timestamp } from '../crdt'; -import { convertForInsert, convertForUpdate, convertFromSelect } from '../aql'; +import { + accountModel, + categoryModel, + categoryGroupModel, + payeeModel, + payeeRuleModel +} from '../models'; +import { sendMessages, batchMessages } from '../sync'; import { shoveSortOrders, SORT_INCREMENT } from './sort'; export { toDateRepr, fromDateRepr } from '../models'; diff --git a/packages/loot-core/src/server/main.js b/packages/loot-core/src/server/main.js index 0ed999e..f7f4106 100644 --- a/packages/loot-core/src/server/main.js +++ b/packages/loot-core/src/server/main.js @@ -1,22 +1,27 @@ import './polyfills'; import injectAPI from '@actual-app/api/injected'; -import asyncStorage from '../platform/server/asyncStorage'; +import { createTestBudget } from '../mocks/budget'; import { captureException, captureBreadcrumb } from '../platform/exceptions'; -import * as prefs from './prefs'; +import asyncStorage from '../platform/server/asyncStorage'; import fs from '../platform/server/fs'; -import * as sqlite from '../platform/server/sqlite'; import logger from '../platform/server/log'; -import Platform from './platform'; -import * as db from './db'; -import * as sheet from './sheet'; -import { withUndo, clearUndo, undo, redo } from './undo'; -import { updateVersion } from './update'; -import { Condition, Action, rankRules } from './accounts/rules'; -import * as rules from './accounts/transaction-rules'; -import * as mappings from './db/mappings'; -import { batchUpdateTransactions } from './accounts/transactions'; +import * as sqlite from '../platform/server/sqlite'; +import { fromPlaidAccountType } from '../shared/accounts'; +import * as monthUtils from '../shared/months'; +import q, { Query } from '../shared/query'; import { FIELD_TYPES as ruleFieldTypes } from '../shared/rules'; +import { amountToInteger, stringToInteger } from '../shared/util'; +import { exportToCSV, exportQueryToCSV } from './accounts/export-to-csv'; +import * as link from './accounts/link'; +import { parseFile } from './accounts/parse-file'; +import { getStartingBalancePayee } from './accounts/payees'; +import { Condition, Action, rankRules } from './accounts/rules'; +import * as bankSync from './accounts/sync'; +import * as rules from './accounts/transaction-rules'; +import { batchUpdateTransactions } from './accounts/transactions'; +import installAPI from './api'; +import { runQuery as aqlQuery } from './aql'; import { getAvailableBackups, loadBackup, @@ -24,14 +29,9 @@ import { startBackupService, stopBackupService } from './backups'; -import { amountToInteger, stringToInteger } from '../shared/util'; -import * as monthUtils from '../shared/months'; -import { fromPlaidAccountType } from '../shared/accounts'; +import budgetApp from './budget/app'; import * as budget from './budget/base'; -import * as bankSync from './accounts/sync'; -import * as link from './accounts/link'; -import { uniqueFileName, idFromFileName } from './util/budget-name'; -import { mutator, runHandler } from './mutators'; +import * as cloudStorage from './cloud-storage'; import { getClock, setClock, @@ -42,6 +42,19 @@ import { Timestamp, merkle } from './crdt'; +import * as db from './db'; +import * as mappings from './db/mappings'; +import encryption from './encryption'; +import { APIError, TransactionError, PostError, RuleError } from './errors'; +import app from './main-app'; +import { mutator, runHandler } from './mutators'; +import notesApp from './notes/app'; +import Platform from './platform'; +import { get, post } from './post'; +import * as prefs from './prefs'; +import schedulesApp from './schedules/app'; +import { getServer, setServer } from './server-config'; +import * as sheet from './sheet'; import { initialFullSync, fullSync, @@ -54,31 +67,17 @@ import { repairSync } from './sync'; import * as syncMigrations from './sync/migrate'; -import { getStartingBalancePayee } from './accounts/payees'; -import { parseFile } from './accounts/parse-file'; -import { exportToCSV, exportQueryToCSV } from './accounts/export-to-csv'; -import { getServer, setServer } from './server-config'; -import installAPI from './api'; -import * as cloudStorage from './cloud-storage'; -import encryption from './encryption'; -import * as tracking from './tracking/events'; -import { get, post } from './post'; -import { APIError, TransactionError, PostError, RuleError } from './errors'; -import { createTestBudget } from '../mocks/budget'; -import { runQuery as aqlQuery } from './aql'; -import q, { Query } from '../shared/query'; -import app from './main-app'; -// Apps -import schedulesApp from './schedules/app'; -import budgetApp from './budget/app'; -import notesApp from './notes/app'; import toolsApp from './tools/app'; +import * as tracking from './tracking/events'; +import { withUndo, clearUndo, undo, redo } from './undo'; +import { updateVersion } from './update'; +import { uniqueFileName, idFromFileName } from './util/budget-name'; const YNAB4 = require('@actual-app/import-ynab4/importer'); const YNAB5 = require('@actual-app/import-ynab5/importer'); -const uuid = require('../platform/uuid'); const connection = require('../platform/server/connection'); +const uuid = require('../platform/uuid'); const { resolveName, unresolveName } = require('./spreadsheet/util'); const SyncPb = require('./sync/proto/sync_pb'); diff --git a/packages/loot-core/src/server/main.test.js b/packages/loot-core/src/server/main.test.js index 06ca0ab..8b2a34b 100644 --- a/packages/loot-core/src/server/main.test.js +++ b/packages/loot-core/src/server/main.test.js @@ -1,24 +1,24 @@ import { expectSnapshotWithDiffer } from '../mocks/util'; -import * as prefs from './prefs'; -import * as db from './db'; -import * as budget from './budget/base'; import * as monthUtils from '../shared/months'; +import * as budgetActions from './budget/actions'; +import * as budget from './budget/base'; import { getClock, deserializeClock } from './crdt'; +import * as db from './db'; import { runHandler, runMutator, disableGlobalMutations, enableGlobalMutations } from './mutators'; -import * as budgetActions from './budget/actions'; +import * as prefs from './prefs'; jest.mock('./post'); +const connection = require('../platform/server/connection'); +const fs = require('../platform/server/fs'); const backend = require('./main'); const { post } = require('./post'); const handlers = backend.handlers; const sheet = require('./sheet'); -const fs = require('../platform/server/fs'); -const connection = require('../platform/server/connection'); beforeEach(async () => { await global.emptyDatabase()(); diff --git a/packages/loot-core/src/server/migrate/migrations.test.js b/packages/loot-core/src/server/migrate/migrations.test.js index 64279b0..a068eb0 100644 --- a/packages/loot-core/src/server/migrate/migrations.test.js +++ b/packages/loot-core/src/server/migrate/migrations.test.js @@ -1,3 +1,4 @@ +import * as db from '../db'; import { migrate, withMigrationsDir, @@ -5,7 +6,6 @@ import { getMigrationList, getPending } from './migrations'; -import * as db from '../db'; beforeEach(global.emptyDatabase(true)); diff --git a/packages/loot-core/src/server/mutators.js b/packages/loot-core/src/server/mutators.js index f3d29ff..2e96478 100644 --- a/packages/loot-core/src/server/mutators.js +++ b/packages/loot-core/src/server/mutators.js @@ -1,5 +1,5 @@ -import { sequential } from '../shared/async'; import { captureException, captureBreadcrumb } from '../platform/exceptions'; +import { sequential } from '../shared/async'; let runningMethods = new Set(); diff --git a/packages/loot-core/src/server/post.js b/packages/loot-core/src/server/post.js index 60d7696..5f711df 100644 --- a/packages/loot-core/src/server/post.js +++ b/packages/loot-core/src/server/post.js @@ -1,7 +1,7 @@ import Platform from './platform'; -const { PostError } = require('./errors'); const { fetch } = require('../platform/server/fetch'); +const { PostError } = require('./errors'); function throwIfNot200(res, text) { if (res.status !== 200) { diff --git a/packages/loot-core/src/server/prefs.js b/packages/loot-core/src/server/prefs.js index 495679d..6e91dba 100644 --- a/packages/loot-core/src/server/prefs.js +++ b/packages/loot-core/src/server/prefs.js @@ -1,5 +1,5 @@ -import { sendMessages } from './sync'; import { Timestamp } from './crdt'; +import { sendMessages } from './sync'; const fs = require('../platform/server/fs'); diff --git a/packages/loot-core/src/server/schedules/app.js b/packages/loot-core/src/server/schedules/app.js index e1b9666..9f813ec 100644 --- a/packages/loot-core/src/server/schedules/app.js +++ b/packages/loot-core/src/server/schedules/app.js @@ -1,20 +1,9 @@ -import deepEqual from 'deep-equal'; import * as d from 'date-fns'; +import deepEqual from 'deep-equal'; -import { createApp } from '../app'; -import * as db from '../db'; -import * as prefs from '../prefs'; -import { toDateRepr } from '../models'; -import { runQuery as aqlQuery } from '../aql'; +import { captureBreadcrumb } from '../../platform/exceptions'; import { dayFromDate, currentDay, parseDate } from '../../shared/months'; import q from '../../shared/query'; -import { - insertRule, - updateRule, - getRules, - ruleModel -} from '../accounts/transaction-rules'; -import { Rule, Condition } from '../accounts/rules'; import { extractScheduleConds, recurConfigToRSchedule, @@ -22,12 +11,23 @@ import { getStatus, getScheduledAmount } from '../../shared/schedules'; +import { Rule, Condition } from '../accounts/rules'; +import { addTransactions } from '../accounts/sync'; +import { + insertRule, + updateRule, + getRules, + ruleModel +} from '../accounts/transaction-rules'; +import { createApp } from '../app'; +import { runQuery as aqlQuery } from '../aql'; +import * as db from '../db'; +import { toDateRepr } from '../models'; import { mutator, runMutator } from '../mutators'; +import * as prefs from '../prefs'; +import { addSyncListener, batchMessages } from '../sync'; import { undoable } from '../undo'; import { Schedule as RSchedule } from '../util/rschedule'; -import { addSyncListener, batchMessages } from '../sync'; -import { captureBreadcrumb } from '../../platform/exceptions'; -import { addTransactions } from '../accounts/sync'; import { findSchedules } from './find-schedules'; const connection = require('../../platform/server/connection'); diff --git a/packages/loot-core/src/server/schedules/app.test.js b/packages/loot-core/src/server/schedules/app.test.js index 8cb0fe7..b8864e7 100644 --- a/packages/loot-core/src/server/schedules/app.test.js +++ b/packages/loot-core/src/server/schedules/app.test.js @@ -1,8 +1,8 @@ import MockDate from 'mockdate'; -import { runQuery as aqlQuery } from '../aql'; import q from '../../shared/query'; import { loadRules, updateRule } from '../accounts/transaction-rules'; +import { runQuery as aqlQuery } from '../aql'; import { loadMappings } from '../db/mappings'; import { updateConditions, diff --git a/packages/loot-core/src/server/schedules/find-schedules.js b/packages/loot-core/src/server/schedules/find-schedules.js index 5731aaf..8ac2580 100644 --- a/packages/loot-core/src/server/schedules/find-schedules.js +++ b/packages/loot-core/src/server/schedules/find-schedules.js @@ -1,15 +1,15 @@ import * as d from 'date-fns'; -import * as db from '../db'; -import { Schedule as RSchedule } from '../util/rschedule'; -import { groupBy } from '../../shared/util'; -import { fromDateRepr } from '../models'; -import { runQuery as aqlQuery } from '../aql'; +import { dayFromDate, parseDate } from '../../shared/months'; import q from '../../shared/query'; import { getApproxNumberThreshold } from '../../shared/rules'; import { recurConfigToRSchedule } from '../../shared/schedules'; -import { dayFromDate, parseDate } from '../../shared/months'; +import { groupBy } from '../../shared/util'; import { conditionsToAQL } from '../accounts/transaction-rules'; +import { runQuery as aqlQuery } from '../aql'; +import * as db from '../db'; +import { fromDateRepr } from '../models'; +import { Schedule as RSchedule } from '../util/rschedule'; const uuid = require('../../platform/uuid'); diff --git a/packages/loot-core/src/server/sheet.js b/packages/loot-core/src/server/sheet.js index 5619241..bc16219 100644 --- a/packages/loot-core/src/server/sheet.js +++ b/packages/loot-core/src/server/sheet.js @@ -1,9 +1,9 @@ -import Spreadsheet from './spreadsheet/spreadsheet'; -import * as prefs from './prefs'; import { captureBreadcrumb } from '../platform/exceptions'; import * as sqlite from '../platform/server/sqlite'; import { sheetForMonth } from '../shared/months'; import Platform from './platform'; +import * as prefs from './prefs'; +import Spreadsheet from './spreadsheet/spreadsheet'; const { resolveName } = require('./spreadsheet/util'); diff --git a/packages/loot-core/src/server/sheet.test.js b/packages/loot-core/src/server/sheet.test.js index 180f562..4f38959 100644 --- a/packages/loot-core/src/server/sheet.test.js +++ b/packages/loot-core/src/server/sheet.test.js @@ -1,6 +1,6 @@ +import { generateTransaction } from '../mocks'; import * as db from './db'; import * as sheet from './sheet'; -import { generateTransaction } from '../mocks'; beforeEach(global.emptyDatabase()); diff --git a/packages/loot-core/src/server/spreadsheet/new/compiler.js b/packages/loot-core/src/server/spreadsheet/new/compiler.js index f5cbbe9..7f1c363 100644 --- a/packages/loot-core/src/server/spreadsheet/new/compiler.js +++ b/packages/loot-core/src/server/spreadsheet/new/compiler.js @@ -1,6 +1,5 @@ -import parse from './parser'; +import getSqlFields from './get-sql-fields'; import * as nodes from './nodes'; -import generateSql from './sqlgen'; import { MOV, CALL, @@ -14,7 +13,8 @@ import { JUMPT, LABEL } from './ops'; -import getSqlFields from './get-sql-fields'; +import parse from './parser'; +import generateSql from './sqlgen'; class Compiler { constructor() { diff --git a/packages/loot-core/src/server/spreadsheet/spreadsheet.test.js b/packages/loot-core/src/server/spreadsheet/spreadsheet.test.js index 76935df..a22b7ca 100644 --- a/packages/loot-core/src/server/spreadsheet/spreadsheet.test.js +++ b/packages/loot-core/src/server/spreadsheet/spreadsheet.test.js @@ -1,6 +1,6 @@ -import Spreadsheet from './spreadsheet'; -import * as db from '../db'; import { generateTransaction } from '../../mocks'; +import * as db from '../db'; +import Spreadsheet from './spreadsheet'; beforeEach(global.emptyDatabase()); diff --git a/packages/loot-core/src/server/spreadsheet/usage.js b/packages/loot-core/src/server/spreadsheet/usage.js index c053a06..efedaa4 100644 --- a/packages/loot-core/src/server/spreadsheet/usage.js +++ b/packages/loot-core/src/server/spreadsheet/usage.js @@ -1,8 +1,8 @@ -const sqlite = require('sqlite3'); const escodegen = require('escodegen'); +const sqlite = require('sqlite3'); -const sqlgen = require('./sqlgen'); const Spreadsheet = require('./spreadsheet'); +const sqlgen = require('./sqlgen'); // Example usage: diff --git a/packages/loot-core/src/server/sync/index.js b/packages/loot-core/src/server/sync/index.js index 02248ca..20d59fc 100644 --- a/packages/loot-core/src/server/sync/index.js +++ b/packages/loot-core/src/server/sync/index.js @@ -1,16 +1,9 @@ -import { sequential, once } from '../../shared/async'; -import * as prefs from '../prefs'; -import app from '../main-app'; -import asyncStorage from '../../platform/server/asyncStorage'; import { captureException } from '../../platform/exceptions'; +import asyncStorage from '../../platform/server/asyncStorage'; import logger from '../../platform/server/log'; -import { postBinary } from '../post'; -import * as db from '../db'; -import * as sheet from '../sheet'; -import { triggerBudgetChanges, setType as setBudgetType } from '../budget/base'; -import * as undo from '../undo'; -import { runMutator } from '../mutators'; +import { sequential, once } from '../../shared/async'; import { setIn, getIn } from '../../shared/util'; +import { triggerBudgetChanges, setType as setBudgetType } from '../budget/base'; import { serializeClock, deserializeClock, @@ -18,12 +11,19 @@ import { Timestamp, merkle } from '../crdt'; -import * as encoder from './encoder'; +import * as db from '../db'; +import app from '../main-app'; +import { runMutator } from '../mutators'; +import { postBinary } from '../post'; +import * as prefs from '../prefs'; import { getServer } from '../server-config'; +import * as sheet from '../sheet'; +import * as undo from '../undo'; +import * as encoder from './encoder'; import { rebuildMerkleHash } from './repair'; -const { PostError, SyncError } = require('../errors'); const connection = require('../../platform/server/connection'); +const { PostError, SyncError } = require('../errors'); export { default as makeTestMessage } from './make-test-message'; export { default as resetSync } from './reset'; diff --git a/packages/loot-core/src/server/sync/migrate.test.js b/packages/loot-core/src/server/sync/migrate.test.js index 2042965..806b50c 100644 --- a/packages/loot-core/src/server/sync/migrate.test.js +++ b/packages/loot-core/src/server/sync/migrate.test.js @@ -1,10 +1,10 @@ import fc from 'fast-check'; -import * as db from '../db'; -import { listen, unlisten } from './migrate'; +import arbs from '../../mocks/arbitrary-schema'; import { execTracer } from '../../shared/test-helpers'; import { convertInputType, schema, schemaConfig } from '../aql'; -import arbs from '../../mocks/arbitrary-schema'; +import * as db from '../db'; +import { listen, unlisten } from './migrate'; import { addSyncListener, sendMessages } from './index'; diff --git a/packages/loot-core/src/server/sync/repair.js b/packages/loot-core/src/server/sync/repair.js index 9ebedd8..6a86aba 100644 --- a/packages/loot-core/src/server/sync/repair.js +++ b/packages/loot-core/src/server/sync/repair.js @@ -1,5 +1,5 @@ -import * as db from '../db'; import { serializeClock, getClock, Timestamp, merkle } from '../crdt'; +import * as db from '../db'; export function rebuildMerkleHash() { let rows = db.runQuery('SELECT timestamp FROM messages_crdt', [], true); diff --git a/packages/loot-core/src/server/sync/reset.js b/packages/loot-core/src/server/sync/reset.js index cbd3bff..266c0c1 100644 --- a/packages/loot-core/src/server/sync/reset.js +++ b/packages/loot-core/src/server/sync/reset.js @@ -1,9 +1,9 @@ +import { captureException } from '../../platform/exceptions'; +import asyncStorage from '../../platform/server/asyncStorage'; import * as cloudStorage from '../cloud-storage'; import * as db from '../db'; -import * as prefs from '../prefs'; -import asyncStorage from '../../platform/server/asyncStorage'; -import { captureException } from '../../platform/exceptions'; import { runMutator } from '../mutators'; +import * as prefs from '../prefs'; const connection = require('../../platform/server/connection'); diff --git a/packages/loot-core/src/server/sync/sync.property.test.js b/packages/loot-core/src/server/sync/sync.property.test.js index 943b888..6ccfe63 100644 --- a/packages/loot-core/src/server/sync/sync.property.test.js +++ b/packages/loot-core/src/server/sync/sync.property.test.js @@ -1,7 +1,7 @@ -import * as prefs from '../prefs'; -import * as db from '../db'; -import * as sheet from '../sheet'; import { merkle, getClock, Timestamp } from '../crdt'; +import * as db from '../db'; +import * as prefs from '../prefs'; +import * as sheet from '../sheet'; import * as encoder from './encoder'; import * as sync from './index'; diff --git a/packages/loot-core/src/server/sync/sync.test.js b/packages/loot-core/src/server/sync/sync.test.js index 4778360..b7efcb1 100644 --- a/packages/loot-core/src/server/sync/sync.test.js +++ b/packages/loot-core/src/server/sync/sync.test.js @@ -1,7 +1,7 @@ -import * as prefs from '../prefs'; -import * as db from '../db'; -import * as sheet from '../sheet'; import { getClock, Timestamp } from '../crdt'; +import * as db from '../db'; +import * as prefs from '../prefs'; +import * as sheet from '../sheet'; import { resolveName } from '../spreadsheet/util'; import * as encoder from './encoder'; diff --git a/packages/loot-core/src/server/tests/mockSyncServer.js b/packages/loot-core/src/server/tests/mockSyncServer.js index d245e45..1894ead 100644 --- a/packages/loot-core/src/server/tests/mockSyncServer.js +++ b/packages/loot-core/src/server/tests/mockSyncServer.js @@ -2,8 +2,8 @@ import dateFns from 'date-fns'; import { makeClock, Timestamp, merkle } from '../crdt'; -const defaultMockData = require('./mockData').basic; const SyncPb = require('../sync/proto/sync_pb'); +const defaultMockData = require('./mockData').basic; const handlers = {}; let currentMockData = defaultMockData; diff --git a/packages/loot-core/src/server/tools/app.js b/packages/loot-core/src/server/tools/app.js index 45d48c0..1a533c0 100644 --- a/packages/loot-core/src/server/tools/app.js +++ b/packages/loot-core/src/server/tools/app.js @@ -1,7 +1,7 @@ -import { runMutator } from '../mutators'; +import { batchUpdateTransactions } from '../accounts/transactions'; import { createApp } from '../app'; import * as db from '../db'; -import { batchUpdateTransactions } from '../accounts/transactions'; +import { runMutator } from '../mutators'; let app = createApp(); diff --git a/packages/loot-core/src/server/undo.js b/packages/loot-core/src/server/undo.js index 039c5a0..fde8373 100644 --- a/packages/loot-core/src/server/undo.js +++ b/packages/loot-core/src/server/undo.js @@ -1,7 +1,7 @@ -import { sendMessages } from './sync'; import { getIn } from '../shared/util'; import { Timestamp } from './crdt'; import { withMutatorContext, getMutatorContext } from './mutators'; +import { sendMessages } from './sync'; const connection = require('../platform/server/connection'); diff --git a/packages/loot-core/src/server/update.js b/packages/loot-core/src/server/update.js index 679e8d9..c8e2f6a 100644 --- a/packages/loot-core/src/server/update.js +++ b/packages/loot-core/src/server/update.js @@ -1,8 +1,8 @@ import md5 from 'md5'; -import * as migrations from './migrate/migrations'; -import * as db from './db'; import { schema, schemaConfig, makeViews } from './aql'; +import * as db from './db'; +import * as migrations from './migrate/migrations'; // Managing the init/update process diff --git a/packages/loot-design/src/components/AccountAutocomplete.js b/packages/loot-design/src/components/AccountAutocomplete.js index 764d60f..cc60052 100644 --- a/packages/loot-design/src/components/AccountAutocomplete.js +++ b/packages/loot-design/src/components/AccountAutocomplete.js @@ -2,9 +2,9 @@ import React from 'react'; import { useCachedAccounts } from 'loot-core/src/client/data-hooks/accounts'; +import { colors } from '../style'; import Autocomplete from './Autocomplete'; import { View } from './common'; -import { colors } from '../style'; export function AccountList({ items, diff --git a/packages/loot-design/src/components/Autocomplete.usage.js b/packages/loot-design/src/components/Autocomplete.usage.js index 8b50770..2820f42 100644 --- a/packages/loot-design/src/components/Autocomplete.usage.js +++ b/packages/loot-design/src/components/Autocomplete.usage.js @@ -2,8 +2,8 @@ import React from 'react'; import Component from '@reactions/component'; -import Autocomplete, { MultiAutocomplete } from './Autocomplete'; import { Section } from '../guide/components'; +import Autocomplete, { MultiAutocomplete } from './Autocomplete'; let items = [ { id: 'one', name: 'James' }, diff --git a/packages/loot-design/src/components/CategorySelect.js b/packages/loot-design/src/components/CategorySelect.js index 599a874..2218079 100644 --- a/packages/loot-design/src/components/CategorySelect.js +++ b/packages/loot-design/src/components/CategorySelect.js @@ -1,9 +1,9 @@ import React, { useMemo } from 'react'; -import { View, Text, Select } from './common'; -import Autocomplete, { defaultFilterSuggestion } from './Autocomplete'; import { colors } from '../style'; import Split from '../svg/split'; +import Autocomplete, { defaultFilterSuggestion } from './Autocomplete'; +import { View, Text, Select } from './common'; export const NativeCategorySelect = React.forwardRef( ({ categoryGroups, emptyLabel, ...nativeProps }, ref) => { diff --git a/packages/loot-design/src/components/DateSelect.usage.js b/packages/loot-design/src/components/DateSelect.usage.js index 64cb218..38019c1 100644 --- a/packages/loot-design/src/components/DateSelect.usage.js +++ b/packages/loot-design/src/components/DateSelect.usage.js @@ -1,7 +1,7 @@ import React from 'react'; -import DateSelect from './DateSelect'; import { Section } from '../guide/components'; +import DateSelect from './DateSelect'; export default () => (
diff --git a/packages/loot-design/src/components/FixedSizeList.js b/packages/loot-design/src/components/FixedSizeList.js index d3f341b..61406bf 100644 --- a/packages/loot-design/src/components/FixedSizeList.js +++ b/packages/loot-design/src/components/FixedSizeList.js @@ -2,8 +2,8 @@ import React from 'react'; import memoizeOne from 'memoize-one'; -import useResizeObserver from './useResizeObserver'; import { View } from './common'; +import useResizeObserver from './useResizeObserver'; const IS_SCROLLING_DEBOUNCE_INTERVAL = 150; diff --git a/packages/loot-design/src/components/NotesButton.js b/packages/loot-design/src/components/NotesButton.js index 990d1ea..9f07767 100644 --- a/packages/loot-design/src/components/NotesButton.js +++ b/packages/loot-design/src/components/NotesButton.js @@ -2,13 +2,13 @@ import React, { useState, useEffect, useMemo } from 'react'; import { css } from 'glamor'; -import { send } from 'loot-core/src/platform/client/fetch'; -import { useLiveQuery } from 'loot-core/src/client/query-hooks'; import q from 'loot-core/src/client/query-helpers'; +import { useLiveQuery } from 'loot-core/src/client/query-hooks'; +import { send } from 'loot-core/src/platform/client/fetch'; -import { View, Button, Tooltip, useTooltip } from './common'; -import CustomNotesPaper from '../svg/v2/CustomNotesPaper'; import { colors } from '../style'; +import CustomNotesPaper from '../svg/v2/CustomNotesPaper'; +import { View, Button, Tooltip, useTooltip } from './common'; export function NotesTooltip({ defaultNotes, diff --git a/packages/loot-design/src/components/PayeeAutocomplete.js b/packages/loot-design/src/components/PayeeAutocomplete.js index e6fd723..aa5a1f1 100644 --- a/packages/loot-design/src/components/PayeeAutocomplete.js +++ b/packages/loot-design/src/components/PayeeAutocomplete.js @@ -1,19 +1,19 @@ import React, { useState, useMemo, useRef } from 'react'; import { useDispatch } from 'react-redux'; -import { getActivePayees } from 'loot-core/src/client/reducers/queries'; import { createPayee } from 'loot-core/src/client/actions/queries'; -import { useCachedPayees } from 'loot-core/src/client/data-hooks/payees'; import { useCachedAccounts } from 'loot-core/src/client/data-hooks/accounts'; +import { useCachedPayees } from 'loot-core/src/client/data-hooks/payees'; +import { getActivePayees } from 'loot-core/src/client/reducers/queries'; -import { View } from './common'; +import { colors } from '../style'; import Add from '../svg/v1/Add'; import Autocomplete, { defaultFilterSuggestion, AutocompleteFooter, AutocompleteFooterButton } from './Autocomplete'; -import { colors } from '../style'; +import { View } from './common'; function getPayeeSuggestions(payees, focusTransferPayees, accounts) { let activePayees = accounts ? getActivePayees(payees, accounts) : payees; diff --git a/packages/loot-design/src/components/RecurringSchedulePicker.js b/packages/loot-design/src/components/RecurringSchedulePicker.js index 351b37b..7e4b29d 100644 --- a/packages/loot-design/src/components/RecurringSchedulePicker.js +++ b/packages/loot-design/src/components/RecurringSchedulePicker.js @@ -4,10 +4,10 @@ import { useSelector } from 'react-redux'; import { sendCatch } from 'loot-core/src/platform/client/fetch'; import * as monthUtils from 'loot-core/src/shared/months'; import { getRecurringDescription } from 'loot-core/src/shared/schedules'; -import { colors } from 'loot-design/src/style'; import { useTooltip } from 'loot-design/src/components/tooltips'; -import SubtractIcon from 'loot-design/src/svg/Subtract'; +import { colors } from 'loot-design/src/style'; import AddIcon from 'loot-design/src/svg/Add'; +import SubtractIcon from 'loot-design/src/svg/Subtract'; import { Button, Select, Input, Tooltip, View, Text, Stack } from './common'; import DateSelect from './DateSelect'; diff --git a/packages/loot-design/src/components/RecurringSchedulePicker.usage.js b/packages/loot-design/src/components/RecurringSchedulePicker.usage.js index c746b21..c0d0b32 100644 --- a/packages/loot-design/src/components/RecurringSchedulePicker.usage.js +++ b/packages/loot-design/src/components/RecurringSchedulePicker.usage.js @@ -1,8 +1,8 @@ import React from 'react'; -import RecurringSchedulePicker from './RecurringSchedulePicker'; import { Section } from '../guide/components'; import { Button, View } from './common'; +import RecurringSchedulePicker from './RecurringSchedulePicker'; import { useTooltip } from './tooltips'; export default () => { diff --git a/packages/loot-design/src/components/Stack.js b/packages/loot-design/src/components/Stack.js index d7108b9..a262281 100644 --- a/packages/loot-design/src/components/Stack.js +++ b/packages/loot-design/src/components/Stack.js @@ -1,7 +1,7 @@ import React from 'react'; -import View from './View'; import Text from './Text'; +import View from './View'; function getChildren(key, children) { return React.Children.toArray(children).reduce((list, child) => { diff --git a/packages/loot-design/src/components/alerts.js b/packages/loot-design/src/components/alerts.js index 866bea8..914fd3c 100644 --- a/packages/loot-design/src/components/alerts.js +++ b/packages/loot-design/src/components/alerts.js @@ -1,9 +1,9 @@ import React from 'react'; -import { View, Text } from './common'; import { styles, colors } from '../style'; -import InformationOutline from '../svg/v1/InformationOutline'; import ExclamationOutline from '../svg/v1/ExclamationOutline'; +import InformationOutline from '../svg/v1/InformationOutline'; +import { View, Text } from './common'; export function Alert({ icon: Icon, color, backgroundColor, style, children }) { return ( diff --git a/packages/loot-design/src/components/budget/BalanceWithCarryover.js b/packages/loot-design/src/components/budget/BalanceWithCarryover.js index 9a0745c..b2323ee 100644 --- a/packages/loot-design/src/components/budget/BalanceWithCarryover.js +++ b/packages/loot-design/src/components/budget/BalanceWithCarryover.js @@ -1,10 +1,10 @@ import React from 'react'; +import ArrowThinRight from '../../svg/v1/ArrowThinRight'; +import { View } from '../common'; +import CellValue from '../spreadsheet/CellValue'; import useSheetValue from '../spreadsheet/useSheetValue'; import { makeAmountStyle } from './util'; -import { View } from '../common'; -import ArrowThinRight from '../../svg/v1/ArrowThinRight'; -import CellValue from '../spreadsheet/CellValue'; export default function BalanceWithCarryover({ carryover, diff --git a/packages/loot-design/src/components/budget/BudgetSummaries.js b/packages/loot-design/src/components/budget/BudgetSummaries.js index 75a65ac..f564f11 100644 --- a/packages/loot-design/src/components/budget/BudgetSummaries.js +++ b/packages/loot-design/src/components/budget/BudgetSummaries.js @@ -6,14 +6,14 @@ import React, { useLayoutEffect } from 'react'; -import { Spring } from 'wobble'; import { css } from 'glamor'; +import { Spring } from 'wobble'; import * as monthUtils from 'loot-core/src/shared/months'; -import { MonthsContext } from './MonthsContext'; import { View } from '../common'; import useResizeObserver from '../useResizeObserver'; +import { MonthsContext } from './MonthsContext'; export default function BudgetSummaries({ SummaryComponent }) { let { months } = useContext(MonthsContext); diff --git a/packages/loot-design/src/components/budget/DynamicBudgetTable.js b/packages/loot-design/src/components/budget/DynamicBudgetTable.js index fac8f98..4a5848a 100644 --- a/packages/loot-design/src/components/budget/DynamicBudgetTable.js +++ b/packages/loot-design/src/components/budget/DynamicBudgetTable.js @@ -2,8 +2,8 @@ import React, { useEffect } from 'react'; import AutoSizer from 'react-virtualized-auto-sizer'; import { View } from '../common'; -import { CategoryGroupsContext } from './util'; import { useBudgetMonthCount } from './BudgetMonthCountContext'; +import { CategoryGroupsContext } from './util'; import { BudgetPageHeader, BudgetTable } from './index'; diff --git a/packages/loot-design/src/components/budget/index.js b/packages/loot-design/src/components/budget/index.js index 4f03742..f9a8c3e 100644 --- a/packages/loot-design/src/components/budget/index.js +++ b/packages/loot-design/src/components/budget/index.js @@ -4,7 +4,11 @@ import { scope } from '@jlongster/lively'; import * as monthUtils from 'loot-core/src/shared/months'; -import ElementQuery from '../ElementQuery'; +import { styles, colors } from '../../style'; +import ExpandArrow from '../../svg/ExpandArrow'; +import ArrowThinLeft from '../../svg/v1/ArrowThinLeft'; +import ArrowThinRight from '../../svg/v1/ArrowThinRight'; +import CheveronDown from '../../svg/v1/CheveronDown'; import { View, Text, @@ -13,7 +17,8 @@ import { Menu, IntersectionBoundary } from '../common'; -import { Row, InputCell, ROW_HEIGHT } from '../table'; +import ElementQuery from '../ElementQuery'; +import NotesButton from '../NotesButton'; import { useDraggable, useDroppable, @@ -21,16 +26,11 @@ import { DropHighlightPosContext } from '../sort.js'; import NamespaceContext from '../spreadsheet/NamespaceContext'; -import { styles, colors } from '../../style'; -import ArrowThinLeft from '../../svg/v1/ArrowThinLeft'; -import ArrowThinRight from '../../svg/v1/ArrowThinRight'; -import ExpandArrow from '../../svg/ExpandArrow'; -import CheveronDown from '../../svg/v1/CheveronDown'; -import { separateGroups, findSortDown, findSortUp } from './util'; -import { MonthsProvider, MonthsContext } from './MonthsContext'; -import NotesButton from '../NotesButton'; +import { Row, InputCell, ROW_HEIGHT } from '../table'; import BudgetSummaries from './BudgetSummaries'; import { INCOME_HEADER_HEIGHT, MONTH_BOX_SHADOW } from './constants'; +import { MonthsProvider, MonthsContext } from './MonthsContext'; +import { separateGroups, findSortDown, findSortUp } from './util'; function getScrollbarWidth() { return Math.max(styles.scrollbarWidth - 2, 0); diff --git a/packages/loot-design/src/components/budget/index.usage.js b/packages/loot-design/src/components/budget/index.usage.js index 50e16d7..5ed2c40 100644 --- a/packages/loot-design/src/components/budget/index.usage.js +++ b/packages/loot-design/src/components/budget/index.usage.js @@ -2,18 +2,18 @@ import React from 'react'; import { DndProvider } from 'react-dnd'; import Backend from 'react-dnd-html5-backend'; -import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; import { generateCategoryGroups } from 'loot-core/src/mocks'; +import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; import * as monthUtils from 'loot-core/src/shared/months'; import { Section } from '../../guide/components'; +import { colors } from '../../style'; import { View } from '../common'; import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; -import DynamicBudgetTable from './DynamicBudgetTable'; import { BudgetMonthCountContext } from './BudgetMonthCountContext'; +import DynamicBudgetTable from './DynamicBudgetTable'; import * as rollover from './rollover/rollover-components'; import { RolloverContext } from './rollover/RolloverContext'; -import { colors } from '../../style'; const categoryGroups = generateCategoryGroups([ { diff --git a/packages/loot-design/src/components/budget/report/BudgetSummary.js b/packages/loot-design/src/components/budget/report/BudgetSummary.js index 585dc46..034c368 100644 --- a/packages/loot-design/src/components/budget/report/BudgetSummary.js +++ b/packages/loot-design/src/components/budget/report/BudgetSummary.js @@ -2,13 +2,13 @@ import React, { useState } from 'react'; import { css } from 'glamor'; -import * as monthUtils from 'loot-core/src/shared/months'; import { reportBudget } from 'loot-core/src/client/queries'; +import * as monthUtils from 'loot-core/src/shared/months'; -import NamespaceContext from '../../spreadsheet/NamespaceContext'; -import CellValue from '../../spreadsheet/CellValue'; -import useSheetValue from '../../spreadsheet/useSheetValue'; -import format from '../../spreadsheet/format'; +import { colors, styles } from '../../../style'; +import DotsHorizontalTriple from '../../../svg/v1/DotsHorizontalTriple'; +import ArrowButtonDown1 from '../../../svg/v2/ArrowButtonDown1'; +import ArrowButtonUp1 from '../../../svg/v2/ArrowButtonUp1'; import { View, Text, @@ -19,14 +19,14 @@ import { HoverTarget, AlignedText } from '../../common'; +import NotesButton from '../../NotesButton'; +import CellValue from '../../spreadsheet/CellValue'; +import format from '../../spreadsheet/format'; +import NamespaceContext from '../../spreadsheet/NamespaceContext'; +import useSheetValue from '../../spreadsheet/useSheetValue'; import { MONTH_BOX_SHADOW } from '../constants'; import { makeAmountFullStyle } from '../util'; -import ArrowButtonDown1 from '../../../svg/v2/ArrowButtonDown1'; -import ArrowButtonUp1 from '../../../svg/v2/ArrowButtonUp1'; -import DotsHorizontalTriple from '../../../svg/v1/DotsHorizontalTriple'; import { useReport } from './ReportContext'; -import NotesButton from '../../NotesButton'; -import { colors, styles } from '../../../style'; function PieProgress({ style, progress, color, backgroundColor }) { let radius = 4; diff --git a/packages/loot-design/src/components/budget/report/components.js b/packages/loot-design/src/components/budget/report/components.js index 87c73c0..1327dfd 100644 --- a/packages/loot-design/src/components/budget/report/components.js +++ b/packages/loot-design/src/components/budget/report/components.js @@ -1,18 +1,18 @@ import React from 'react'; -import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; -import evalArithmetic from 'loot-core/src/shared/arithmetic'; import { reportBudget } from 'loot-core/src/client/queries'; +import evalArithmetic from 'loot-core/src/shared/arithmetic'; +import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import { styles, colors } from '../../../style'; import { View, Text, Tooltip, Menu, useTooltip } from '../../common'; -import { Field, SheetCell } from '../../table'; -import useSheetValue from '../../spreadsheet/useSheetValue'; -import { makeAmountGrey } from '../util'; -import { MONTH_RIGHT_PADDING } from '../constants'; -import format from '../../spreadsheet/format'; import CellValue from '../../spreadsheet/CellValue'; +import format from '../../spreadsheet/format'; +import useSheetValue from '../../spreadsheet/useSheetValue'; +import { Field, SheetCell } from '../../table'; import BalanceWithCarryover from '../BalanceWithCarryover'; +import { MONTH_RIGHT_PADDING } from '../constants'; +import { makeAmountGrey } from '../util'; export BudgetSummary from './BudgetSummary'; diff --git a/packages/loot-design/src/components/budget/rollover/BudgetSummary.js b/packages/loot-design/src/components/budget/rollover/BudgetSummary.js index c260017..715c8ed 100644 --- a/packages/loot-design/src/components/budget/rollover/BudgetSummary.js +++ b/packages/loot-design/src/components/budget/rollover/BudgetSummary.js @@ -1,15 +1,15 @@ import React, { useState } from 'react'; -import { css } from 'glamor'; import Component from '@reactions/component'; +import { css } from 'glamor'; -import * as monthUtils from 'loot-core/src/shared/months'; import { rolloverBudget } from 'loot-core/src/client/queries'; +import * as monthUtils from 'loot-core/src/shared/months'; -import NamespaceContext from '../../spreadsheet/NamespaceContext'; -import format from '../../spreadsheet/format'; -import SheetValue from '../../spreadsheet/SheetValue'; -import CellValue from '../../spreadsheet/CellValue'; +import { colors, styles } from '../../../style'; +import DotsHorizontalTriple from '../../../svg/v1/DotsHorizontalTriple'; +import ArrowButtonDown1 from '../../../svg/v2/ArrowButtonDown1'; +import ArrowButtonUp1 from '../../../svg/v2/ArrowButtonUp1'; import { View, Block, @@ -19,15 +19,15 @@ import { HoverTarget, AlignedText } from '../../common'; +import NotesButton from '../../NotesButton'; +import CellValue from '../../spreadsheet/CellValue'; +import format from '../../spreadsheet/format'; +import NamespaceContext from '../../spreadsheet/NamespaceContext'; +import SheetValue from '../../spreadsheet/SheetValue'; import { MONTH_BOX_SHADOW } from '../constants'; -import ArrowButtonDown1 from '../../../svg/v2/ArrowButtonDown1'; -import ArrowButtonUp1 from '../../../svg/v2/ArrowButtonUp1'; -import DotsHorizontalTriple from '../../../svg/v1/DotsHorizontalTriple'; -import { colors, styles } from '../../../style'; +import HoldTooltip from './HoldTooltip'; import { useRollover } from './RolloverContext'; import TransferTooltip from './TransferTooltip'; -import HoldTooltip from './HoldTooltip'; -import NotesButton from '../../NotesButton'; function TotalsList({ prevMonthName, collapsed }) { return ( diff --git a/packages/loot-design/src/components/budget/rollover/HoldTooltip.js b/packages/loot-design/src/components/budget/rollover/HoldTooltip.js index cccbdbc..941ec4f 100644 --- a/packages/loot-design/src/components/budget/rollover/HoldTooltip.js +++ b/packages/loot-design/src/components/budget/rollover/HoldTooltip.js @@ -1,11 +1,11 @@ import React, { useState, useContext, useEffect } from 'react'; -import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import evalArithmetic from 'loot-core/src/shared/arithmetic'; +import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import { View, Button, Tooltip, InitialFocus, Input } from '../../common'; -import SpreadsheetContext from '../../spreadsheet/SpreadsheetContext'; import NamespaceContext from '../../spreadsheet/NamespaceContext'; +import SpreadsheetContext from '../../spreadsheet/SpreadsheetContext'; export default function HoldTooltip({ onSubmit, onClose }) { const spreadsheet = useContext(SpreadsheetContext); diff --git a/packages/loot-design/src/components/budget/rollover/TransferTooltip.js b/packages/loot-design/src/components/budget/rollover/TransferTooltip.js index 4e7a76d..3fc971d 100644 --- a/packages/loot-design/src/components/budget/rollover/TransferTooltip.js +++ b/packages/loot-design/src/components/budget/rollover/TransferTooltip.js @@ -1,14 +1,13 @@ import React, { useState, useContext, useEffect } from 'react'; -import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import evalArithmetic from 'loot-core/src/shared/arithmetic'; +import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; -import { View, Button, Tooltip, InitialFocus, Input } from '../../common'; -import SpreadsheetContext from '../../spreadsheet/SpreadsheetContext'; -import NamespaceContext from '../../spreadsheet/NamespaceContext'; -import { addToBeBudgetedGroup } from '../util'; import CategoryAutocomplete from '../../CategorySelect'; -import { CategoryGroupsContext } from '../util'; +import { View, Button, Tooltip, InitialFocus, Input } from '../../common'; +import NamespaceContext from '../../spreadsheet/NamespaceContext'; +import SpreadsheetContext from '../../spreadsheet/SpreadsheetContext'; +import { addToBeBudgetedGroup, CategoryGroupsContext } from '../util'; export default function TransferTooltip({ initialAmount, diff --git a/packages/loot-design/src/components/budget/rollover/rollover-components.js b/packages/loot-design/src/components/budget/rollover/rollover-components.js index 8dfca9e..ecd8210 100644 --- a/packages/loot-design/src/components/budget/rollover/rollover-components.js +++ b/packages/loot-design/src/components/budget/rollover/rollover-components.js @@ -1,10 +1,11 @@ import React, { useContext, useState } from 'react'; -import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; -import evalArithmetic from 'loot-core/src/shared/arithmetic'; import { rolloverBudget } from 'loot-core/src/client/queries'; +import evalArithmetic from 'loot-core/src/shared/arithmetic'; +import { integerToCurrency, amountToInteger } from 'loot-core/src/shared/util'; import { styles, colors } from '../../../style'; +import CategoryAutocomplete from '../../CategorySelect'; import { View, Text, @@ -14,19 +15,18 @@ import { Button, Menu } from '../../common'; +import CellValue from '../../spreadsheet/CellValue'; +import format from '../../spreadsheet/format'; +import useSheetValue from '../../spreadsheet/useSheetValue'; import { Row, Field, SheetCell } from '../../table'; +import BalanceWithCarryover from '../BalanceWithCarryover'; +import { MONTH_RIGHT_PADDING } from '../constants'; import { makeAmountGrey, addToBeBudgetedGroup, CategoryGroupsContext } from '../util'; -import { MONTH_RIGHT_PADDING } from '../constants'; -import useSheetValue from '../../spreadsheet/useSheetValue'; -import format from '../../spreadsheet/format'; -import CellValue from '../../spreadsheet/CellValue'; -import CategoryAutocomplete from '../../CategorySelect'; import TransferTooltip from './TransferTooltip'; -import BalanceWithCarryover from '../BalanceWithCarryover'; export BudgetSummary from './BudgetSummary'; diff --git a/packages/loot-design/src/components/common.js b/packages/loot-design/src/components/common.js index db86d08..8b0ab4c 100644 --- a/packages/loot-design/src/components/common.js +++ b/packages/loot-design/src/components/common.js @@ -15,8 +15,6 @@ import { useRouteMatch } from 'react-router-dom'; -import { css } from 'glamor'; -import hotkeys from 'hotkeys-js'; import { ListboxInput, ListboxButton, @@ -24,6 +22,8 @@ import { ListboxList, ListboxOption } from '@reach/listbox'; +import { css } from 'glamor'; +import hotkeys from 'hotkeys-js'; import { integerToCurrency } from 'loot-core/src/shared/util'; import ExpandArrow from 'loot-design/src/svg/ExpandArrow'; @@ -31,9 +31,9 @@ import ExpandArrow from 'loot-design/src/svg/ExpandArrow'; import { styles, colors } from '../style'; import Delete from '../svg/Delete'; import Loading from '../svg/v1/AnimatedLoading'; -import View from './View'; import Text from './Text'; import { useProperFocus } from './useProperFocus'; +import View from './View'; export { default as View } from './View'; export { default as Text } from './Text'; diff --git a/packages/loot-design/src/components/forms.js b/packages/loot-design/src/components/forms.js index b37e997..fff505a 100644 --- a/packages/loot-design/src/components/forms.js +++ b/packages/loot-design/src/components/forms.js @@ -2,8 +2,8 @@ import React from 'react'; import { css } from 'glamor'; -import { View, Text } from './common'; import { colors } from '../style'; +import { View, Text } from './common'; export function SectionLabel({ title, style }) { return ( diff --git a/packages/loot-design/src/components/manager/BudgetList.js b/packages/loot-design/src/components/manager/BudgetList.js index 13863b2..493dd44 100644 --- a/packages/loot-design/src/components/manager/BudgetList.js +++ b/packages/loot-design/src/components/manager/BudgetList.js @@ -1,16 +1,16 @@ import React, { useState, useRef } from 'react'; +import Loading from 'loot-design/src/svg/v1/AnimatedLoading'; import Key from 'loot-design/src/svg/v2/Key'; import RefreshArrow from 'loot-design/src/svg/v2/RefreshArrow'; -import Loading from 'loot-design/src/svg/v1/AnimatedLoading'; -import { View, Text, Modal, Button, Tooltip, Menu } from '../common'; import { styles, colors } from '../../style'; import CloudCheck from '../../svg/v1/CloudCheck'; import CloudDownload from '../../svg/v1/CloudDownload'; -import CloudUnknown from '../../svg/v2/CloudUnknown'; -import FileDouble from '../../svg/v1/FileDouble'; import DotsHorizontalTriple from '../../svg/v1/DotsHorizontalTriple'; +import FileDouble from '../../svg/v1/FileDouble'; +import CloudUnknown from '../../svg/v2/CloudUnknown'; +import { View, Text, Modal, Button, Tooltip, Menu } from '../common'; function getFileDescription(file) { if (file.state === 'unknown') { diff --git a/packages/loot-design/src/components/manager/DeleteFile.js b/packages/loot-design/src/components/manager/DeleteFile.js index 16c523a..9eaa686 100644 --- a/packages/loot-design/src/components/manager/DeleteFile.js +++ b/packages/loot-design/src/components/manager/DeleteFile.js @@ -1,7 +1,7 @@ import React, { useState } from 'react'; -import { View, Text, Modal, ButtonWithLoading } from '../common'; import { colors } from '../../style'; +import { View, Text, Modal, ButtonWithLoading } from '../common'; export default function DeleteMenu({ modalProps, actions, file }) { let [loadingState, setLoadingState] = useState(null); diff --git a/packages/loot-design/src/components/manager/Import.js b/packages/loot-design/src/components/manager/Import.js index cbf39c8..105cdbd 100644 --- a/packages/loot-design/src/components/manager/Import.js +++ b/packages/loot-design/src/components/manager/Import.js @@ -1,7 +1,7 @@ import React, { useState } from 'react'; -import { View, Block, Modal, Button } from '../common'; import { styles, colors } from '../../style'; +import { View, Block, Modal, Button } from '../common'; function getErrorMessage(error) { switch (error) { diff --git a/packages/loot-design/src/components/manager/ImportActual.js b/packages/loot-design/src/components/manager/ImportActual.js index 850bcde..eedf0ab 100644 --- a/packages/loot-design/src/components/manager/ImportActual.js +++ b/packages/loot-design/src/components/manager/ImportActual.js @@ -3,6 +3,7 @@ import { useDispatch } from 'react-redux'; import { importBudget } from 'loot-core/src/client/actions/budgets'; +import { styles, colors } from '../../style'; import { View, Block, @@ -13,7 +14,6 @@ import { P, ExternalLink } from '../common'; -import { styles, colors } from '../../style'; function getErrorMessage(error) { switch (error) { diff --git a/packages/loot-design/src/components/manager/ImportYNAB4.js b/packages/loot-design/src/components/manager/ImportYNAB4.js index fcb4ed5..1106bca 100644 --- a/packages/loot-design/src/components/manager/ImportYNAB4.js +++ b/packages/loot-design/src/components/manager/ImportYNAB4.js @@ -3,8 +3,8 @@ import { useDispatch } from 'react-redux'; import { importBudget } from 'loot-core/src/client/actions/budgets'; -import { View, Block, Modal, Button, ButtonWithLoading, P } from '../common'; import { styles, colors } from '../../style'; +import { View, Block, Modal, Button, ButtonWithLoading, P } from '../common'; function getErrorMessage(error) { switch (error) { diff --git a/packages/loot-design/src/components/manager/ImportYNAB5.js b/packages/loot-design/src/components/manager/ImportYNAB5.js index c6929d9..036a949 100644 --- a/packages/loot-design/src/components/manager/ImportYNAB5.js +++ b/packages/loot-design/src/components/manager/ImportYNAB5.js @@ -3,6 +3,7 @@ import { useDispatch } from 'react-redux'; import { importBudget } from 'loot-core/src/client/actions/budgets'; +import { styles, colors } from '../../style'; import { View, Block, @@ -12,7 +13,6 @@ import { P, ExternalLink } from '../common'; -import { styles, colors } from '../../style'; function getErrorMessage(error) { switch (error) { diff --git a/packages/loot-design/src/components/mobile/AmountInput.js b/packages/loot-design/src/components/mobile/AmountInput.js index 14cfc6e..89fa655 100644 --- a/packages/loot-design/src/components/mobile/AmountInput.js +++ b/packages/loot-design/src/components/mobile/AmountInput.js @@ -11,20 +11,20 @@ import { RectButton } from 'react-native-gesture-handler'; import mitt from 'mitt'; +import Platform from 'loot-core/src/client/platform'; import { toRelaxedNumber, amountToCurrency, getNumberFormat } from 'loot-core/src/shared/util'; -import Platform from 'loot-core/src/client/platform'; import { colors } from '../../style'; -import { KeyboardButton } from './common'; -import TextInputWithAccessory from './TextInputWithAccessory'; import MathIcon from '../../svg/Math'; import Add from '../../svg/v1/Add'; -import Subtract from '../../svg/v1/Subtract'; import Equals from '../../svg/v1/Equals'; +import Subtract from '../../svg/v1/Subtract'; +import { KeyboardButton } from './common'; +import TextInputWithAccessory from './TextInputWithAccessory'; function getValue(state) { const { value, isNegative } = state; diff --git a/packages/loot-design/src/components/mobile/account.js b/packages/loot-design/src/components/mobile/account.js index 2e9bafb..a2b1e68 100644 --- a/packages/loot-design/src/components/mobile/account.js +++ b/packages/loot-design/src/components/mobile/account.js @@ -1,11 +1,11 @@ import React, { useMemo } from 'react'; import { View, TextInput } from 'react-native'; -import CellValue from '../spreadsheet/CellValue'; -import { TransactionList } from './transaction'; -import Search from '../../svg/v1/Search'; -import { Label } from './common'; import { colors } from '../../style'; +import Search from '../../svg/v1/Search'; +import CellValue from '../spreadsheet/CellValue'; +import { Label } from './common'; +import { TransactionList } from './transaction'; class TransactionSearchInput extends React.Component { state = { text: '' }; diff --git a/packages/loot-design/src/components/mobile/account.usage.js b/packages/loot-design/src/components/mobile/account.usage.js index c27b241..e8b5be3 100644 --- a/packages/loot-design/src/components/mobile/account.usage.js +++ b/packages/loot-design/src/components/mobile/account.usage.js @@ -2,10 +2,10 @@ import React from 'react'; import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; -import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; import { MobileSection, WithHeader } from '../../guide/components'; -import { accounts, categories, transactions } from './accounts.usage'; +import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; import { AccountDetails } from './account'; +import { accounts, categories, transactions } from './accounts.usage'; export default () => ( diff --git a/packages/loot-design/src/components/mobile/accounts.js b/packages/loot-design/src/components/mobile/accounts.js index 88da1f1..9f6c733 100644 --- a/packages/loot-design/src/components/mobile/accounts.js +++ b/packages/loot-design/src/components/mobile/accounts.js @@ -4,11 +4,11 @@ import { RectButton } from 'react-native-gesture-handler'; import { prettyAccountType } from 'loot-core/src/shared/accounts'; +import { colors, mobileStyles as styles } from '../../style'; +import Wallet from '../../svg/v1/Wallet'; +import CellValue from '../spreadsheet/CellValue'; import { Button, TextOneLine } from './common'; import { TransactionList } from './transaction'; -import CellValue from '../spreadsheet/CellValue'; -import Wallet from '../../svg/v1/Wallet'; -import { colors, mobileStyles as styles } from '../../style'; export function AccountHeader({ name, amount }) { return ( diff --git a/packages/loot-design/src/components/mobile/accounts.usage.js b/packages/loot-design/src/components/mobile/accounts.usage.js index f889e76..9cde14f 100644 --- a/packages/loot-design/src/components/mobile/accounts.usage.js +++ b/packages/loot-design/src/components/mobile/accounts.usage.js @@ -1,11 +1,11 @@ import React from 'react'; -import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; import { generateAccount, generateCategory, generateTransaction } from 'loot-core/src/mocks'; +import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; import { MobileSection } from '../../guide/components'; import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; diff --git a/packages/loot-design/src/components/mobile/alerts.js b/packages/loot-design/src/components/mobile/alerts.js index cb5fa9c..1e8c870 100644 --- a/packages/loot-design/src/components/mobile/alerts.js +++ b/packages/loot-design/src/components/mobile/alerts.js @@ -1,8 +1,8 @@ import React from 'react'; import { View, Text } from 'react-native'; -import InformationSolid from 'loot-design/src/svg/v1/InformationOutline'; import { styles, colors } from 'loot-design/src/style'; +import InformationSolid from 'loot-design/src/svg/v1/InformationOutline'; export function Information({ style, children }) { return ( diff --git a/packages/loot-design/src/components/mobile/budget.js b/packages/loot-design/src/components/mobile/budget.js index 3b5e080..8790905 100644 --- a/packages/loot-design/src/components/mobile/budget.js +++ b/packages/loot-design/src/components/mobile/budget.js @@ -17,31 +17,31 @@ import Animated, { Easing } from 'react-native-reanimated'; import memoizeOne from 'memoize-one'; -import { amountToInteger, integerToAmount } from 'loot-core/src/shared/util'; -import * as monthUtils from 'loot-core/src/shared/months'; import Platform from 'loot-core/src/client/platform'; import { rolloverBudget, reportBudget } from 'loot-core/src/client/queries'; +import * as monthUtils from 'loot-core/src/shared/months'; +import { amountToInteger, integerToAmount } from 'loot-core/src/shared/util'; -import AndroidKeyboardAvoidingView from './AndroidKeyboardAvoidingView'; +import { colors, mobileStyles as styles } from '../../style'; +import Add from '../../svg/v1/Add'; +import ArrowThinDown from '../../svg/v1/ArrowThinDown'; +import ArrowThinLeft from '../../svg/v1/ArrowThinLeft'; +import ArrowThinRight from '../../svg/v1/ArrowThinRight'; +import ArrowThinUp from '../../svg/v1/ArrowThinUp'; +import DotsHorizontalTriple from '../../svg/v1/DotsHorizontalTriple'; import CellValue from '../spreadsheet/CellValue'; +import format from '../spreadsheet/format'; +import NamespaceContext from '../spreadsheet/NamespaceContext'; import SheetValue from '../spreadsheet/SheetValue'; import useSheetValue from '../spreadsheet/useSheetValue'; -import { colors, mobileStyles as styles } from '../../style'; -import format from '../spreadsheet/format'; -import { Button, KeyboardButton, Card, Label } from './common'; -import { ListItem, ROW_HEIGHT } from './table'; -import NamespaceContext from '../spreadsheet/NamespaceContext'; import AmountInput, { MathOperations, AmountAccessoryContext } from './AmountInput'; +import AndroidKeyboardAvoidingView from './AndroidKeyboardAvoidingView'; +import { Button, KeyboardButton, Card, Label } from './common'; import { DragDrop, Draggable, Droppable, DragDropHighlight } from './dragdrop'; -import ArrowThinLeft from '../../svg/v1/ArrowThinLeft'; -import ArrowThinRight from '../../svg/v1/ArrowThinRight'; -import ArrowThinUp from '../../svg/v1/ArrowThinUp'; -import ArrowThinDown from '../../svg/v1/ArrowThinDown'; -import DotsHorizontalTriple from '../../svg/v1/DotsHorizontalTriple'; -import Add from '../../svg/v1/Add'; +import { ListItem, ROW_HEIGHT } from './table'; const ACTScrollViewManager = NativeModules && NativeModules.ACTScrollViewManager; diff --git a/packages/loot-design/src/components/mobile/budget.test.js b/packages/loot-design/src/components/mobile/budget.test.js index ea71e35..53e6003 100644 --- a/packages/loot-design/src/components/mobile/budget.test.js +++ b/packages/loot-design/src/components/mobile/budget.test.js @@ -2,14 +2,14 @@ import React from 'react'; import { render, fireEvent } from '@testing-library/react'; -import * as monthUtils from 'loot-core/src/shared/months'; import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; +import * as monthUtils from 'loot-core/src/shared/months'; import { MobileScreen } from '../../guide/components'; -import { categories, categoryGroups } from './budget.usage'; -import { BudgetTable, BudgetAccessoryView } from './budget'; -import InputAccessoryView from './InputAccessoryView'; import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; +import { BudgetTable, BudgetAccessoryView } from './budget'; +import { categories, categoryGroups } from './budget.usage'; +import InputAccessoryView from './InputAccessoryView'; function makeLoadedSpreadsheet() { let spreadsheet = makeSpreadsheet(); diff --git a/packages/loot-design/src/components/mobile/budget.usage.js b/packages/loot-design/src/components/mobile/budget.usage.js index 01d268e..769dc0e 100644 --- a/packages/loot-design/src/components/mobile/budget.usage.js +++ b/packages/loot-design/src/components/mobile/budget.usage.js @@ -5,9 +5,9 @@ import { generateCategoryGroups } from 'loot-core/src/mocks'; import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; import { MobileSection } from '../../guide/components'; +import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; import { BudgetTable, BudgetAccessoryView } from './budget'; import InputAccessoryView from './InputAccessoryView'; -import SpreadsheetContext from '../spreadsheet/SpreadsheetContext'; export const categoryGroups = generateCategoryGroups([ { diff --git a/packages/loot-design/src/components/mobile/transaction.js b/packages/loot-design/src/components/mobile/transaction.js index 6b8cc91..3e04d6d 100644 --- a/packages/loot-design/src/components/mobile/transaction.js +++ b/packages/loot-design/src/components/mobile/transaction.js @@ -2,13 +2,13 @@ import React from 'react'; import { View, Text, SectionList, ScrollView, Animated } from 'react-native'; import { Swipeable, RectButton } from 'react-native-gesture-handler'; -import memoizeOne from 'memoize-one'; import { format as formatDate, parse as parseDate, parseISO, isValid as isValidDate } from 'date-fns'; +import memoizeOne from 'memoize-one'; import * as monthUtils from 'loot-core/src/shared/months'; import { @@ -27,14 +27,15 @@ import { } from 'loot-core/src/shared/util'; import ArrowsSynchronize from 'loot-design/src/svg/v2/ArrowsSynchronize'; -import KeyboardAvoidingView from './KeyboardAvoidingView'; -import { ListItem } from './table'; -import { Button, TextOneLine } from './common'; import { colors, mobileStyles as styles } from '../../style'; import Add from '../../svg/v1/Add'; import Trash from '../../svg/v1/Trash'; +import AlertTriangle from '../../svg/v2/AlertTriangle'; +import CheckCircle1 from '../../svg/v2/CheckCircle1'; +import EditSkull1 from '../../svg/v2/EditSkull1'; import PencilWriteAlternate from '../../svg/v2/PencilWriteAlternate'; import { FocusableAmountInput } from './AmountInput'; +import { Button, TextOneLine } from './common'; import ExitTransition from './ExitTransition'; import { FieldLabel, @@ -43,9 +44,8 @@ import { BooleanField, EDITING_PADDING } from './forms'; -import EditSkull1 from '../../svg/v2/EditSkull1'; -import AlertTriangle from '../../svg/v2/AlertTriangle'; -import CheckCircle1 from '../../svg/v2/CheckCircle1'; +import KeyboardAvoidingView from './KeyboardAvoidingView'; +import { ListItem } from './table'; let getPayeesById = memoizeOne(payees => groupById(payees)); let getAccountsById = memoizeOne(accounts => groupById(accounts)); diff --git a/packages/loot-design/src/components/mobile/transaction.usage.js b/packages/loot-design/src/components/mobile/transaction.usage.js index 669c48f..7fae136 100644 --- a/packages/loot-design/src/components/mobile/transaction.usage.js +++ b/packages/loot-design/src/components/mobile/transaction.usage.js @@ -1,15 +1,15 @@ import React from 'react'; -import * as monthUtils from 'loot-core/src/shared/months'; import { generateAccount, generateCategory, generateTransaction } from 'loot-core/src/mocks'; +import * as monthUtils from 'loot-core/src/shared/months'; import { Section, MobileSection } from '../../guide/components'; -import { TransactionList, TransactionEdit } from './transaction'; import { colors } from '../../style'; +import { TransactionList, TransactionEdit } from './transaction'; export const accounts = [generateAccount('Checking')]; diff --git a/packages/loot-design/src/components/modals/CloseAccount.js b/packages/loot-design/src/components/modals/CloseAccount.js index f1963ae..293ecf7 100644 --- a/packages/loot-design/src/components/modals/CloseAccount.js +++ b/packages/loot-design/src/components/modals/CloseAccount.js @@ -4,8 +4,8 @@ import { Formik } from 'formik'; import { integerToCurrency } from 'loot-core/src/shared/util'; -import { View, Text, Modal, Button, P, Select, FormError } from '../common'; import { colors } from '../../style'; +import { View, Text, Modal, Button, P, Select, FormError } from '../common'; function needsCategory(account, currentTransfer, accounts) { const acct = accounts.find(a => a.id === currentTransfer); diff --git a/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.js b/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.js index 045df62..58ded94 100644 --- a/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.js +++ b/packages/loot-design/src/components/modals/ConfigureLinkedAccounts.js @@ -7,8 +7,8 @@ import { } from 'loot-core/src/shared/accounts'; import Checkmark from 'loot-design/src/svg/v1/Checkmark'; -import { View, Text, Modal, Button } from '../common'; import { styles, colors } from '../../style'; +import { View, Text, Modal, Button } from '../common'; function EmptyMessage() { return null; diff --git a/packages/loot-design/src/components/modals/CreateLocalAccount.js b/packages/loot-design/src/components/modals/CreateLocalAccount.js index b5d59b8..d4f919c 100644 --- a/packages/loot-design/src/components/modals/CreateLocalAccount.js +++ b/packages/loot-design/src/components/modals/CreateLocalAccount.js @@ -2,8 +2,8 @@ import React from 'react'; import { Formik } from 'formik'; -import { toRelaxedNumber } from 'loot-core/src/shared/util'; import { determineOffBudget } from 'loot-core/src/shared/accounts'; +import { toRelaxedNumber } from 'loot-core/src/shared/util'; import { View, diff --git a/packages/loot-design/src/components/modals/EditField.js b/packages/loot-design/src/components/modals/EditField.js index 5d9e269..9b0277d 100644 --- a/packages/loot-design/src/components/modals/EditField.js +++ b/packages/loot-design/src/components/modals/EditField.js @@ -4,16 +4,16 @@ import { connect } from 'react-redux'; import { parseISO, format as formatDate, parse as parseDate } from 'date-fns'; import * as actions from 'loot-core/src/client/actions'; -import { amountToInteger } from 'loot-core/src/shared/util'; import { currentDay, dayFromDate } from 'loot-core/src/shared/months'; +import { amountToInteger } from 'loot-core/src/shared/util'; +import { colors } from '../../style'; +import AccountAutocomplete from '../AccountAutocomplete'; +import CategoryAutocomplete from '../CategorySelect'; import { View, Modal, Input } from '../common'; import DateSelect from '../DateSelect'; -import CategoryAutocomplete from '../CategorySelect'; -import AccountAutocomplete from '../AccountAutocomplete'; -import PayeeAutocomplete from '../PayeeAutocomplete'; import { SectionLabel } from '../forms'; -import { colors } from '../../style'; +import PayeeAutocomplete from '../PayeeAutocomplete'; // import { colors } from '../../style'; function EditField({ diff --git a/packages/loot-design/src/components/modals/ImportTransactions.js b/packages/loot-design/src/components/modals/ImportTransactions.js index 2972847..89a9723 100644 --- a/packages/loot-design/src/components/modals/ImportTransactions.js +++ b/packages/loot-design/src/components/modals/ImportTransactions.js @@ -11,6 +11,7 @@ import { looselyParseAmount } from 'loot-core/src/shared/util'; +import { colors, styles } from '../../style'; import { View, Text, @@ -20,10 +21,8 @@ import { Button, ButtonWithLoading } from '../common'; -import { Checkbox } from '../forms'; +import { Checkbox, SectionLabel } from '../forms'; import { TableHeader, TableWithNavigator, Row, Field } from '../table'; -import { SectionLabel } from '../forms'; -import { colors, styles } from '../../style'; let dateFormats = [ { format: 'yyyy mm dd', label: 'YYYY MM DD' }, diff --git a/packages/loot-design/src/components/modals/ImportTransactions.usage.js b/packages/loot-design/src/components/modals/ImportTransactions.usage.js index 922d472..892cc78 100644 --- a/packages/loot-design/src/components/modals/ImportTransactions.usage.js +++ b/packages/loot-design/src/components/modals/ImportTransactions.usage.js @@ -1,7 +1,7 @@ import React from 'react'; -import { TestProvider } from 'loot-core/src/mocks/redux'; import { generateTransactions } from 'loot-core/src/mocks'; +import { TestProvider } from 'loot-core/src/mocks/redux'; import { Section, TestModal } from '../../guide/components'; import { ImportTransactions } from './ImportTransactions'; diff --git a/packages/loot-design/src/components/modals/LoadBackup.js b/packages/loot-design/src/components/modals/LoadBackup.js index 8eb66d9..d9c9fd0 100644 --- a/packages/loot-design/src/components/modals/LoadBackup.js +++ b/packages/loot-design/src/components/modals/LoadBackup.js @@ -1,8 +1,8 @@ import React from 'react'; +import { colors } from '../../style'; import { View, Text, Block, Modal, Button } from '../common'; import { Row, Cell } from '../table'; -import { colors } from '../../style'; class BackupTable extends React.Component { state = { hoveredBackup: null }; diff --git a/packages/loot-design/src/components/modals/PlaidExternalMsg.js b/packages/loot-design/src/components/modals/PlaidExternalMsg.js index 0bbce03..5affaa8 100644 --- a/packages/loot-design/src/components/modals/PlaidExternalMsg.js +++ b/packages/loot-design/src/components/modals/PlaidExternalMsg.js @@ -1,9 +1,9 @@ import React, { useState, useRef } from 'react'; -import { View, Text, Modal, Button, P, ModalButtons } from '../common'; -import { Error } from '../alerts'; import { colors } from '../../style'; import AnimatedLoading from '../../svg/v1/AnimatedLoading'; +import { Error } from '../alerts'; +import { View, Text, Modal, Button, P, ModalButtons } from '../common'; function renderError(error) { return ( diff --git a/packages/loot-design/src/components/payees.js b/packages/loot-design/src/components/payees.js index 7805975..009f8f9 100644 --- a/packages/loot-design/src/components/payees.js +++ b/packages/loot-design/src/components/payees.js @@ -8,11 +8,16 @@ import React, { useImperativeHandle } from 'react'; -import memoizeOne from 'memoize-one'; import Component from '@reactions/component'; +import memoizeOne from 'memoize-one'; import { groupById } from 'loot-core/src/shared/util'; +import { colors } from '../style'; +import Delete from '../svg/Delete'; +import ExpandArrow from '../svg/ExpandArrow'; +import Merge from '../svg/merge'; +import ArrowThinRight from '../svg/v1/ArrowThinRight'; import { useStableCallback, View, @@ -23,7 +28,6 @@ import { Tooltip, Menu } from './common'; -import { colors } from '../style'; import { Table, Row, @@ -38,10 +42,6 @@ import useSelected, { useSelectedItems, useSelectedDispatch } from './useSelected'; -import Delete from '../svg/Delete'; -import Merge from '../svg/merge'; -import ExpandArrow from '../svg/ExpandArrow'; -import ArrowThinRight from '../svg/v1/ArrowThinRight'; let getPayeesById = memoizeOne(payees => groupById(payees)); diff --git a/packages/loot-design/src/components/payees.usage.js b/packages/loot-design/src/components/payees.usage.js index e6c439d..1eeacf9 100644 --- a/packages/loot-design/src/components/payees.usage.js +++ b/packages/loot-design/src/components/payees.usage.js @@ -2,8 +2,8 @@ import React from 'react'; import Component from '@reactions/component'; -import { applyChanges } from 'loot-core/src/shared/util'; import { TestProvider } from 'loot-core/src/mocks/redux'; +import { applyChanges } from 'loot-core/src/shared/util'; import { Section, TestModal } from '../guide/components'; import { ManagePayees } from './payees'; diff --git a/packages/loot-design/src/components/sidebar.js b/packages/loot-design/src/components/sidebar.js index a03f3c7..48fdac0 100644 --- a/packages/loot-design/src/components/sidebar.js +++ b/packages/loot-design/src/components/sidebar.js @@ -4,11 +4,19 @@ import { withRouter } from 'react-router-dom'; import { css } from 'glamor'; -import { pushModal } from 'loot-core/src/client/actions/modals'; import { closeBudget } from 'loot-core/src/client/actions/budgets'; +import { pushModal } from 'loot-core/src/client/actions/modals'; import Platform from 'loot-core/src/client/platform'; import PiggyBank from 'loot-design/src/svg/v1/PiggyBank'; +import { styles, colors } from '../style'; +import Add from '../svg/v1/Add'; +import Cog from '../svg/v1/Cog'; +import DotsHorizontalTriple from '../svg/v1/DotsHorizontalTriple'; +import Reports from '../svg/v1/Reports'; +import Wallet from '../svg/v1/Wallet'; +import ArrowButtonLeft1 from '../svg/v2/ArrowButtonLeft1'; +import CalendarIcon from '../svg/v2/Calendar'; import { View, Block, @@ -19,16 +27,8 @@ import { Menu, Tooltip } from './common'; -import CellValue from './spreadsheet/CellValue'; -import Add from '../svg/v1/Add'; -import CalendarIcon from '../svg/v2/Calendar'; -import { styles, colors } from '../style'; -import Wallet from '../svg/v1/Wallet'; -import Reports from '../svg/v1/Reports'; -import ArrowButtonLeft1 from '../svg/v2/ArrowButtonLeft1'; -import Cog from '../svg/v1/Cog'; -import DotsHorizontalTriple from '../svg/v1/DotsHorizontalTriple'; import { useDraggable, useDroppable, DropHighlight } from './sort.js'; +import CellValue from './spreadsheet/CellValue'; export const SIDEBAR_WIDTH = 240; diff --git a/packages/loot-design/src/components/sidebar.usage.js b/packages/loot-design/src/components/sidebar.usage.js index 242fa25..3a4084e 100644 --- a/packages/loot-design/src/components/sidebar.usage.js +++ b/packages/loot-design/src/components/sidebar.usage.js @@ -1,16 +1,16 @@ import React from 'react'; -import { MemoryRouter as Router } from 'react-router-dom'; import { DndProvider } from 'react-dnd'; import Backend from 'react-dnd-html5-backend'; +import { MemoryRouter as Router } from 'react-router-dom'; import lively from '@jlongster/lively'; -import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; import { generateAccount } from 'loot-core/src/mocks'; +import makeSpreadsheet from 'loot-core/src/mocks/spreadsheet'; -import SpreadsheetContext from './spreadsheet/SpreadsheetContext'; import { Section } from '../guide/components'; import { Sidebar } from './sidebar'; +import SpreadsheetContext from './spreadsheet/SpreadsheetContext'; function withState(state, render) { const Component = lively(render, { getInitialState: () => state }); diff --git a/packages/loot-design/src/components/spreadsheet/CellValue.js b/packages/loot-design/src/components/spreadsheet/CellValue.js index ffd4501..91c0a7e 100644 --- a/packages/loot-design/src/components/spreadsheet/CellValue.js +++ b/packages/loot-design/src/components/spreadsheet/CellValue.js @@ -1,9 +1,9 @@ import React from 'react'; +import { styles } from '../../style'; +import Text from '../Text'; import format from './format'; import SheetValue from './SheetValue'; -import Text from '../Text'; -import { styles } from '../../style'; function CellValue({ binding, type, formatter, style, getStyle, debug }) { return ( diff --git a/packages/loot-design/src/components/table.js b/packages/loot-design/src/components/table.js index 703b2c5..37cf78b 100644 --- a/packages/loot-design/src/components/table.js +++ b/packages/loot-design/src/components/table.js @@ -13,12 +13,12 @@ import AutoSizer from 'react-virtualized-auto-sizer'; import { scope } from '@jlongster/lively'; -import { FixedSizeList } from './FixedSizeList'; import { styles, colors } from '../style'; import DeleteIcon from '../svg/Delete'; -import Checkmark from '../svg/v1/Checkmark'; import ExpandArrow from '../svg/ExpandArrow'; import AnimatedLoading from '../svg/v1/AnimatedLoading'; +import Checkmark from '../svg/v1/Checkmark'; +import { keys } from '../util/keys'; import { View, Text, @@ -28,11 +28,11 @@ import { IntersectionBoundary, Menu } from './common'; -import { KeyHandlers } from './KeyHandlers'; -import SheetValue from './spreadsheet/SheetValue'; import DateSelect from './DateSelect'; +import { FixedSizeList } from './FixedSizeList'; +import { KeyHandlers } from './KeyHandlers'; import format from './spreadsheet/format'; -import { keys } from '../util/keys'; +import SheetValue from './spreadsheet/SheetValue'; import { AvoidRefocusScrollProvider, useProperFocus } from './useProperFocus'; import { useSelectedItems } from './useSelected'; diff --git a/packages/loot-design/src/components/useSelected.js b/packages/loot-design/src/components/useSelected.js index a2b8783..19ff370 100644 --- a/packages/loot-design/src/components/useSelected.js +++ b/packages/loot-design/src/components/useSelected.js @@ -7,8 +7,8 @@ import React, { } from 'react'; import { useSelector } from 'react-redux'; -import * as undo from 'loot-core/src/platform/client/undo'; import { listen } from 'loot-core/src/platform/client/fetch'; +import * as undo from 'loot-core/src/platform/client/undo'; import { hasModifierKey } from '../util/keys'; diff --git a/packages/mobile/src/components/manager/TransitionView.js b/packages/mobile/src/components/manager/TransitionView.js index 368efe2..52c9cdb 100644 --- a/packages/mobile/src/components/manager/TransitionView.js +++ b/packages/mobile/src/components/manager/TransitionView.js @@ -1,5 +1,4 @@ -import * as React from 'react'; -import { useRef, useEffect } from 'react'; +import React, { useRef, useEffect } from 'react'; import { Animated } from 'react-native'; import { useIsFocused } from '@react-navigation/native'; diff --git a/packages/mobile/src/components/modals/GenericSearchableSelect.js b/packages/mobile/src/components/modals/GenericSearchableSelect.js index 4b8b80c..69c7527 100644 --- a/packages/mobile/src/components/modals/GenericSearchableSelect.js +++ b/packages/mobile/src/components/modals/GenericSearchableSelect.js @@ -1,5 +1,4 @@ -import React from 'react'; -import { useState, useRef, useEffect, useMemo } from 'react'; +import React, { useState, useRef, useEffect, useMemo } from 'react'; import { View, Text, FlatList, TextInput, NativeModules } from 'react-native'; import { RectButton } from 'react-native-gesture-handler'; import q from 'loot-core/src/client/query-helpers';