mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 13:22:14 +00:00
style: apply prettier across the tree
One-shot prettier pass so the new format:check gate starts from a clean baseline. Formatting only — no behaviour change. Generator-owned and vendored artifacts stay untouched via .prettierignore.
This commit is contained in:
1 parent
b3fea2ef59
commit
1f4ba5939d
1000 files changed
+12130
-8385
No files matched your search
@@ -10,9 +10,9 @@
|
||||
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
const useQueryMock = vi.fn<(opts: Record<string, unknown>) => { data: undefined }>(
|
||||
() => ({ data: undefined }),
|
||||
);
|
||||
const useQueryMock = vi.fn<
|
||||
(opts: Record<string, unknown>) => { data: undefined }
|
||||
>(() => ({ data: undefined }));
|
||||
|
||||
vi.mock("@tanstack/react-query", () => ({
|
||||
useQuery: (opts: Record<string, unknown>) => useQueryMock(opts),
|
||||
|
||||
@@ -3,10 +3,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
|
||||
import {
|
||||
DEFAULT_ASSISTANT_FLAGS,
|
||||
useFeatureFlags,
|
||||
} from "../use-feature-flags";
|
||||
import { DEFAULT_ASSISTANT_FLAGS, useFeatureFlags } from "../use-feature-flags";
|
||||
|
||||
function Probe() {
|
||||
const flags = useFeatureFlags();
|
||||
@@ -46,22 +43,23 @@ describe("useFeatureFlags", () => {
|
||||
it("returns the resolved matrix when the endpoint responds", async () => {
|
||||
vi.stubGlobal(
|
||||
"fetch",
|
||||
vi.fn(async () =>
|
||||
new Response(
|
||||
JSON.stringify({
|
||||
data: {
|
||||
assistant: {
|
||||
enabled: true,
|
||||
coach: false,
|
||||
briefing: true,
|
||||
insightStatus: false,
|
||||
correlations: true,
|
||||
healthScoreExplainer: false,
|
||||
vi.fn(
|
||||
async () =>
|
||||
new Response(
|
||||
JSON.stringify({
|
||||
data: {
|
||||
assistant: {
|
||||
enabled: true,
|
||||
coach: false,
|
||||
briefing: true,
|
||||
insightStatus: false,
|
||||
correlations: true,
|
||||
healthScoreExplainer: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
}),
|
||||
{ status: 200 },
|
||||
),
|
||||
}),
|
||||
{ status: 200 },
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ describe("nextStatusPollInterval — v1.8.4 poll ceiling", () => {
|
||||
|
||||
it("stops polling once the attempt cap is reached", () => {
|
||||
expect(nextStatusPollInterval(true, STATUS_POLL_MAX_ATTEMPTS)).toBe(false);
|
||||
expect(
|
||||
nextStatusPollInterval(true, STATUS_POLL_MAX_ATTEMPTS + 5),
|
||||
).toBe(false);
|
||||
expect(nextStatusPollInterval(true, STATUS_POLL_MAX_ATTEMPTS + 5)).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("returns a positive interval while it polls", () => {
|
||||
@@ -58,9 +58,9 @@ describe("nextStatusPollInterval — v1.8.4 poll ceiling", () => {
|
||||
});
|
||||
|
||||
it("honours the same attempt cap for revalidating", () => {
|
||||
expect(
|
||||
nextStatusPollInterval(false, STATUS_POLL_MAX_ATTEMPTS, true),
|
||||
).toBe(false);
|
||||
expect(nextStatusPollInterval(false, STATUS_POLL_MAX_ATTEMPTS, true)).toBe(
|
||||
false,
|
||||
);
|
||||
expect(
|
||||
nextStatusPollInterval(false, STATUS_POLL_MAX_ATTEMPTS + 5, true),
|
||||
).toBe(false);
|
||||
|
||||
@@ -49,7 +49,9 @@ describe("rovingRadioNextIndex", () => {
|
||||
it("skips disabled options when stepping", () => {
|
||||
// Middle option disabled: ArrowRight from 0 lands on 2, not 1.
|
||||
const middleDisabled = (i: number) => i === 1;
|
||||
expect(rovingRadioNextIndex("ArrowRight", 0, COUNT, middleDisabled)).toBe(2);
|
||||
expect(rovingRadioNextIndex("ArrowRight", 0, COUNT, middleDisabled)).toBe(
|
||||
2,
|
||||
);
|
||||
expect(rovingRadioNextIndex("ArrowLeft", 2, COUNT, middleDisabled)).toBe(0);
|
||||
});
|
||||
|
||||
@@ -60,8 +62,6 @@ describe("rovingRadioNextIndex", () => {
|
||||
});
|
||||
|
||||
it("returns null when every option is disabled", () => {
|
||||
expect(
|
||||
rovingRadioNextIndex("ArrowRight", 0, COUNT, () => true),
|
||||
).toBeNull();
|
||||
expect(rovingRadioNextIndex("ArrowRight", 0, COUNT, () => true)).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -17,7 +17,11 @@ import { useEffect, useRef, useState } from "react";
|
||||
*/
|
||||
export function useCountUp(
|
||||
target: number,
|
||||
options: { durationMs?: number; enabled?: boolean; startDelayMs?: number } = {},
|
||||
options: {
|
||||
durationMs?: number;
|
||||
enabled?: boolean;
|
||||
startDelayMs?: number;
|
||||
} = {},
|
||||
): number {
|
||||
const { durationMs = 600, enabled = true, startDelayMs = 0 } = options;
|
||||
// Seed at the final value so the reduced-motion / SSR path is already
|
||||
@@ -47,9 +51,7 @@ export function useCountUp(
|
||||
typeof window !== "undefined" &&
|
||||
typeof window.requestAnimationFrame === "function"
|
||||
) {
|
||||
frameRef.current = window.requestAnimationFrame(() =>
|
||||
setValue(target),
|
||||
);
|
||||
frameRef.current = window.requestAnimationFrame(() => setValue(target));
|
||||
return () => {
|
||||
if (frameRef.current != null) {
|
||||
window.cancelAnimationFrame(frameRef.current);
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
"use client";
|
||||
|
||||
import { useAuth } from "@/hooks/use-auth";
|
||||
import { hasMetricData, type InsightMetric } from "@/lib/insights/metric-availability";
|
||||
import {
|
||||
hasMetricData,
|
||||
type InsightMetric,
|
||||
} from "@/lib/insights/metric-availability";
|
||||
import { useAnalyticsQuery } from "@/lib/queries/use-analytics-query";
|
||||
import type { SubPageAnalyticsData } from "@/types/analytics";
|
||||
|
||||
|
||||
@@ -53,9 +53,8 @@ export interface CreateMeasurementReminderBody {
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export type UpdateMeasurementReminderBody = Partial<
|
||||
CreateMeasurementReminderBody
|
||||
>;
|
||||
export type UpdateMeasurementReminderBody =
|
||||
Partial<CreateMeasurementReminderBody>;
|
||||
|
||||
const BASE = "/api/measurement-reminders";
|
||||
|
||||
|
||||
@@ -70,7 +70,9 @@ export function rovingRadioNextIndex(
|
||||
const firstEnabled = firstEnabledIndex(count, enabled);
|
||||
if (firstEnabled === null) return null;
|
||||
const cursor =
|
||||
current >= 0 && current < count && enabled(current) ? current : firstEnabled;
|
||||
current >= 0 && current < count && enabled(current)
|
||||
? current
|
||||
: firstEnabled;
|
||||
|
||||
switch (key) {
|
||||
case "ArrowRight":
|
||||
|
||||
@@ -118,12 +118,10 @@ export interface WorkoutDetailPayload extends WorkoutListEntry {
|
||||
elevationM: number | null;
|
||||
pauseDurationSec: number | null;
|
||||
metadata: unknown;
|
||||
route:
|
||||
| {
|
||||
geometry: unknown;
|
||||
sampleTimestamps: string[] | null;
|
||||
}
|
||||
| null;
|
||||
route: {
|
||||
geometry: unknown;
|
||||
sampleTimestamps: string[] | null;
|
||||
} | null;
|
||||
canonicalId: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user