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,8 +1,8 @@
import { z } from 'zod'
import { ArrayType, Type } from './types'
import type { ArrayItems, Field, LLMNodeType } from './types'
import { draft07Validator, forbidBooleanProperties } from '@/utils/validators'
import type { ValidationError } from 'jsonschema'
import type { ArrayItems, Field, LLMNodeType } from './types'
import { z } from 'zod'
import { draft07Validator, forbidBooleanProperties } from '@/utils/validators'
import { ArrayType, Type } from './types'
export const checkNodeValid = (_payload: LLMNodeType) => {
return true
@ -10,8 +10,10 @@ export const checkNodeValid = (_payload: LLMNodeType) => {
export const getFieldType = (field: Field) => {
const { type, items, enum: enums } = field
if (field.schemaType === 'file') return Type.file
if (enums && enums.length > 0) return Type.enumType
if (field.schemaType === 'file')
return Type.file
if (enums && enums.length > 0)
return Type.enumType
if (type !== Type.array || !items)
return type
@ -29,7 +31,8 @@ export const getHasChildren = (schema: Field) => {
}
export const getTypeOf = (target: any) => {
if (target === null) return 'null'
if (target === null)
return 'null'
if (typeof target !== 'object') {
return typeof target
}
@ -43,12 +46,17 @@ export const getTypeOf = (target: any) => {
export const inferType = (value: any): Type => {
const type = getTypeOf(value)
if (type === 'array') return Type.array
if (type === 'array')
return Type.array
// type boolean will be treated as string
if (type === 'boolean') return Type.string
if (type === 'number') return Type.number
if (type === 'string') return Type.string
if (type === 'object') return Type.object
if (type === 'boolean')
return Type.string
if (type === 'number')
return Type.number
if (type === 'string')
return Type.string
if (type === 'object')
return Type.object
return Type.string
}