chore: fix linting and type safety across the project

This commit is contained in:
2026-03-26 15:51:45 +08:00
parent ec057ef2e5
commit 0d0dc187a5
46 changed files with 2461 additions and 312 deletions

View File

@@ -53,8 +53,6 @@ function BreadcrumbPage({ className, ...props }: React.ComponentProps<"span">) {
return (
<span
data-slot="breadcrumb-page"
role="link"
aria-disabled="true"
aria-current="page"
className={cn("text-foreground font-normal", className)}
{...props}

View File

@@ -46,7 +46,6 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
mantineVariant = "transparent";
mantineColor = "blue"; // Assuming primary maps to blue in Mantine for now
break;
case "default":
default:
mantineVariant = "filled";
mantineColor = "blue"; // Assuming primary maps to blue in Mantine for now

View File

@@ -117,16 +117,16 @@ function Carousel({
canScrollNext,
}}
>
<div
{/* biome-ignore lint/a11y/useAriaPropsSupportedByRole: section with aria-roledescription is standard for carousels. */}
<section
onKeyDownCapture={handleKeyDown}
className={cn("relative", className)}
role="region"
aria-roledescription="carousel"
data-slot="carousel"
{...props}
>
{children}
</div>
</section>{" "}
</CarouselContext.Provider>
);
}
@@ -156,6 +156,7 @@ function CarouselItem({ className, ...props }: React.ComponentProps<"div">) {
const { orientation } = useCarousel();
return (
// biome-ignore lint/a11y/useSemanticElements: role='group' and aria-roledescription='slide' is standard for carousel slides.
<div
role="group"
aria-roledescription="slide"

View File

@@ -80,6 +80,7 @@ const ChartStyle = ({ id, config }: { id: string; config: ChartConfig }) => {
return (
<style
// biome-ignore lint/security/noDangerouslySetInnerHtml: This is a safe use of dangerouslySetInnerHTML for generating dynamic CSS variables for charts.
dangerouslySetInnerHTML={{
__html: Object.entries(THEMES)
.map(
@@ -125,6 +126,11 @@ function ChartTooltipContent({
indicator?: "line" | "dot" | "dashed";
nameKey?: string;
labelKey?: string;
// biome-ignore lint/suspicious/noExplicitAny: Recharts payload is complex and better handled as any[] for this wrapper.
payload?: any[];
// biome-ignore lint/suspicious/noExplicitAny: Recharts label can be any type.
label?: any;
active?: boolean;
}) {
const { config } = useChart();
@@ -257,9 +263,11 @@ function ChartLegendContent({
verticalAlign = "bottom",
nameKey,
}: React.ComponentProps<"div"> &
Pick<RechartsPrimitive.LegendProps, "payload" | "verticalAlign"> & {
Pick<RechartsPrimitive.LegendProps, "verticalAlign"> & {
hideIcon?: boolean;
nameKey?: string;
// biome-ignore lint/suspicious/noExplicitAny: Recharts legend payload.
payload?: any[];
}) {
const { config } = useChart();

View File

@@ -68,7 +68,7 @@ function InputOTPSlot({
function InputOTPSeparator({ ...props }: React.ComponentProps<"div">) {
return (
<div data-slot="input-otp-separator" role="separator" {...props}>
<div data-slot="input-otp-separator" {...props}>
<MinusIcon />
</div>
);

View File

@@ -4,7 +4,6 @@ import {
MoreHorizontalIcon,
} from "lucide-react";
import type * as React from "react";
import { Button } from "./button";
import { cn } from "./utils";
const baseClasses =
@@ -13,7 +12,6 @@ const baseClasses =
function Pagination({ className, ...props }: React.ComponentProps<"nav">) {
return (
<nav
role="navigation"
aria-label="pagination"
data-slot="pagination"
className={cn("mx-auto flex w-full justify-center", className)}

View File

@@ -2,7 +2,6 @@ import {
Progress as MantineProgress,
type ProgressProps as MantineProgressProps,
} from "@mantine/core";
import React from "react";
import { cn } from "./utils";
// Original ProgressProps likely had 'value' and 'max'.

View File

@@ -77,6 +77,7 @@ function SidebarProvider({
}
// This sets the cookie to keep the sidebar state.
// biome-ignore lint/suspicious/noDocumentCookie: This is a safe use of document.cookie for persisting sidebar state across page loads.
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
},
[setOpenProp, open],
@@ -85,7 +86,7 @@ function SidebarProvider({
// Helper to toggle the sidebar.
const toggleSidebar = React.useCallback(() => {
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
}, [isMobile, setOpen, setOpenMobile]);
}, [isMobile, setOpen]);
// Adds a keyboard shortcut to toggle the sidebar.
React.useEffect(() => {
@@ -117,7 +118,7 @@ function SidebarProvider({
setOpenMobile,
toggleSidebar,
}),
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
[state, open, setOpen, isMobile, openMobile, toggleSidebar],
);
return (

View File

@@ -52,6 +52,7 @@ function Slider({
{Array.from({ length: _values.length }, (_, index) => (
<SliderPrimitive.Thumb
data-slot="slider-thumb"
// biome-ignore lint/suspicious/noArrayIndexKey: slider thumbs are stable and index is an appropriate key here.
key={index}
className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
/>

View File

@@ -1,14 +1,18 @@
"use client";
import { useTheme } from "next-themes";
import { useMantineColorScheme } from "@mantine/core";
import { Toaster as Sonner, type ToasterProps } from "sonner";
const Toaster = ({ ...props }: ToasterProps) => {
const { theme = "system" } = useTheme();
const { colorScheme } = useMantineColorScheme();
return (
<Sonner
theme={theme as ToasterProps["theme"]}
theme={
colorScheme === "auto"
? "system"
: (colorScheme as ToasterProps["theme"])
}
className="toaster group"
style={
{

View File

@@ -1,7 +1,6 @@
"use client";
import { Tooltip as MantineTooltip, type TooltipProps } from "@mantine/core";
import React from "react";
import { cn } from "./utils";
interface CustomTooltipProps extends TooltipProps {