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

@ -2,9 +2,10 @@
import type { FC } from 'react'
import React, { useCallback } from 'react'
import { useTranslation } from 'react-i18next'
import StatusWithAction from './status-with-action'
import { useAutoDisabledDocuments, useDocumentEnable, useInvalidDisabledDocument } from '@/service/knowledge/use-document'
import Toast from '@/app/components/base/toast'
import { useAutoDisabledDocuments, useDocumentEnable, useInvalidDisabledDocument } from '@/service/knowledge/use-document'
import StatusWithAction from './status-with-action'
type Props = {
datasetId: string
}
@ -28,7 +29,7 @@ const AutoDisabledDocument: FC<Props> = ({
return (
<StatusWithAction
type='info'
type="info"
description={t('dataset.documentsDisabled', { num: documentIds?.length })}
actionText={t('dataset.enable')}
onAction={handleEnableDocuments}

View File

@ -1,12 +1,12 @@
'use client'
import type { FC } from 'react'
import React, { useEffect, useReducer } from 'react'
import { useTranslation } from 'react-i18next'
import StatusWithAction from './status-with-action'
import { retryErrorDocs } from '@/service/datasets'
import type { IndexingStatusResponse } from '@/models/datasets'
import { noop } from 'lodash-es'
import React, { useEffect, useReducer } from 'react'
import { useTranslation } from 'react-i18next'
import { retryErrorDocs } from '@/service/datasets'
import { useDatasetErrorDocs } from '@/service/knowledge/use-dataset'
import StatusWithAction from './status-with-action'
type Props = {
datasetId: string
@ -62,7 +62,7 @@ const RetryButton: FC<Props> = ({ datasetId }) => {
return (
<StatusWithAction
type='warning'
type="warning"
description={`${errorDocs?.total} ${t('dataset.docsFailedNotice')}`}
actionText={t('dataset.retry')}
disabled={indexState.value === 'retry'}

View File

@ -1,9 +1,9 @@
'use client'
import { RiAlertFill, RiCheckboxCircleFill, RiErrorWarningFill, RiInformation2Fill } from '@remixicon/react'
import type { FC } from 'react'
import { RiAlertFill, RiCheckboxCircleFill, RiErrorWarningFill, RiInformation2Fill } from '@remixicon/react'
import React from 'react'
import { cn } from '@/utils/classnames'
import Divider from '@/app/components/base/divider'
import { cn } from '@/utils/classnames'
type Status = 'success' | 'error' | 'warning' | 'info'
type Props = {
@ -46,20 +46,21 @@ const StatusAction: FC<Props> = ({
}) => {
const { Icon, color } = getIcon(type)
return (
<div className='relative flex h-[34px] items-center rounded-lg border border-components-panel-border bg-components-panel-bg-blur pl-2 pr-3 shadow-xs'>
<div className="relative flex h-[34px] items-center rounded-lg border border-components-panel-border bg-components-panel-bg-blur pl-2 pr-3 shadow-xs">
<div className={
`absolute inset-0 rounded-lg opacity-40 ${(type === 'success' && 'bg-[linear-gradient(92deg,rgba(23,178,106,0.25)_0%,rgba(255,255,255,0.00)_100%)]')
|| (type === 'warning' && 'bg-[linear-gradient(92deg,rgba(247,144,9,0.25)_0%,rgba(255,255,255,0.00)_100%)]')
|| (type === 'error' && 'bg-[linear-gradient(92deg,rgba(240,68,56,0.25)_0%,rgba(255,255,255,0.00)_100%)]')
|| (type === 'info' && 'bg-[linear-gradient(92deg,rgba(11,165,236,0.25)_0%,rgba(255,255,255,0.00)_100%)]')
}`}
}`
}
/>
<div className='relative z-10 flex h-full items-center space-x-2'>
<div className="relative z-10 flex h-full items-center space-x-2">
<Icon className={cn('h-4 w-4', color)} />
<div className='text-[13px] font-normal text-text-secondary'>{description}</div>
<div className="text-[13px] font-normal text-text-secondary">{description}</div>
{onAction && (
<>
<Divider type='vertical' className='!h-4' />
<Divider type="vertical" className="!h-4" />
<div onClick={onAction} className={cn('cursor-pointer text-[13px] font-semibold text-text-accent', disabled && 'cursor-not-allowed text-text-disabled')}>{actionText}</div>
</>
)}