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,14 +1,14 @@
import type { AnnotationReplyConfig, ChatPromptConfig, CompletionPromptConfig, DatasetConfigs, PromptMode } from '@/models/debug'
import type { CollectionType } from '@/app/components/tools/types'
import type { LanguagesSupported } from '@/i18n-config/language'
import type { Tag } from '@/app/components/base/tag-management/constant'
import type { CollectionType } from '@/app/components/tools/types'
import type { UploadFileSetting } from '@/app/components/workflow/types'
import type { LanguagesSupported } from '@/i18n-config/language'
import type { AccessMode } from '@/models/access-control'
import type { ExternalDataTool } from '@/models/common'
import type {
RerankingModeEnum,
WeightedScoreEnum,
} from '@/models/datasets'
import type { UploadFileSetting } from '@/app/components/workflow/types'
import type { AccessMode } from '@/models/access-control'
import type { ExternalDataTool } from '@/models/common'
import type { AnnotationReplyConfig, ChatPromptConfig, CompletionPromptConfig, DatasetConfigs, PromptMode } from '@/models/debug'
export enum Theme {
light = 'light',
@@ -274,9 +274,10 @@ export type SiteConfig = {
title: string
/** Application Description will be shown in the Client */
description: string
/** Define the color in hex for different elements of the chatbot, such as:
/**
* Define the color in hex for different elements of the chatbot, such as:
* The header, the button , etc.
*/
*/
chat_color_theme: string
/** Invert the color of the theme set in chat_color_theme */
chat_color_theme_inverted: boolean
@@ -328,12 +329,12 @@ export type App = {
/** Description */
description: string
/** Author Name */
author_name: string;
author_name: string
/**
* Icon Type
* @default 'emoji'
*/
*/
icon_type: AppIconType | null
/** Icon, stores file ID if icon_type is 'image' */
icon: string
@@ -375,7 +376,7 @@ export type App = {
updated_at: number
updated_by?: string
}
deleted_tools?: Array<{ id: string; tool_name: string }>
deleted_tools?: Array<{ id: string, tool_name: string }>
/** access control */
access_mode: AccessMode
max_active_requests?: number | null

View File

@@ -27,9 +27,9 @@ type License = {
export type SystemFeatures = {
plugin_installation_permission: {
plugin_installation_scope: InstallationScope,
plugin_installation_scope: InstallationScope
restrict_to_marketplace_only: boolean
},
}
sso_enforced_for_signin: boolean
sso_enforced_for_signin_protocol: SSOProtocol | ''
sso_enforced_for_web: boolean

80
web/types/i18n.d.ts vendored
View File

@@ -38,45 +38,45 @@ type WorkflowMessages = typeof import('../i18n/en-US/workflow').default
// Complete type structure that matches i18next-config.ts camelCase conversion
export type Messages = {
appAnnotation: AppAnnotationMessages;
appApi: AppApiMessages;
appDebug: AppDebugMessages;
appLog: AppLogMessages;
appOverview: AppOverviewMessages;
app: AppMessages;
billing: BillingMessages;
common: CommonMessages;
custom: CustomMessages;
datasetCreation: DatasetCreationMessages;
datasetDocuments: DatasetDocumentsMessages;
datasetHitTesting: DatasetHitTestingMessages;
datasetPipeline: DatasetPipelineMessages;
datasetSettings: DatasetSettingsMessages;
dataset: DatasetMessages;
education: EducationMessages;
explore: ExploreMessages;
layout: LayoutMessages;
login: LoginMessages;
oauth: OauthMessages;
pipeline: PipelineMessages;
pluginTags: PluginTagsMessages;
pluginTrigger: PluginTriggerMessages;
plugin: PluginMessages;
register: RegisterMessages;
runLog: RunLogMessages;
share: ShareMessages;
time: TimeMessages;
tools: ToolsMessages;
workflow: WorkflowMessages;
appAnnotation: AppAnnotationMessages
appApi: AppApiMessages
appDebug: AppDebugMessages
appLog: AppLogMessages
appOverview: AppOverviewMessages
app: AppMessages
billing: BillingMessages
common: CommonMessages
custom: CustomMessages
datasetCreation: DatasetCreationMessages
datasetDocuments: DatasetDocumentsMessages
datasetHitTesting: DatasetHitTestingMessages
datasetPipeline: DatasetPipelineMessages
datasetSettings: DatasetSettingsMessages
dataset: DatasetMessages
education: EducationMessages
explore: ExploreMessages
layout: LayoutMessages
login: LoginMessages
oauth: OauthMessages
pipeline: PipelineMessages
pluginTags: PluginTagsMessages
pluginTrigger: PluginTriggerMessages
plugin: PluginMessages
register: RegisterMessages
runLog: RunLogMessages
share: ShareMessages
time: TimeMessages
tools: ToolsMessages
workflow: WorkflowMessages
}
// Utility type to flatten nested object keys into dot notation
type FlattenKeys<T> = T extends object
? {
[K in keyof T]: T[K] extends object
? `${K & string}.${FlattenKeys<T[K]> & string}`
: `${K & string}`
}[keyof T]
[K in keyof T]: T[K] extends object
? `${K & string}.${FlattenKeys<T[K]> & string}`
: `${K & string}`
}[keyof T]
: never
export type ValidTranslationKeys = FlattenKeys<Messages>
@@ -84,19 +84,19 @@ export type ValidTranslationKeys = FlattenKeys<Messages>
// Extend react-i18next with Dify's type structure
declare module 'react-i18next' {
type CustomTypeOptions = {
defaultNS: 'translation';
defaultNS: 'translation'
resources: {
translation: Messages;
};
translation: Messages
}
}
}
// Extend i18next for complete type safety
declare module 'i18next' {
type CustomTypeOptions = {
defaultNS: 'translation';
defaultNS: 'translation'
resources: {
translation: Messages;
};
translation: Messages
}
}
}

View File

@@ -1,5 +1,5 @@
declare module 'react-18-input-autosize' {
import type { CSSProperties, ChangeEvent, FocusEvent, KeyboardEvent } from 'react'
import type { ChangeEvent, CSSProperties, FocusEvent, KeyboardEvent } from 'react'
export type AutosizeInputProps = {
value?: string | number

View File

@@ -1,26 +1,26 @@
import type { Viewport } from 'reactflow'
import type { BlockEnum, CommonNodeType, ConversationVariable, Edge, EnvironmentVariable, InputVar, Node, ValueSelector, VarType, Variable } from '@/app/components/workflow/types'
import type { TransferMethod } from '@/types/app'
import type { ErrorHandleTypeEnum } from '@/app/components/workflow/nodes/_base/components/error-handle/types'
import type { RAGPipelineVariables } from '@/models/pipeline'
import type { BeforeRunFormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form'
import type { SpecialResultPanelProps } from '@/app/components/workflow/run/special-result-panel'
import type { RefObject } from 'react'
import type { Viewport } from 'reactflow'
import type { BeforeRunFormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form'
import type { ErrorHandleTypeEnum } from '@/app/components/workflow/nodes/_base/components/error-handle/types'
import type { SpecialResultPanelProps } from '@/app/components/workflow/run/special-result-panel'
import type { BlockEnum, CommonNodeType, ConversationVariable, Edge, EnvironmentVariable, InputVar, Node, ValueSelector, Variable, VarType } from '@/app/components/workflow/types'
import type { RAGPipelineVariables } from '@/models/pipeline'
import type { TransferMethod } from '@/types/app'
export type AgentLogItem = {
node_execution_id: string,
message_id: string,
node_id: string,
parent_id?: string,
label: string,
data: object, // debug data
error?: string,
status: string,
node_execution_id: string
message_id: string
node_id: string
parent_id?: string
label: string
data: object // debug data
error?: string
status: string
metadata?: {
elapsed_time?: number
provider?: string
icon?: string
},
}
}
export type AgentLogItemWithChildren = AgentLogItem & {
@@ -126,7 +126,7 @@ export type FetchWorkflowDraftResponse = {
id: string
name: string
email: string
},
}
tool_published: boolean
environment_variables?: EnvironmentVariable[]
conversation_variables?: ConversationVariable[]
@@ -337,7 +337,7 @@ export type NodesDefaultConfigsResponse = {
}[]
export type ConversationVariableResponse = {
data: (ConversationVariable & { updated_at: number; created_at: number })[]
data: (ConversationVariable & { updated_at: number, created_at: number })[]
has_more: boolean
limit: number
total: number