Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
20fb67a
chore(deps): move to @uxfront/oxlint-config 0.2.0, with its failing r…
alexgrozav Nov 24, 2026
f5b842f
chore: keep the html charset as utf-8 under unicorn/text-encoding-ide…
alexgrozav Nov 24, 2026
57c85de
chore: group long numbers under unicorn/numeric-separators-style
alexgrozav Nov 24, 2026
2b87cc8
chore: write escaped backslashes with String.raw under unicorn/prefer…
alexgrozav Nov 24, 2026
c7cba05
chore: look names up in sets under unicorn/prefer-set-has
alexgrozav Nov 24, 2026
6dc1569
chore: compare the star count strictly under eqeqeq
alexgrozav Nov 24, 2026
da9a862
chore: say why the badge path keeps a malformed escape under no-empty
alexgrozav Nov 24, 2026
21015ca
chore: keep the cause of a checklist error under preserve-caught-error
alexgrozav Nov 24, 2026
93c90a9
chore: import session replay's functions by name under import/no-name…
alexgrozav Nov 24, 2026
c5055ca
chore: type amplitude's init options under quality/no-object-parameters
alexgrozav Nov 24, 2026
55ff52b
chore: add optional reply fields in their own statements under qualit…
alexgrozav Nov 24, 2026
c2203de
chore: drop chained type assertions in tests under quality/no-chained…
alexgrozav Nov 24, 2026
c7a326e
chore: keep instanceof to the reference implementations under @nkzw/n…
alexgrozav Nov 24, 2026
abd8645
chore: resolve timers without returning from the executor under no-pr…
alexgrozav Nov 24, 2026
ea9dcca
chore: filter and map in one pass with iterator helpers under quality…
alexgrozav Nov 24, 2026
c467d73
chore: call Number.parseFloat under unicorn/prefer-number-properties
alexgrozav Nov 24, 2026
50c3323
chore: import types in their own statements under import/consistent-t…
alexgrozav Nov 24, 2026
547152f
chore: call replaceAll for global replacements under unicorn/prefer-s…
alexgrozav Nov 24, 2026
f64abd2
chore: write array types as Array<T> under @typescript-eslint/array-type
alexgrozav Nov 24, 2026
c0e267f
chore: brace every if and loop body under curly
alexgrozav Nov 24, 2026
4c1ba9d
chore: keep console to the reference warnings and the scripts under n…
alexgrozav Nov 24, 2026
9daff98
chore: give dictionaries concrete value types under quality/no-unsafe…
alexgrozav Nov 24, 2026
fa89910
chore: keep known types with maps and named result types under qualit…
alexgrozav Nov 24, 2026
342fde1
chore: move helpers that close over nothing to module scope under uni…
alexgrozav Nov 24, 2026
9ec0e92
chore: keep unknown returns to slots and broken contracts under quali…
alexgrozav Nov 24, 2026
7a66db5
chore: drop non-null assertions under typescript/no-non-null-assertion
alexgrozav Nov 24, 2026
8d0bcde
chore: put each lint exception's reason right above it
alexgrozav Nov 24, 2026
90e7d18
chore: define check-mcp's named() before the checks run
alexgrozav Nov 24, 2026
12b8611
fix: give the popover's trigger focus back when it unmounts while open
alexgrozav Nov 24, 2026
9ef8f7c
test: cover the combobox's trailing separator and its defaults, and s…
alexgrozav Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions app/components/app/AppHeaderBody.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
import type { ContentNavigationItem } from "@nuxt/content";
import { getFirstPagePath } from "docus/app/composables/useSubNavigation";

