chore: lint dify ui with react config

This commit is contained in:
Stephen Zhou 2026-04-17 22:21:38 +08:00
parent 3c7d6739b5
commit 4dae959c28
No known key found for this signature in database
4 changed files with 51 additions and 10 deletions

View File

@ -1,4 +1,9 @@
{
"e2e/cucumber.config.ts": {
"node/prefer-global/process": {
"count": 1
}
},
"e2e/features/support/hooks.ts": {
"no-console": {
"count": 3
@ -7,16 +12,47 @@
"count": 1
}
},
"e2e/fixtures/auth.ts": {
"node/prefer-global/process": {
"count": 5
}
},
"e2e/scripts/common.ts": {
"node/prefer-global/buffer": {
"count": 2
},
"node/prefer-global/process": {
"count": 8
}
},
"e2e/scripts/run-cucumber.ts": {
"node/prefer-global/process": {
"count": 9
}
},
"e2e/scripts/setup.ts": {
"node/prefer-global/process": {
"count": 4
}
},
"e2e/support/process.ts": {
"node/prefer-global/process": {
"count": 4
},
"ts/no-use-before-define": {
"count": 2
}
},
"e2e/test-env.ts": {
"node/prefer-global/process": {
"count": 7
}
},
"packages/dify-ui/vite.config.ts": {
"node/prefer-global/process": {
"count": 1
}
},
"packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/migrate.ts": {
"no-console": {
"count": 11

View File

@ -1,5 +1,3 @@
// @ts-check
import antfu, { GLOB_MARKDOWN } from '@antfu/eslint-config'
import md from 'eslint-markdown'
import markdownPreferences from 'eslint-plugin-markdown-preferences'
@ -17,6 +15,13 @@ export default antfu(
'!vite.config.ts',
...original,
],
react: {
files: ['packages/dify-ui/**/*.{ts,tsx}'],
overrides: {
'react/set-state-in-effect': 'error',
'react/no-unnecessary-use-prefix': 'error',
},
},
typescript: {
overrides: {
'ts/consistent-type-definitions': ['error', 'type'],
@ -35,7 +40,12 @@ export default antfu(
'antfu/top-level-function': 'off',
},
},
e18e: false,
},
{
files: ['packages/dify-ui/**/*.{ts,tsx}'],
rules: {
'react-refresh/only-export-components': 'off',
},
},
markdownPreferences.configs.standard,
{
@ -57,9 +67,4 @@ export default antfu(
'markdown-preferences/sort-definitions': 'error',
},
},
{
rules: {
'node/prefer-global/process': 'off',
},
},
)

View File

@ -136,7 +136,7 @@ const StackExamples = () => {
const PromiseExamples = () => {
const createPromiseToast = () => {
const request = new Promise<string>((resolve) => {
window.setTimeout(() => resolve('The deployment is now available in production.'), 1400)
window.setTimeout(resolve, 1400, 'The deployment is now available in production.')
})
void toast.promise(request, {

View File

@ -81,7 +81,7 @@ type ToastApi = {
const toastManager = BaseToast.createToastManager<ToastData>()
function isToastType(type: string): type is ToastType {
return Object.prototype.hasOwnProperty.call(TOAST_TONE_STYLES, type)
return Object.hasOwn(TOAST_TONE_STYLES, type)
}
function getToastType(type?: string): ToastType | undefined {