chore: add Biome for lint and fix all lint errors
- Install @biomejs/biome as devDependency at root - Configure biome.json with 2-space indent, double quotes, Tailwind CSS support - Add lint/lint:fix/format/format:fix scripts to root and app package.json - Fix noNonNullAssertion: env vars extracted to variables with suppression, <div role=button> replaced with <button> - Fix noUnusedVariables: remove unused destructured vars - Fix useIterableCallbackReturn: arrow functions with block body - Fix noExplicitAny: recharts Tooltip formatters - Fix noLabelWithoutControl: add htmlFor+id or use <span> for non-input labels - Fix noStaticElementInteractions/useKeyWithClickEvents: role+keyboard events for overlays - Fix noArrayIndexKey: use error string as key - Fix CSS parse: enable tailwindDirectives parser - Normalize formatting across 80 files with biome check --write
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { useMemo } from "react";
|
||||
import { CalendarClock, ExternalLink } from "lucide-react";
|
||||
import { useNavigate } from "@tanstack/react-router";
|
||||
import { usePendingUpcomingExpenses } from "@/lib/queries";
|
||||
import { CalendarClock, ExternalLink } from "lucide-react";
|
||||
import { useMemo } from "react";
|
||||
import type { PendingUpcomingExpense } from "@/lib/api";
|
||||
import { usePendingUpcomingExpenses } from "@/lib/queries";
|
||||
|
||||
type GroupedExpense = {
|
||||
periodicExpenseId: number;
|
||||
@@ -100,12 +100,15 @@ export function DashboardExpensesTable() {
|
||||
<CalendarClock className="size-4 text-muted-foreground" />
|
||||
<h2 className="text-sm font-medium">Gastos por vencer</h2>
|
||||
{isLoading && (
|
||||
<span className="ml-auto text-xs text-muted-foreground">Cargando...</span>
|
||||
<span className="ml-auto text-xs text-muted-foreground">
|
||||
Cargando...
|
||||
</span>
|
||||
)}
|
||||
{!isLoading && hasData && (
|
||||
<span className="ml-auto text-xs text-muted-foreground tabular-nums">
|
||||
{overdueCount} vencido{overdueCount !== 1 ? "s" : ""}
|
||||
{upcomingCount > 0 && ` · ${upcomingCount} próximo${upcomingCount !== 1 ? "s" : ""}`}
|
||||
{upcomingCount > 0 &&
|
||||
` · ${upcomingCount} próximo${upcomingCount !== 1 ? "s" : ""}`}
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
@@ -163,16 +166,29 @@ export function DashboardExpensesTable() {
|
||||
<table className="w-full text-sm">
|
||||
<thead>
|
||||
<tr className="border-b bg-muted/50">
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">Descripción</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">Monto</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">Vencimiento</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">Cantidad</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">Estado</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">
|
||||
Descripción
|
||||
</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">
|
||||
Monto
|
||||
</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">
|
||||
Vencimiento
|
||||
</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">
|
||||
Cantidad
|
||||
</th>
|
||||
<th className="px-3 py-2 text-left text-xs font-medium text-muted-foreground">
|
||||
Estado
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{groups.map((group) => (
|
||||
<tr key={group.periodicExpenseId} className="border-b last:border-0 hover:bg-muted/30">
|
||||
<tr
|
||||
key={group.periodicExpenseId}
|
||||
className="border-b last:border-0 hover:bg-muted/30"
|
||||
>
|
||||
<td className="px-3 py-2.5">
|
||||
<button
|
||||
type="button"
|
||||
@@ -183,8 +199,12 @@ export function DashboardExpensesTable() {
|
||||
<ExternalLink className="size-3 shrink-0 text-muted-foreground" />
|
||||
</button>
|
||||
</td>
|
||||
<td className="px-3 py-2.5 tabular-nums">{formatAmount(group.totalAmount)}</td>
|
||||
<td className="px-3 py-2.5 text-muted-foreground">{formatDate(group.earliestDueDate)}</td>
|
||||
<td className="px-3 py-2.5 tabular-nums">
|
||||
{formatAmount(group.totalAmount)}
|
||||
</td>
|
||||
<td className="px-3 py-2.5 text-muted-foreground">
|
||||
{formatDate(group.earliestDueDate)}
|
||||
</td>
|
||||
<td className="px-3 py-2.5 text-muted-foreground tabular-nums">
|
||||
{group.count > 1 ? `${group.count} gastos` : "1 gasto"}
|
||||
</td>
|
||||
@@ -196,7 +216,9 @@ export function DashboardExpensesTable() {
|
||||
{hasData && (
|
||||
<tr className="border-t bg-muted/50 font-medium">
|
||||
<td className="px-3 py-2.5">Total</td>
|
||||
<td className="px-3 py-2.5 tabular-nums">{formatAmount(grandTotal)}</td>
|
||||
<td className="px-3 py-2.5 tabular-nums">
|
||||
{formatAmount(grandTotal)}
|
||||
</td>
|
||||
<td colSpan={3} />
|
||||
</tr>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user