const navigation = inject<Ref<ContentNavigationItem[]>>("navigation");
const navigation = inject<Ref<Array<ContentNavigationItem>>>("navigation");
const { subNavigationMode } = useSubNavigation();
const items = computed<ContentNavigationItem[]>(() => {
const items = computed<Array<ContentNavigationItem>>(() => {
const nav = navigation?.value || [];
if (!subNavigationMode.value) return nav;
if (!subNavigationMode.value) {
return nav;
}
return nav.map(({ children, ...item }) => ({
...item,
path: children?.length ? getFirstPagePath({ ...item, children }) : item.path,
Expand Down
22 changes: 16 additions & 6 deletions app/components/content/InklineExample.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
import { computed, onBeforeUnmount, onMounted, ref, watch } from "vue";
import {
INKLINE_PREVIEW_ORIGIN,
type EmbedTheme,
embedTheme,
inklineEmbedUrl,
inklineTarget,
readResizeMessage,
themeMessage,
themeOnReady,
} from "~/lib/inkline-embed";
import type { EmbedTheme } from "~/lib/inkline-embed";
import { FRAMEWORKS } from "~/data/frameworks";

/**
Expand Down Expand Up @@ -75,7 +75,9 @@ function post(value: EmbedTheme) {
watch(
[target, mounted],
() => {
if (!mounted.value) return;
if (!mounted.value) {
return;
}
urlTheme.value = theme.value;
ready.value = false;
src.value = inklineEmbedUrl({
Expand All @@ -89,18 +91,26 @@ watch(
);

watch(theme, (value) => {
if (ready.value) post(value);
if (ready.value) {
post(value);
}
});

function onMessage(event: MessageEvent) {
const height = readResizeMessage(event, frame.value?.contentWindow);
if (height === undefined) return;
if (height === undefined) {
return;
}
reported.value = height;
if (ready.value) return;
if (ready.value) {
return;
}
ready.value = true;
// A lazy frame that loaded after the mode changed missed the message.
const missed = themeOnReady(urlTheme.value, theme.value);
if (missed) post(missed);
if (missed) {
post(missed);
}
}

onMounted(() => {
Expand Down
18 changes: 10 additions & 8 deletions app/components/content/card/CardPlayground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,27 @@ const { current } = useFramework();
const framework = computed(() => current.value?.value ?? "react");

// Highlighted the way the page's own examples for each framework are.
const LANGUAGES: Record<string, string> = {
const LANGUAGES = new Map<string, string>(Object.entries({
react: "tsx",
vue: "vue",
svelte: "svelte",
angular: "angular-html",
solid: "tsx",
astro: "astro",
vanilla: "html",
};
}));

// An element's lines, with one attribute per line once they no longer fit on one.
function element(tag: string, attributes: (string | false | undefined)[], children: string[] = []) {
const attrs = attributes.filter((attribute) => !!attribute) as string[];
function element(tag: string, attributes: Array<string | false | undefined>, children: Array<string> = []) {
const attrs = attributes.filter((attribute) => !!attribute) as Array<string>;
const line = `<${tag}${attrs.map((attribute) => ` ${attribute}`).join("")}`;
const open =
line.length > 88 || attrs.some((attribute) => attribute.includes("\n"))
? [`<${tag}`, ...attrs.flatMap((attribute) => attribute.split("\n").map((part) => ` ${part}`)), children.length ? ">" : "/>"]
: [`${line}${children.length ? ">" : " />"}`];
if (!children.length) return open;
if (!children.length) {
return open;
}
return [...open, ...children.map((child) => ` ${child}`), `</${tag}>`];
}

Expand All @@ -64,15 +66,15 @@ const code = computed(() => {
const jsx = fw === "react" || fw === "solid";
const body = `<p>${BODY}</p>`;
// The Button among the actions, which Angular puts on the native element, and Vanilla writes out.
const button = (attributes: string[] = []) => {
const button = (attributes: Array<string> = []) => {
if (fw === "vanilla") {
return '<button class="button" type="button" data-variant="outline" data-color="neutral" data-size="sm"><span data-slot="label">Save</span></button>';
}
const tag = fw === "angular" ? "button" : "Button";
return `<${tag} ${[...attributes, 'size="sm"', 'variant="outline"'].join(" ")}>Save</${tag}>`;
};

let card: string[];
let card: Array<string>;
if (fw === "vanilla") {
const title = link.value ? `<a data-slot="link" href="${HREF}">${HEADING}</a>` : HEADING;
card = element(as.value, ['class="card"'], [
Expand Down Expand Up @@ -177,7 +179,7 @@ const code = computed(() => {

<ProsePre
:code="code"
:language="LANGUAGES[framework]"
:language="LANGUAGES.get(framework)"
:ui="{ root: 'my-0' }"
class="rounded-none border-0 border-t border-muted"
>{{ code }}</ProsePre>
Expand Down
20 changes: 10 additions & 10 deletions app/components/content/checkbox-group/CheckboxGroupPlayground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const orientation = ref<NonNullable<CheckboxGroupProps["orientation"]>>("vertica
const selectAll = ref(false);
const disabled = ref(false);
const invalid = ref(false);
const picked = ref<string[]>(["news"]);
const picked = ref<Array<string>>(["news"]);

const sizes = ["xs", "sm", "md", "lg", "xl"];
const orientations = ["vertical", "horizontal"];
Expand All @@ -35,19 +35,19 @@ const { current } = useFramework();
const framework = computed(() => current.value?.value ?? "react");

// Highlighted the way the page's own examples for each framework are.
const LANGUAGES: Record<string, string> = {
const LANGUAGES = new Map<string, string>(Object.entries({
react: "tsx",
vue: "vue",
svelte: "svelte",
angular: "angular-html",
solid: "tsx",
astro: "astro",
vanilla: "html",
};
}));

// An element's lines, with one attribute per line once they no longer fit on one.
function element(tag: string, attributes: (string | false | undefined)[], children: string[] = []) {
const attrs = attributes.filter((attribute) => !!attribute) as string[];
function element(tag: string, attributes: Array<string | false | undefined>, children: Array<string> = []) {
const attrs = attributes.filter((attribute) => !!attribute) as Array<string>;
const line = `<${tag}${attrs.map((attribute) => ` ${attribute}`).join("")}`;
const open = line.length > 88 ? [`<${tag}`, ...attrs.map((attribute) => ` ${attribute}`), ">"] : [`${line}>`];
// A short child stays on the line, as in <legend>Which emails would you like?</legend>.
Expand All @@ -58,7 +58,7 @@ function element(tag: string, attributes: (string | false | undefined)[], childr
}

// A Checkbox from the DOM contract, for Vanilla.
function box(attributes: string[], label: string) {
function box(attributes: Array<string>, label: string) {
return element("label", ['class="checkbox"', `data-size="${size.value}"`], [
`<input ${['data-slot="box"', 'type="checkbox"', ...attributes].join(" ")} />`,
'<svg data-slot="indicator" viewBox="0 0 16 16" aria-hidden="true">…</svg>',
Expand Down Expand Up @@ -113,18 +113,18 @@ const code = computed(() => {
}

// The value is bound where the framework holds it, and left to the form where it doesn't.
const binding: Record<string, string[]> = {
const binding = new Map<string, Array<string>>(Object.entries({
react: ["options={emails}", "value={picked}", "onValueChange={setPicked}"],
vue: [':options="emails"', 'v-model:value="picked"'],
svelte: ["options={emails}", "bind:value={picked}"],
angular: ['[options]="emails"', '[(value)]="picked"'],
solid: ["options={emails}", "value={picked()}", "onValueChange={setPicked}"],
astro: ["options={emails}", `value={${JSON.stringify(picked.value)}}`],
};
}));
const attributes = [
fw === "angular" && "appCheckboxGroup",
'name="emails"',
...binding[fw]!,
...(binding.get(fw) ?? []),
size.value !== "md" && `size="${size.value}"`,
orientation.value !== "vertical" && `orientation="${orientation.value}"`,
selectAll.value && `${fw === "vue" ? "select-all" : "selectAll"}="${allLabel}"`,
Expand Down Expand Up @@ -175,7 +175,7 @@ const code = computed(() => {

<ProsePre
:code="code"
:language="LANGUAGES[framework]"
:language="LANGUAGES.get(framework)"
:ui="{ root: 'my-0' }"
class="rounded-none border-0 border-t border-muted"
>{{ code }}</ProsePre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import CheckboxGroup from "~/reference/checkbox-group/CheckboxGroup.vue";
import type { CheckboxGroupProps } from "~/reference/checkbox-group/CheckboxGroup.vue";

/** `::checkbox-group-sizes-example`: a group at each size. */
const sizes = ["xs", "sm", "md", "lg", "xl"] as const satisfies CheckboxGroupProps["size"][];
const sizes = ["xs", "sm", "md", "lg", "xl"] as const satisfies Array<CheckboxGroupProps["size"]>;
const emails = [
{ value: "news", label: "Product news" },
{ value: "tips", label: "Tips and guides" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ const emails = [
{ value: "tips", label: "Tips and guides" },
{ value: "events", label: "Events near you" },
];
const picked = ref<string[]>([]);
const picked = ref<Array<string>>([]);
const error = ref("");
const status = ref("");
const group = useTemplateRef("group");

function update(value: string[]) {
function update(value: Array<string>) {
picked.value = value;
// Picking one fixes the error, so it clears right away.
if (value.length) error.value = "";
if (value.length) {
error.value = "";
}
}

async function signUp() {
Expand Down
26 changes: 14 additions & 12 deletions app/components/content/checkbox/CheckboxPlayground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,28 @@ const { current } = useFramework();
const framework = computed(() => current.value?.value ?? "react");

// Highlighted the way the page's own examples for each framework are.
const LANGUAGES: Record<string, string> = {
const LANGUAGES = new Map<string, string>(Object.entries({
react: "tsx",
vue: "vue",
svelte: "svelte",
angular: "angular-html",
solid: "tsx",
astro: "astro",
vanilla: "html",
};
}));

// An element's lines, with one attribute per line once they no longer fit on one.
function element(tag: string, attributes: (string | false | undefined)[], children: string[] = []) {
const attrs = attributes.filter((attribute) => !!attribute) as string[];
function element(tag: string, attributes: Array<string | false | undefined>, children: Array<string> = []) {
const attrs = attributes.filter((attribute) => !!attribute) as Array<string>;
const line = `<${tag}${attrs.map((attribute) => ` ${attribute}`).join("")}`;
const close = children.length ? ">" : "/>";
const open =
line.length > 88
? [`<${tag}`, ...attrs.map((attribute) => ` ${attribute}`), close]
: [`${line}${children.length ? ">" : " />"}`];
if (!children.length) return open;
if (!children.length) {
return open;
}
// A short child stays on the line, as in <Checkbox>I agree to the terms</Checkbox>.
if (open.length === 1 && children.length === 1 && `${open[0]}${children[0]}</${tag}>`.length <= 88) {
return [`${open[0]}${children[0]}</${tag}>`];
Expand All @@ -65,23 +67,23 @@ const code = computed(() => {
const scripted = fw === "astro" || fw === "vanilla";

// The checked state is bound where the framework holds it, and left to the form where it doesn't.
const binding: Record<string, string[]> = {
const binding = new Map<string, Array<string>>(Object.entries({
react: ["checked={checked}", "onChange={(event) => setChecked(event.target.checked)}"],
vue: ['v-model:checked="checked"'],
svelte: ["bind:checked"],
angular: ['[(ngModel)]="checked"'],
solid: ["checked={checked()}", "onChange={(event) => setChecked(event.currentTarget.checked)}"],
astro: ['name="terms"', checked.value && "checked"].filter((attribute) => !!attribute) as string[],
vanilla: ['name="terms"', checked.value && "checked"].filter((attribute) => !!attribute) as string[],
};
astro: ['name="terms"', checked.value && "checked"].filter((attribute) => !!attribute) as Array<string>,
vanilla: ['name="terms"', checked.value && "checked"].filter((attribute) => !!attribute) as Array<string>,
}));
// Angular binds the property on the <input>, and Astro and Vanilla set it from a script.
const mixed = indeterminate.value && !scripted && (fw === "angular" ? '[indeterminate]="true"' : "indeterminate");
const attributes = [
fw === "vanilla" && 'data-slot="box"',
fw === "vanilla" && 'type="checkbox"',
fw === "angular" && 'type="checkbox"',
scripted && indeterminate.value && 'id="terms"',
...binding[fw]!,
...(binding.get(fw) ?? []),
fw !== "vanilla" && fw !== "angular" && size.value !== "md" && `size="${size.value}"`,
mixed,
disabled.value && "disabled",
Expand All @@ -93,7 +95,7 @@ const code = computed(() => {
invalid.value && 'aria-describedby="terms-error"',
];

let checkbox: string[];
let checkbox: Array<string>;
if (fw === "angular" || fw === "vanilla") {
// The <label> is the root, with the <input> written out inside it.
const indicator = '<svg data-slot="indicator" viewBox="0 0 16 16" aria-hidden="true">…</svg>';
Expand Down Expand Up @@ -160,7 +162,7 @@ const code = computed(() => {

<ProsePre
:code="code"
:language="LANGUAGES[framework]"
:language="LANGUAGES.get(framework)"
:ui="{ root: 'my-0' }"
class="rounded-none border-0 border-t border-muted"
>{{ code }}</ProsePre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Checkbox from "~/reference/checkbox/Checkbox.vue";
import type { CheckboxProps } from "~/reference/checkbox/Checkbox.vue";

/** `::checkbox-sizes-example`: a checkbox at each size. */
const sizes = ["xs", "sm", "md", "lg", "xl"] as const satisfies CheckboxProps["size"][];
const sizes = ["xs", "sm", "md", "lg", "xl"] as const satisfies Array<CheckboxProps["size"]>;
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ const terms = useTemplateRef("terms");
function update(value: boolean) {
agreed.value = value;
// Checking the box fixes the error, so it clears right away.
if (value) error.value = "";
if (value) {
error.value = "";
}
}

async function createAccount() {
Expand Down
8 changes: 4 additions & 4 deletions app/components/content/combobox/ComboboxPlayground.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ const creatable = ref(false);
const disabled = ref(false);
const readonly = ref(false);

const sizes: Size[] = ["xs", "sm", "md", "lg", "xl"];
const sizes: Array<Size> = ["xs", "sm", "md", "lg", "xl"];

const { current } = useFramework();
const framework = computed(() => current.value?.value ?? "react");

// Highlighted the way the page's own examples for each framework are.
const LANGUAGES: Record<string, string> = {
const LANGUAGES = new Map<string, string>(Object.entries({
react: "tsx",
vue: "vue",
svelte: "svelte",
angular: "angular-html",
solid: "tsx",
astro: "astro",
vanilla: "html",
};
}));

// The Combobox with only the props that differ from the defaults, the way you'd write them
// in each framework, or for Vanilla, the first lines of its DOM contract.
Expand Down Expand Up @@ -107,7 +107,7 @@ const code = computed(() => {

<ProsePre
:code="code"
:language="LANGUAGES[framework]"
:language="LANGUAGES.get(framework)"
:ui="{ root: 'my-0' }"
class="rounded-none border-0 border-t border-muted"
>{{ code }}</ProsePre>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import Field from "~/reference/field/Field.vue";
import { labels } from "~/data/select-options";

/** `::combobox-icons-example`: an icon per option, shown in the panel, beside the picked option's label and in each tag. */
const one = ref<string | string[]>("feature");
const several = ref<string | string[]>(["bug", "docs"]);
const one = ref<string | Array<string>>("feature");
const several = ref<string | Array<string>>(["bug", "docs"]);
</script>

<template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Field from "~/reference/field/Field.vue";
import { nations } from "~/data/select-options";

/** `::combobox-multiple-example`: several values, each a tag under the text, with a remove button. */
const value = ref<string | string[]>(["fr", "es"]);
const value = ref<string | Array<string>>(["fr", "es"]);
</script>

<template>
Expand Down
Loading