Skip to content

Commit bac0bb4

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c3da200 commit bac0bb4

File tree

6 files changed

+45
-28
lines changed

6 files changed

+45
-28
lines changed

frontend/src/api/validators.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@ const account_budget = object({
152152
});
153153
export type AccountBudget = ValidationT<typeof account_budget>;
154154

155-
const simple_counter_inventory = record(number)
156-
export type SimpleCounterInventory = ValidationT<typeof simple_counter_inventory>
155+
const simple_counter_inventory = record(number);
156+
export type SimpleCounterInventory = ValidationT<
157+
typeof simple_counter_inventory
158+
>;
157159

158160
const account_journal_entry = tuple(
159161
entryValidator,

frontend/src/entries/index.ts

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ export class Posting {
2525
readonly meta: EntryMetadata,
2626
readonly account: string,
2727
readonly amount: string,
28-
readonly flag: string | null
29-
) { }
28+
readonly flag: string | null,
29+
) {}
3030

3131
/** Create a new empty Posting. */
3232
static empty(): Posting {
@@ -53,7 +53,8 @@ export class Posting {
5353

5454
static validator: Validator<Posting> = (json) =>
5555
Posting.raw_validator(json).map(
56-
({ meta, account, amount, flag }) => new Posting(meta, account, amount, flag),
56+
({ meta, account, amount, flag }) =>
57+
new Posting(meta, account, amount, flag),
5758
);
5859
}
5960

@@ -83,7 +84,7 @@ abstract class EntryBase<T extends string> {
8384
readonly entry_hash: string,
8485
readonly sortFlag: string,
8586
readonly sortNarration: string,
86-
) { }
87+
) {}
8788

8889
/** Clone. */
8990
clone(): this {
@@ -159,7 +160,14 @@ export class Balance extends EntryBase<"Balance"> {
159160

160161
/** Create a new empty Balance entry on the date. */
161162
static empty(date: string): Balance {
162-
return new Balance(new EntryMetadata(), date, "", "", RawAmount.empty(), null);
163+
return new Balance(
164+
new EntryMetadata(),
165+
date,
166+
"",
167+
"",
168+
RawAmount.empty(),
169+
null,
170+
);
163171
}
164172

165173
private static raw_validator = object({
@@ -169,7 +177,7 @@ export class Balance extends EntryBase<"Balance"> {
169177
entry_hash: string,
170178
account: string,
171179
amount: RawAmount.validator,
172-
diff_amount: optional(Amount.validator)
180+
diff_amount: optional(Amount.validator),
173181
});
174182

175183
static validator: Validator<Balance> = (json) =>
@@ -442,14 +450,14 @@ export class CustomValue {
442450
constructor(
443451
readonly dtype: string,
444452
readonly value: unknown,
445-
) { }
453+
) {}
446454

447455
toString(): string {
448456
if (this.dtype === "<class 'beancount.core.amount.Amount'>") {
449-
const a = this.value as Amount
450-
return `${a.number.toString()} ${a.currency}`
457+
const a = this.value as Amount;
458+
return `${a.number.toString()} ${a.currency}`;
451459
}
452-
return this.value as string
460+
return this.value as string;
453461
}
454462

455463
private static raw_validator = object({

frontend/src/journal/JournalEntry.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@
6262
return liClasses;
6363
});
6464
65-
const unitRegex = /([\d\.\-]+)\s+(\w+)/;
66-
const costRegex = /\{([\d\.\-]+)\s+(\w+),\s([\w\-]+)\}/;
67-
const priceRegex = /@\s([\d\.\-]+)\s+(\w+)/;
65+
const unitRegex = /([\d.-]+)\s+(\w+)/;
66+
const costRegex = /\{([\d.-]+)\s+(\w+),\s([\w-]+)\}/;
67+
const priceRegex = /@\s([\d.-]+)\s+(\w+)/;
6868
6969
type PostingAmounts = [
7070
[amount: string, currency: string],

frontend/src/journal/JournalTable.svelte

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@
171171
// Wait for update tick so keyboard shortcut not duplicated.
172172
if (mediaQuery.matches) {
173173
$hideHeader = true;
174-
tick().then(() => mobileHeader = true);
174+
tick().then(() => (mobileHeader = true));
175175
} else {
176176
mobileHeader = false;
177-
tick().then(() => $hideHeader = false);
177+
tick().then(() => ($hideHeader = false));
178178
}
179179
};
180180
@@ -274,6 +274,7 @@
274274
<style>
275275
.vlist-outer {
276276
height: 100%;
277+
277278
/* padding: 1.5em; */
278279
contain: strict;
279280
overflow-y: auto;
@@ -293,7 +294,7 @@
293294
}
294295
295296
.head > .container {
296-
padding: 1.5em 1.5em 0 1.5em;
297+
padding: 1.5em 1.5em 0;
297298
margin-bottom: 0.25em;
298299
}
299300
@@ -303,7 +304,7 @@
303304
304305
@media (width <= 767px) {
305306
.head > .container {
306-
padding: 1em 1em 0 1em;
307+
padding: 1em 1em 0;
307308
}
308309
309310
.head .table-head {

frontend/src/sort/index.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class Sorter<T = unknown> {
4545
constructor(
4646
readonly column: SortColumn<T>,
4747
readonly order: SortOrder,
48-
) { }
48+
) {}
4949

5050
/** Get a new sorter by switching to a possibly different column. */
5151
switchColumn(column: SortColumn<T>): Sorter<T> {
@@ -91,7 +91,7 @@ function sort_internal<T, U>(
9191

9292
/** A SortColumn that does no sorting. */
9393
export class UnsortedColumn<T> implements SortColumn<T> {
94-
constructor(readonly name: string) { }
94+
constructor(readonly name: string) {}
9595

9696
sort(data: readonly T[]): readonly T[] {
9797
return data;
@@ -104,8 +104,12 @@ export class NumberColumn<T> implements SortColumn<T> {
104104

105105
constructor(
106106
readonly name: string,
107-
private readonly value: (row: Readonly<T>, index: number, array: readonly T[]) => number,
108-
) { }
107+
private readonly value: (
108+
row: Readonly<T>,
109+
index: number,
110+
array: readonly T[],
111+
) => number,
112+
) {}
109113

110114
sort(data: readonly T[], direction: SortDirection): readonly T[] {
111115
return sort_internal(data, this.value, this.compare, direction);
@@ -126,8 +130,12 @@ export class StringColumn<T> implements SortColumn<T> {
126130

127131
constructor(
128132
readonly name: string,
129-
private readonly value: (row: Readonly<T>, index: number, array: readonly T[]) => string,
130-
) { }
133+
private readonly value: (
134+
row: Readonly<T>,
135+
index: number,
136+
array: readonly T[],
137+
) => string,
138+
) {}
131139

132140
sort(data: readonly T[], direction: 1 | -1): readonly T[] {
133141
return sort_internal(data, this.value, this.compare, direction);

src/fava/json_api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from typing import TYPE_CHECKING
2222

2323
from flask import Blueprint
24-
from flask import get_template_attribute
2524
from flask import jsonify
2625
from flask import request
2726
from flask_babel import gettext
@@ -790,6 +789,5 @@ def get_account_report() -> AccountReportJournal | AccountReportTree:
790789
with_children=g.ledger.fava_options.account_journal_include_children,
791790
)
792791
return AccountReportJournal(
793-
charts,
794-
journal=[[serialise(e[0]), e[1], e[2]] for e in journal]
792+
charts, journal=[[serialise(e[0]), e[1], e[2]] for e in journal]
795793
)

0 commit comments

Comments
 (0)