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

@ -14,7 +14,7 @@ vi.mock('next/navigation', () => ({
// Mock next/link to capture href
vi.mock('next/link', () => ({
default: ({ children, href, replace }: { children: React.ReactNode; href: string; replace?: boolean }) => (
default: ({ children, href, replace }: { children: React.ReactNode, href: string, replace?: boolean }) => (
<a href={href} data-replace={replace}>
{children}
</a>

View File

@ -1,9 +1,9 @@
import React, { useMemo } from 'react'
import Button from '@/app/components/base/button'
import { useTranslation } from 'react-i18next'
import { useParams } from 'next/navigation'
import { RiArrowRightLine } from '@remixicon/react'
import Link from 'next/link'
import { useParams } from 'next/navigation'
import React, { useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import Button from '@/app/components/base/button'
import Checkbox from '@/app/components/base/checkbox'
type ActionsProps = {
@ -29,58 +29,62 @@ const Actions = ({
const { datasetId } = useParams()
const indeterminate = useMemo(() => {
if (!showSelect) return false
if (selectedOptions === undefined || totalOptions === undefined) return false
if (!showSelect)
return false
if (selectedOptions === undefined || totalOptions === undefined)
return false
return selectedOptions > 0 && selectedOptions < totalOptions
}, [showSelect, selectedOptions, totalOptions])
const checked = useMemo(() => {
if (!showSelect) return false
if (selectedOptions === undefined || totalOptions === undefined) return false
if (!showSelect)
return false
if (selectedOptions === undefined || totalOptions === undefined)
return false
return selectedOptions > 0 && selectedOptions === totalOptions
}, [showSelect, selectedOptions, totalOptions])
return (
<div className='flex items-center gap-x-2 overflow-hidden'>
<div className="flex items-center gap-x-2 overflow-hidden">
{showSelect && (
<>
<div className='flex shrink-0 items-center gap-x-2 py-[3px] pl-4 pr-2'>
<div className="flex shrink-0 items-center gap-x-2 py-[3px] pl-4 pr-2">
<Checkbox
onCheck={onSelectAll}
indeterminate={indeterminate}
checked={checked}
/>
<span className='system-sm-medium text-text-accent'>
<span className="system-sm-medium text-text-accent">
{t('common.operation.selectAll')}
</span>
</div>
{tip && (
<div title={tip} className='system-xs-regular max-w-full truncate text-text-tertiary'>
<div title={tip} className="system-xs-regular max-w-full truncate text-text-tertiary">
{tip}
</div>
)}
</>
)}
<div className='flex grow items-center justify-end gap-x-2'>
<div className="flex grow items-center justify-end gap-x-2">
<Link
href={`/datasets/${datasetId}/documents`}
replace
>
<Button
variant='ghost'
className='px-3 py-2'
variant="ghost"
className="px-3 py-2"
>
{t('common.operation.cancel')}
</Button>
</Link>
<Button
disabled={disabled}
variant='primary'
variant="primary"
onClick={handleNextStep}
className='gap-x-0.5'
className="gap-x-0.5"
>
<span className='px-0.5'>{t('datasetCreation.stepOne.button')}</span>
<RiArrowRightLine className='size-4' />
<span className="px-0.5">{t('datasetCreation.stepOne.button')}</span>
<RiArrowRightLine className="size-4" />
</Button>
</div>
</div>