chore: update eslint and prettier configuration
This commit is contained in:
@@ -11,8 +11,13 @@ export interface TreeItem {
|
||||
children: TreeItem[];
|
||||
}
|
||||
|
||||
export function collectTreeItemIds<TItem extends TreeItem>(item: TItem): number[] {
|
||||
return [item.id, ...item.children.flatMap((child) => collectTreeItemIds(child as TItem))];
|
||||
export function collectTreeItemIds<TItem extends TreeItem>(
|
||||
item: TItem,
|
||||
): number[] {
|
||||
return [
|
||||
item.id,
|
||||
...item.children.flatMap((child) => collectTreeItemIds(child as TItem)),
|
||||
];
|
||||
}
|
||||
|
||||
function TreeCheckbox({
|
||||
@@ -71,7 +76,9 @@ function CheckboxTreeNode<TItem extends TreeItem>({
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setIsExpanded((current) => !current)}
|
||||
aria-label={isExpanded ? `Collapse ${item.label}` : `Expand ${item.label}`}
|
||||
aria-label={
|
||||
isExpanded ? `Collapse ${item.label}` : `Expand ${item.label}`
|
||||
}
|
||||
className="inline-flex size-5 shrink-0 items-center justify-center rounded text-muted-foreground transition hover:bg-muted hover:text-foreground"
|
||||
>
|
||||
<ChevronDown
|
||||
@@ -87,12 +94,16 @@ function CheckboxTreeNode<TItem extends TreeItem>({
|
||||
onChange={(isChecked) => onToggle(item, isChecked)}
|
||||
/>
|
||||
<div className="flex min-w-0 flex-1 items-center gap-2">
|
||||
<span className="truncate text-sm font-medium leading-none">{item.label}</span>
|
||||
<span className="truncate text-sm font-medium leading-none">
|
||||
{item.label}
|
||||
</span>
|
||||
{renderMeta?.(item)}
|
||||
</div>
|
||||
</div>
|
||||
{showDescription && item.description ? (
|
||||
<p className="mt-1.5 pl-11 text-xs text-muted-foreground">{item.description}</p>
|
||||
<p className="mt-1.5 pl-11 text-xs text-muted-foreground">
|
||||
{item.description}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
{hasChildren && isExpanded ? (
|
||||
|
||||
Reference in New Issue
Block a user