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:
Marc-André Bombeck committed 2026-06-19 22:20:31 +02:00
1 parent b3fea2ef59
commit 1f4ba5939d
1000 files changed
+12130 -8385

No files matched your search

@@ -28,7 +28,9 @@ import {
*/
function render(node: React.ReactNode) {
return renderToStaticMarkup(<I18nProvider initialLocale="en">{node}</I18nProvider>);
return renderToStaticMarkup(
<I18nProvider initialLocale="en">{node}</I18nProvider>,
);
}
function makeValue(kind: CadenceKind): CadenceValue {
@@ -138,12 +140,12 @@ describe("encodeCadence", () => {
});
it("clamps dayOfMonth to [1, 31]", () => {
expect(
encodeCadence("monthly", { ...baseSub, dayOfMonth: 99 }).rrule,
).toBe("FREQ=MONTHLY;BYMONTHDAY=31");
expect(
encodeCadence("monthly", { ...baseSub, dayOfMonth: 0 }).rrule,
).toBe("FREQ=MONTHLY;BYMONTHDAY=1");
expect(encodeCadence("monthly", { ...baseSub, dayOfMonth: 99 }).rrule).toBe(
"FREQ=MONTHLY;BYMONTHDAY=31",
);
expect(encodeCadence("monthly", { ...baseSub, dayOfMonth: 0 }).rrule).toBe(
"FREQ=MONTHLY;BYMONTHDAY=1",
);
});
it("clamps rollingDays to [1, 365]", () => {
@@ -19,7 +19,9 @@ import {
*/
function render(node: React.ReactNode) {
return renderToStaticMarkup(<I18nProvider initialLocale="en">{node}</I18nProvider>);
return renderToStaticMarkup(
<I18nProvider initialLocale="en">{node}</I18nProvider>,
);
}
const NOOP = () => undefined;
@@ -70,11 +72,7 @@ describe("<CourseWindowRow> — SSR render", () => {
it("renders both date inputs + the no-end Switch", () => {
const start = new Date(Date.UTC(2026, 4, 28));
const html = render(
<CourseWindowRow
startsOn={start}
endsOn={null}
onChange={NOOP}
/>,
<CourseWindowRow startsOn={start} endsOn={null} onChange={NOOP} />,
);
expect(html).toContain('data-slot="course-window-row"');
expect(html).toContain('data-slot="course-window-starts"');
@@ -86,11 +84,7 @@ describe("<CourseWindowRow> — SSR render", () => {
it("disables the endsOn input when no-end-date is on (endsOn=null)", () => {
const start = new Date(Date.UTC(2026, 4, 28));
const html = render(
<CourseWindowRow
startsOn={start}
endsOn={null}
onChange={NOOP}
/>,
<CourseWindowRow startsOn={start} endsOn={null} onChange={NOOP} />,
);
expect(html).toMatch(/data-slot="course-window-ends"[^>]*disabled/);
});
@@ -117,11 +111,7 @@ describe("<CourseWindowRow> — SSR render", () => {
const start = new Date(Date.UTC(2026, 4, 28));
const end = new Date(Date.UTC(2026, 4, 1));
const html = render(
<CourseWindowRow
startsOn={start}
endsOn={end}
onChange={NOOP}
/>,
<CourseWindowRow startsOn={start} endsOn={end} onChange={NOOP} />,
);
expect(html).toContain('data-slot="course-window-error"');
expect(html).toMatch(/aria-invalid="true"/);
@@ -21,7 +21,9 @@ import {
*/
function render(node: React.ReactNode) {
return renderToStaticMarkup(<I18nProvider initialLocale="en">{node}</I18nProvider>);
return renderToStaticMarkup(
<I18nProvider initialLocale="en">{node}</I18nProvider>,
);
}
const NOOP = () => undefined;
@@ -60,10 +62,7 @@ describe("addTime", () => {
});
it("refuses to add beyond maxChips", () => {
expect(addTime(["08:00", "12:00"], "18:00", 2)).toEqual([
"08:00",
"12:00",
]);
expect(addTime(["08:00", "12:00"], "18:00", 2)).toEqual(["08:00", "12:00"]);
});
});
@@ -116,9 +115,7 @@ describe("<TimesOfDayChips> — SSR render", () => {
});
it("marks a preset chip active when its time is in value", () => {
const html = render(
<TimesOfDayChips value={["08:00"]} onChange={NOOP} />,
);
const html = render(<TimesOfDayChips value={["08:00"]} onChange={NOOP} />);
expect(html).toMatch(/data-preset="morning"[^>]*data-active="true"/);
expect(html).toMatch(/data-preset="evening"[^>]*data-active="false"/);
});
@@ -156,9 +153,7 @@ describe("<TimesOfDayChips> — SSR render", () => {
});
it("renders the preset row by default (showPresets defaults true)", () => {
const html = render(
<TimesOfDayChips value={["08:00"]} onChange={NOOP} />,
);
const html = render(<TimesOfDayChips value={["08:00"]} onChange={NOOP} />);
expect(html).toContain('data-slot="times-of-day-presets"');
});
});
@@ -196,7 +196,9 @@ function clamp(n: number, min: number, max: number): number {
return Math.max(min, Math.min(max, Math.trunc(n)));
}
function parseIsoDate(s: string): { year: number; month: number; day: number } | null {
function parseIsoDate(
s: string,
): { year: number; month: number; day: number } | null {
if (!/^\d{4}-\d{2}-\d{2}$/.test(s)) return null;
const [y, m, d] = s.split("-").map(Number);
if (!y || !m || !d) return null;
@@ -322,7 +324,7 @@ function CadenceOption({
checked={selected}
disabled={disabled}
onChange={onPick}
className="text-primary focus-visible:ring-ring h-4 w-4 cursor-pointer focus-visible:outline-none focus-visible:ring-2"
className="text-primary focus-visible:ring-ring h-4 w-4 cursor-pointer focus-visible:ring-2 focus-visible:outline-none"
data-slot="cadence-option-radio"
/>
<span className="text-sm font-medium">{label}</span>
@@ -483,7 +485,7 @@ function WeekdayChips({
data-active={isOn ? "true" : "false"}
onClick={() => toggle(tok)}
className={[
"focus-visible:ring-ring inline-flex h-11 min-w-11 items-center justify-center rounded-md border px-2 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 disabled:opacity-50",
"focus-visible:ring-ring inline-flex h-11 min-w-11 items-center justify-center rounded-md border px-2 text-xs font-medium transition-colors focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",
isOn
? "bg-primary text-primary-foreground border-primary"
: "border-border bg-background text-foreground hover:bg-muted",
@@ -587,7 +589,13 @@ interface YearlyDateProps {
t: (key: string) => string;
}
function YearlyDate({ value, disabled, i18nPrefix, onChange, t }: YearlyDateProps) {
function YearlyDate({
value,
disabled,
i18nPrefix,
onChange,
t,
}: YearlyDateProps) {
const id = useId();
return (
<div className="flex items-center gap-2">
@@ -65,7 +65,10 @@ export function isValidHhmm(value: string): boolean {
* default range — the whole-day on-time tolerance is the engine's
* concern; the editor only ever stores a wall-clock HH:mm range.
*/
export function defaultBandForTime(time: string): { start: string; end: string } {
export function defaultBandForTime(time: string): {
start: string;
end: string;
} {
if (!isValidHhmm(time)) return { start: time, end: time };
const half = DOSE_WINDOW_DEFAULTS.dailyOnTimeMinutes;
const centre = hhmmToMinutes(time);
@@ -90,9 +90,10 @@ export function weekdayIndexesToTokens(indexes: number[]): WeekdayToken[] {
* own sub-control is empty). The fallback branch covers pathological
* inputs (negative intervalWeeks, NaN, etc.) without throwing.
*/
export function inferCadenceFromLegacy(
schedule: LegacyScheduleSnapshot,
): { value: CadenceValue; subControls: CadenceSubControls } {
export function inferCadenceFromLegacy(schedule: LegacyScheduleSnapshot): {
value: CadenceValue;
subControls: CadenceSubControls;
} {
const tokens = weekdayIndexesToTokens(schedule.daysOfWeek ?? []);
const interval = Number.isFinite(schedule.intervalWeeks)
? Math.trunc(schedule.intervalWeeks)
@@ -161,10 +161,7 @@ export function NaturalLanguageExtractor({
const body = (await res.json().catch(() => null)) as {
error?: string;
} | null;
if (
body?.error &&
/budget/i.test(body.error)
) {
if (body?.error && /budget/i.test(body.error)) {
setError({ kind: "budget" });
return;
}
@@ -247,9 +244,11 @@ export function NaturalLanguageExtractor({
maxLength={MAX_TEXT_LENGTH + 200}
disabled={busy}
aria-invalid={overLimit || error?.kind === "empty" || undefined}
aria-describedby={errorMessage ? `${textareaId}-error` : undefined}
aria-describedby={
errorMessage ? `${textareaId}-error` : undefined
}
/>
<div className="mt-1 text-right text-xs text-muted-foreground">
<div className="text-muted-foreground mt-1 text-right text-xs">
{charCount} / {MAX_TEXT_LENGTH}
</div>
</div>
@@ -258,14 +257,14 @@ export function NaturalLanguageExtractor({
<p
id={`${textareaId}-error`}
role="alert"
className="text-sm text-destructive"
className="text-destructive text-sm"
>
{errorMessage}
</p>
) : null}
<fieldset className="flex flex-col gap-2">
<legend className="text-xs font-medium text-muted-foreground">
<legend className="text-muted-foreground text-xs font-medium">
{t("medications.scheduling.naturalLanguage.examples.label")}
</legend>
<div className="flex flex-col gap-2 sm:flex-row sm:flex-wrap">
@@ -341,7 +340,7 @@ function ExampleChip({ label, onPick, disabled }: ExampleChipProps) {
type="button"
onClick={() => onPick(label)}
disabled={disabled}
className="min-h-11 rounded-md border border-input bg-background px-3 py-2 text-left text-sm text-foreground transition-colors hover:bg-accent hover:text-accent-foreground disabled:pointer-events-none disabled:opacity-50 sm:min-h-9"
className="border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground min-h-11 rounded-md border px-3 py-2 text-left text-sm transition-colors disabled:pointer-events-none disabled:opacity-50 sm:min-h-9"
>
{label}
</button>
@@ -205,9 +205,7 @@ export function ScheduleTimesEditor({
<TimesOfDayChips
value={edit.timesOfDay}
onChange={(timesOfDay) => patchSchedule(i, { timesOfDay })}
maxChips={
typeof s.rollingIntervalDays === "number" ? 1 : 8
}
maxChips={typeof s.rollingIntervalDays === "number" ? 1 : 8}
/>
</div>