refactor: biome lint part 3

This commit is contained in:
javayhu 2025-04-18 22:12:41 +08:00
parent 27bc59354f
commit 9f58d025d0
4 changed files with 11 additions and 52 deletions

View File

@ -42,7 +42,13 @@
"rules": {
"recommended": true,
"suspicious": {
"noSparseArray": "off"
"noSparseArray": "off",
"noArrayIndexKey": "off",
"noExplicitAny": "off",
"noShadowRestrictedNames": "off"
},
"complexity": {
"noForEach": "off"
},
"style": {
"useTemplate": "off",
@ -50,7 +56,8 @@
"useShorthandArrayType": "off"
},
"a11y": {
"useValidAnchor": "off"
"useValidAnchor": "off",
"noSvgWithoutTitle": "off"
}
},
"ignore": [

View File

@ -12,13 +12,13 @@ import LocaleSwitcher from '../layout/locale-switcher';
import { ModeSwitcher } from '../layout/mode-switcher';
import { ThemeSelector } from '../layout/theme-selector';
interface BreadcrumbItem {
interface DashboardBreadcrumbItem {
label: string;
isCurrentPage?: boolean;
}
interface DashboardHeaderProps {
breadcrumbs: BreadcrumbItem[];
breadcrumbs: DashboardBreadcrumbItem[];
actions?: ReactNode;
}

View File

@ -1,47 +0,0 @@
'use client';
import { Button } from '@/components/ui/button';
import { cn } from '@/lib/utils';
import { CheckIcon, CopyIcon } from 'lucide-react';
import { useTranslations } from 'next-intl';
import React, { useEffect } from 'react';
interface CopyButtonProps extends React.HTMLAttributes<HTMLButtonElement> {
value: string;
}
export function CopyButton({ value, className, ...props }: CopyButtonProps) {
const [hasCopied, setHasCopied] = React.useState(false);
const t = useTranslations('Common');
useEffect(() => {
setTimeout(() => {
setHasCopied(false);
}, 2000);
}, [hasCopied]);
const handleCopyValue = (value: string) => {
navigator.clipboard.writeText(value);
setHasCopied(true);
};
return (
<Button
size="sm"
variant="ghost"
className={cn(
'z-10 size-[30px] border border-white/25 bg-zinc-900 p-1.5 text-primary-foreground hover:text-foreground dark:text-foreground',
className
)}
onClick={() => handleCopyValue(value)}
{...props}
>
<span className="sr-only">{t('copy')}</span>
{hasCopied ? (
<CheckIcon className="size-4" />
) : (
<CopyIcon className="size-4" />
)}
</Button>
);
}

View File

@ -52,7 +52,6 @@ export default function CustomPagination({
/>
</PaginationItem>
{allPages.map((page, index) => (
// biome-ignore lint/suspicious/noArrayIndexKey: <explanation>
<PaginationItem key={`${page}-${index}`}>
{page === '...' ? (
<PaginationEllipsis />