chore: eslint add sonar (#17989)
This commit is contained in:
parent
8f9cbe1c49
commit
d80f4c7d3b
38 changed files with 157 additions and 180 deletions
|
|
@ -7,7 +7,7 @@ import {
|
|||
} from '@/app/components/base/prompt-editor/constants'
|
||||
import { InputVarType } from '@/app/components/workflow/types'
|
||||
|
||||
const otherAllowedRegex = /^[a-zA-Z0-9_]+$/
|
||||
const otherAllowedRegex = /^\w+$/
|
||||
|
||||
export const getNewVar = (key: string, type: string) => {
|
||||
const { ...rest } = VAR_ITEM_TEMPLATE
|
||||
|
|
@ -56,7 +56,7 @@ export const checkKey = (key: string, canBeEmpty?: boolean) => {
|
|||
return 'tooLong'
|
||||
|
||||
if (otherAllowedRegex.test(key)) {
|
||||
if (/[0-9]/.test(key[0]))
|
||||
if (/\d/.test(key[0]))
|
||||
return 'notStartWithNumber'
|
||||
|
||||
return true
|
||||
|
|
@ -82,7 +82,7 @@ export const checkKeys = (keys: string[], canBeEmpty?: boolean) => {
|
|||
return { isValid, errorKey, errorMessageKey }
|
||||
}
|
||||
|
||||
const varRegex = /\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}/g
|
||||
const varRegex = /\{\{([a-zA-Z_]\w*)\}\}/g
|
||||
export const getVars = (value: string) => {
|
||||
if (!value)
|
||||
return []
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue