style: apply Biome formatting to TypeScript files (#27)

- Fix import sorting
- Standardize code formatting
- Apply consistent TypeScript style
- Update code to match Biome configuration

Part of #27
This commit is contained in:
Peter Wood
2025-05-04 09:55:01 -04:00
parent f2c0373640
commit 58d8ebdfa1
9 changed files with 214 additions and 211 deletions

View File

@@ -1,12 +1,11 @@
import React, { useState, useEffect } from 'react';
import { useStore } from '@nanostores/react';
import type React from 'react';
import { useEffect, useState } from 'react';
import { currentAccountId as currentAccountIdStore, refreshKey } from '../stores/transactionStore';
import type { Account } from '../types';
import { formatCurrency } from '../utils';
import { currentAccountId as currentAccountIdStore, refreshKey } from '../stores/transactionStore';
interface AccountSummaryProps {
// No props needed, data comes from store and fetch
}
type AccountSummaryProps = {};
export default function AccountSummary({}: AccountSummaryProps) {
const currentAccountId = useStore(currentAccountIdStore);

View File

@@ -1,16 +1,17 @@
import React, { useState, useEffect } from 'react';
import { useStore } from '@nanostores/react';
import type { Transaction } from '../types';
import type React from 'react';
import { useEffect, useState } from 'react';
// Import store atoms and actions
import {
currentAccountId as currentAccountIdStore,
transactionToEdit as transactionToEditStore,
cancelEditingTransaction,
currentAccountId as currentAccountIdStore,
transactionSaved,
transactionToEdit as transactionToEditStore,
} from '../stores/transactionStore';
import type { Transaction } from '../types';
// Remove props that now come from the store
interface AddTransactionFormProps {}
type AddTransactionFormProps = {};
export default function AddTransactionForm({}: AddTransactionFormProps) {
// --- Read state from store ---
@@ -87,7 +88,7 @@ export default function AddTransactionForm({}: AddTransactionFormProps) {
if (!amount) {
errors.push('Amount is required');
} else {
const amountNum = parseFloat(amount);
const amountNum = Number.parseFloat(amount);
if (isNaN(amountNum)) {
errors.push('Amount must be a valid number');
} else if (amountNum === 0) {
@@ -134,7 +135,7 @@ export default function AddTransactionForm({}: AddTransactionFormProps) {
accountId: currentAccountId,
date: date, // Send as YYYY-MM-DD string
description: description.trim(),
amount: parseFloat(amount),
amount: Number.parseFloat(amount),
};
const method = editingId ? 'PUT' : 'POST';

View File

@@ -1,15 +1,15 @@
import React, { useState, useEffect } from 'react';
import { useStore } from '@nanostores/react';
import React, { useState, useEffect } from 'react';
import {
currentAccountId as currentAccountIdStore,
refreshKey,
startEditingTransaction,
triggerRefresh,
} from '../stores/transactionStore';
import type { Transaction } from '../types';
import { formatCurrency, formatDate } from '../utils';
import {
startEditingTransaction,
currentAccountId as currentAccountIdStore,
triggerRefresh,
refreshKey,
} from '../stores/transactionStore';
interface TransactionTableProps {}
type TransactionTableProps = {};
export default function TransactionTable({}: TransactionTableProps) {
const currentAccountId = useStore(currentAccountIdStore);
@@ -47,7 +47,7 @@ export default function TransactionTable({}: TransactionTableProps) {
}, [currentAccountId, refreshCounter]);
const sortedTransactions = [...transactions].sort(
(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime()
(a, b) => new Date(b.date).getTime() - new Date(a.date).getTime(),
);
const handleDelete = async (txnId: string) => {
@@ -76,7 +76,7 @@ export default function TransactionTable({}: TransactionTableProps) {
console.log(`Transaction ${txnId} deleted successfully.`);
setTransactions((currentTransactions) =>
currentTransactions.filter((txn) => txn.id !== txnId)
currentTransactions.filter((txn) => txn.id !== txnId),
);
triggerRefresh();