chore(web): new lint setup (#30020)

Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
Stephen Zhou
2025-12-23 16:58:55 +08:00
committed by GitHub
parent 9701a2994b
commit f2842da397
3356 changed files with 85046 additions and 81278 deletions

View File

@ -1,9 +1,10 @@
import type { TopBarProps } from './index'
import { render, screen } from '@testing-library/react'
import { TopBar, type TopBarProps } from './index'
import { TopBar } from './index'
// Mock next/link to capture href values
vi.mock('next/link', () => ({
default: ({ children, href, replace, className }: { children: React.ReactNode; href: string; replace?: boolean; className?: string }) => (
default: ({ children, href, replace, className }: { children: React.ReactNode, href: string, replace?: boolean, className?: string }) => (
<a href={href} data-replace={replace} className={className} data-testid="back-link">
{children}
</a>

View File

@ -1,9 +1,11 @@
import { type FC, useMemo } from 'react'
import type { FC } from 'react'
import type { StepperProps } from '../stepper'
import { RiArrowLeftLine } from '@remixicon/react'
import Link from 'next/link'
import { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { Stepper, type StepperProps } from '../stepper'
import { cn } from '@/utils/classnames'
import { Stepper } from '../stepper'
export type TopBarProps = Pick<StepperProps, 'activeIndex'> & {
className?: string
@ -24,24 +26,24 @@ export const TopBar: FC<TopBarProps> = (props) => {
return datasetId ? `/datasets/${datasetId}/documents` : '/datasets'
}, [datasetId])
return <div className={cn('relative flex h-[52px] shrink-0 items-center justify-between border-b border-b-divider-subtle', className)}>
<Link href={fallbackRoute} replace className="inline-flex h-12 items-center justify-start gap-1 py-2 pl-2 pr-6">
<div className='p-2'>
<RiArrowLeftLine className='size-4 text-text-primary' />
return (
<div className={cn('relative flex h-[52px] shrink-0 items-center justify-between border-b border-b-divider-subtle', className)}>
<Link href={fallbackRoute} replace className="inline-flex h-12 items-center justify-start gap-1 py-2 pl-2 pr-6">
<div className="p-2">
<RiArrowLeftLine className="size-4 text-text-primary" />
</div>
<p className="system-sm-semibold-uppercase text-text-primary">
{t('datasetCreation.steps.header.fallbackRoute')}
</p>
</Link>
<div className="absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2">
<Stepper
steps={Array.from({ length: 3 }, (_, i) => ({
name: t(STEP_T_MAP[i + 1]),
}))}
{...rest}
/>
</div>
<p className="system-sm-semibold-uppercase text-text-primary">
{t('datasetCreation.steps.header.fallbackRoute')}
</p>
</Link>
<div className={
'absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2'
}>
<Stepper
steps={Array.from({ length: 3 }, (_, i) => ({
name: t(STEP_T_MAP[i + 1]),
}))}
{...rest}
/>
</div>
</div>
)
}