chore: migrate eslint and prettier to biome and fix all linting errors
This commit is contained in:
parent
82413a8212
commit
9bcf233d2c
22 changed files with 397 additions and 481 deletions
|
@ -94,8 +94,11 @@ const BaseChart: Component<ChartProps> = (rawProps) => {
|
|||
on(
|
||||
() => props.data,
|
||||
() => {
|
||||
chart()!.data = props.data;
|
||||
chart()!.update();
|
||||
const currentChart = chart();
|
||||
if (currentChart) {
|
||||
currentChart.data = props.data;
|
||||
currentChart.update();
|
||||
}
|
||||
},
|
||||
{ defer: true },
|
||||
),
|
||||
|
@ -105,8 +108,11 @@ const BaseChart: Component<ChartProps> = (rawProps) => {
|
|||
on(
|
||||
() => props.options,
|
||||
() => {
|
||||
chart()!.options = props.options;
|
||||
chart()!.update();
|
||||
const currentChart = chart();
|
||||
if (currentChart) {
|
||||
currentChart.options = props.options;
|
||||
currentChart.update();
|
||||
}
|
||||
},
|
||||
{ defer: true },
|
||||
),
|
||||
|
@ -116,7 +122,10 @@ const BaseChart: Component<ChartProps> = (rawProps) => {
|
|||
on(
|
||||
[() => props.width, () => props.height],
|
||||
() => {
|
||||
chart()!.resize(props.width, props.height);
|
||||
const currentChart = chart();
|
||||
if (currentChart) {
|
||||
currentChart.resize(props.width, props.height);
|
||||
}
|
||||
},
|
||||
{ defer: true },
|
||||
),
|
||||
|
@ -126,10 +135,13 @@ const BaseChart: Component<ChartProps> = (rawProps) => {
|
|||
on(
|
||||
() => props.type,
|
||||
() => {
|
||||
const dimensions = [chart()!.width, chart()!.height];
|
||||
chart()!.destroy();
|
||||
init();
|
||||
chart()!.resize(...dimensions);
|
||||
const currentChart = chart();
|
||||
if (currentChart) {
|
||||
const dimensions = [currentChart.width, currentChart.height];
|
||||
currentChart.destroy();
|
||||
init();
|
||||
currentChart.resize(...dimensions);
|
||||
}
|
||||
},
|
||||
{ defer: true },
|
||||
),
|
||||
|
@ -141,13 +153,7 @@ const BaseChart: Component<ChartProps> = (rawProps) => {
|
|||
});
|
||||
|
||||
Chart.register(Colors, Filler, Legend, Tooltip);
|
||||
return (
|
||||
<canvas
|
||||
ref={mergeRefs(props.ref, (el) => setCanvasRef(el))}
|
||||
height={props.height}
|
||||
width={props.width}
|
||||
/>
|
||||
);
|
||||
return <canvas ref={mergeRefs(props.ref, (el) => setCanvasRef(el))} height={props.height} width={props.width} />;
|
||||
};
|
||||
|
||||
function showTooltip(context: ChartContext) {
|
||||
|
@ -245,13 +251,7 @@ function createTypedChart(type: ChartType, components: ChartComponent[]): Compon
|
|||
};
|
||||
|
||||
Chart.register(...components);
|
||||
return (props) => (
|
||||
<BaseChart
|
||||
type={type}
|
||||
options={options}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
return (props) => <BaseChart type={type} options={options} {...props} />;
|
||||
}
|
||||
|
||||
const BarChart = /* #__PURE__ */ createTypedChart("bar", [BarController, BarElement, CategoryScale, LinearScale]);
|
||||
|
|
|
@ -13,10 +13,7 @@ type CheckboxRootProps<T extends ValidComponent = "div"> = CheckboxPrimitive.Che
|
|||
const Checkbox = <T extends ValidComponent = "div">(props: PolymorphicProps<T, CheckboxRootProps<T>>) => {
|
||||
const [local, others] = splitProps(props as CheckboxRootProps, ["class"]);
|
||||
return (
|
||||
<CheckboxPrimitive.Root
|
||||
class={cn("items-top group relative flex space-x-2", local.class)}
|
||||
{...others}
|
||||
>
|
||||
<CheckboxPrimitive.Root class={cn("items-top group relative flex space-x-2", local.class)} {...others}>
|
||||
<CheckboxPrimitive.Input class="peer" />
|
||||
<CheckboxPrimitive.Control class="size-4 shrink-0 rounded-sm border border-primary ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 peer-focus-visible:outline-none peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 data-[checked]:border-none data-[indeterminate]:border-none data-[checked]:bg-primary data-[indeterminate]:bg-primary data-[checked]:text-primary-foreground data-[indeterminate]:text-primary-foreground">
|
||||
<CheckboxPrimitive.Indicator>
|
||||
|
|
|
@ -8,7 +8,7 @@ const Label: Component<ComponentProps<"label">> = (props) => {
|
|||
return (
|
||||
<label
|
||||
class={cn(
|
||||
"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
||||
"font-medium text-sm leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
|
||||
local.class,
|
||||
)}
|
||||
{...others}
|
||||
|
|
|
@ -7,42 +7,24 @@ const Table: Component<ComponentProps<"table">> = (props) => {
|
|||
const [local, others] = splitProps(props, ["class"]);
|
||||
return (
|
||||
<div class="relative w-full overflow-auto">
|
||||
<table
|
||||
class={cn("w-full caption-bottom text-sm", local.class)}
|
||||
{...others}
|
||||
/>
|
||||
<table class={cn("w-full caption-bottom text-sm", local.class)} {...others} />
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const TableHeader: Component<ComponentProps<"thead">> = (props) => {
|
||||
const [local, others] = splitProps(props, ["class"]);
|
||||
return (
|
||||
<thead
|
||||
class={cn("[&_tr]:border-b", local.class)}
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
return <thead class={cn("[&_tr]:border-b", local.class)} {...others} />;
|
||||
};
|
||||
|
||||
const TableBody: Component<ComponentProps<"tbody">> = (props) => {
|
||||
const [local, others] = splitProps(props, ["class"]);
|
||||
return (
|
||||
<tbody
|
||||
class={cn("[&_tr:last-child]:border-0", local.class)}
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
return <tbody class={cn("[&_tr:last-child]:border-0", local.class)} {...others} />;
|
||||
};
|
||||
|
||||
const TableFooter: Component<ComponentProps<"tfoot">> = (props) => {
|
||||
const [local, others] = splitProps(props, ["class"]);
|
||||
return (
|
||||
<tfoot
|
||||
class={cn("bg-primary font-medium text-primary-foreground", local.class)}
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
return <tfoot class={cn("bg-primary font-medium text-primary-foreground", local.class)} {...others} />;
|
||||
};
|
||||
|
||||
const TableRow: Component<ComponentProps<"tr">> = (props) => {
|
||||
|
@ -70,22 +52,12 @@ const TableHead: Component<ComponentProps<"th">> = (props) => {
|
|||
|
||||
const TableCell: Component<ComponentProps<"td">> = (props) => {
|
||||
const [local, others] = splitProps(props, ["class"]);
|
||||
return (
|
||||
<td
|
||||
class={cn("p-2 align-middle [&:has([role=checkbox])]:pr-0", local.class)}
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
return <td class={cn("p-2 align-middle [&:has([role=checkbox])]:pr-0", local.class)} {...others} />;
|
||||
};
|
||||
|
||||
const TableCaption: Component<ComponentProps<"caption">> = (props) => {
|
||||
const [local, others] = splitProps(props, ["class"]);
|
||||
return (
|
||||
<caption
|
||||
class={cn("mt-4 text-sm text-muted-foreground", local.class)}
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
return <caption class={cn("mt-4 text-muted-foreground text-sm", local.class)} {...others} />;
|
||||
};
|
||||
|
||||
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
||||
|
|
|
@ -13,12 +13,7 @@ type TextFieldRootProps<T extends ValidComponent = "div"> = TextFieldPrimitive.T
|
|||
|
||||
const TextField = <T extends ValidComponent = "div">(props: PolymorphicProps<T, TextFieldRootProps<T>>) => {
|
||||
const [local, others] = splitProps(props as TextFieldRootProps, ["class"]);
|
||||
return (
|
||||
<TextFieldPrimitive.Root
|
||||
class={cn("flex flex-col gap-1", local.class)}
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
return <TextFieldPrimitive.Root class={cn("flex flex-col gap-1", local.class)} {...others} />;
|
||||
};
|
||||
|
||||
type TextFieldInputProps<T extends ValidComponent = "input"> = TextFieldPrimitive.TextFieldInputProps<T> & {
|
||||
|
@ -55,7 +50,7 @@ const TextFieldInput = <T extends ValidComponent = "input">(rawProps: Polymorphi
|
|||
<TextFieldPrimitive.Input
|
||||
type={local.type}
|
||||
class={cn(
|
||||
"flex h-10 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[invalid]:border-error-foreground data-[invalid]:text-error-foreground",
|
||||
"flex h-10 w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:font-medium file:text-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[invalid]:border-error-foreground data-[invalid]:text-error-foreground",
|
||||
local.class,
|
||||
)}
|
||||
{...others}
|
||||
|
@ -104,12 +99,7 @@ type TextFieldLabelProps<T extends ValidComponent = "label"> = TextFieldPrimitiv
|
|||
|
||||
const TextFieldLabel = <T extends ValidComponent = "label">(props: PolymorphicProps<T, TextFieldLabelProps<T>>) => {
|
||||
const [local, others] = splitProps(props as TextFieldLabelProps, ["class"]);
|
||||
return (
|
||||
<TextFieldPrimitive.Label
|
||||
class={cn(labelVariants(), local.class)}
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
return <TextFieldPrimitive.Label class={cn(labelVariants(), local.class)} {...others} />;
|
||||
};
|
||||
|
||||
type TextFieldDescriptionProps<T extends ValidComponent = "div"> = TextFieldPrimitive.TextFieldDescriptionProps<T> & {
|
||||
|
@ -121,10 +111,7 @@ const TextFieldDescription = <T extends ValidComponent = "div">(
|
|||
) => {
|
||||
const [local, others] = splitProps(props as TextFieldDescriptionProps, ["class"]);
|
||||
return (
|
||||
<TextFieldPrimitive.Description
|
||||
class={cn(labelVariants({ variant: "description" }), local.class)}
|
||||
{...others}
|
||||
/>
|
||||
<TextFieldPrimitive.Description class={cn(labelVariants({ variant: "description" }), local.class)} {...others} />
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -136,12 +123,7 @@ const TextFieldErrorMessage = <T extends ValidComponent = "div">(
|
|||
props: PolymorphicProps<T, TextFieldErrorMessageProps<T>>,
|
||||
) => {
|
||||
const [local, others] = splitProps(props as TextFieldErrorMessageProps, ["class"]);
|
||||
return (
|
||||
<TextFieldPrimitive.ErrorMessage
|
||||
class={cn(labelVariants({ variant: "error" }), local.class)}
|
||||
{...others}
|
||||
/>
|
||||
);
|
||||
return <TextFieldPrimitive.ErrorMessage class={cn(labelVariants({ variant: "error" }), local.class)} {...others} />;
|
||||
};
|
||||
|
||||
export { TextField, TextFieldDescription, TextFieldErrorMessage, TextFieldInput, TextFieldLabel, TextFieldTextArea };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue