Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

refactor: clear small lint suppression scopes (#42701)

yyh7a590a5b411e
diff --git a/cli/test/e2e/suites/output/json-yaml-output.e2e.ts b/cli/test/e2e/suites/output/json-yaml-output.e2e.ts
index 1036baafe5a..2ae470c223c 100644
--- a/cli/test/e2e/suites/output/json-yaml-output.e2e.ts
+++ b/cli/test/e2e/suites/output/json-yaml-output.e2e.ts
@@ -168,7 +168,6 @@ describe('E2E / JSON & YAML output format (spec 5.2)', () => {
// the JSON error envelope always has the same top-level structure.
const unauthTmp = await withTempConfig()
let envelope1: ReturnType<typeof assertErrorEnvelope>
- let envelope2: ReturnType<typeof assertErrorEnvelope>
try {
// Scenario A: unauthenticated → not_logged_in (error in stderr)
const { run: runFn } = await import('../../helpers/cli.js')
@@ -181,7 +180,7 @@ describe('E2E / JSON & YAML output format (spec 5.2)', () => {
// Scenario B: non-existent app → server error (error in stderr when -o json)
const r2 = await fx.r(['get', 'app', 'nonexistent-app-id-00000000', '-o', 'json'])
assertNonZeroExit(r2)
- envelope2 = assertErrorEnvelope(r2)
+ const envelope2 = assertErrorEnvelope(r2)
// Both envelopes must share the same schema structure
expect(envelope1.error).toHaveProperty('code')
diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json
index 72925020904..ad4de0868a4 100644
--- a/oxlint-suppressions.json
+++ b/oxlint-suppressions.json
@@ -4,11 +4,6 @@
"count": 1
}
},
- "cli/test/e2e/suites/output/json-yaml-output.e2e.ts": {
- "prefer-const": {
- "count": 1
- }
- },
"packages/migrate-no-unchecked-indexed-access/src/no-unchecked-indexed-access/migrate.ts": {
"no-console": {
"count": 11
@@ -260,9 +255,6 @@
}
},
"web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx": {
- "no-unused-vars": {
- "count": 1
- },
"typescript/no-explicit-any": {
"count": 1
}
@@ -609,11 +601,6 @@
"count": 2
}
},
- "web/app/components/app/type-selector/index.tsx": {
- "unicorn/prefer-includes": {
- "count": 2
- }
- },
"web/app/components/app/workflow-log/__tests__/list.spec.tsx": {
"typescript/no-explicit-any": {
"count": 1
@@ -668,11 +655,6 @@
"count": 2
}
},
- "web/app/components/base/app-icon-picker/ImageInput.tsx": {
- "eslint-react/no-create-ref": {
- "count": 1
- }
- },
"web/app/components/base/audio-btn/audio.player.manager.ts": {
"dify/require-disable-directive-description": {
"count": 1
@@ -901,9 +883,6 @@
}
},
"web/app/components/base/error-boundary/index.tsx": {
- "eslint-react/jsx-no-key-after-spread": {
- "count": 1
- },
"react/only-export-components": {
"count": 1
},
@@ -3426,9 +3405,6 @@
"web/app/components/workflow/nodes/_base/components/variable/variable-label/hooks.ts": {
"eslint-react/no-unnecessary-use-prefix": {
"count": 2
- },
- "eslint-react/use-memo": {
- "count": 2
}
},
"web/app/components/workflow/nodes/_base/components/variable/variable-label/index.tsx": {
@@ -3513,9 +3489,6 @@
}
},
"web/app/components/workflow/nodes/agent/node.tsx": {
- "eslint-react/jsx-no-key-after-spread": {
- "count": 2
- },
"typescript/no-explicit-any": {
"count": 2
}
@@ -4660,9 +4633,6 @@
"web/app/components/workflow/workflow-generator/example-prompts.tsx": {
"dify/require-disable-directive-description": {
"count": 1
- },
- "no-useless-return": {
- "count": 1
}
},
"web/app/components/workflow/workflow-generator/index.tsx": {
diff --git a/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx b/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx
index 7b9068edcca..6d4ca7aedf7 100644
--- a/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx
+++ b/web/app/components/app/configuration/config-var/config-modal/__tests__/form-fields.spec.tsx
@@ -7,7 +7,6 @@ import ConfigModalFormFields from '../form-fields'
vi.mock('react-i18next', async () => {
const { withSelectorKey, withSelectorKeyProps } = await import('@/test/i18n-mock')
- const React = await import('react')
return {
useTranslation: () => ({
t: withSelectorKey((key: string, options?: Record<string, unknown>) => {
diff --git a/web/app/components/app/type-selector/index.tsx b/web/app/components/app/type-selector/index.tsx
index 9ba994a42d4..5f326ed77b0 100644
--- a/web/app/components/app/type-selector/index.tsx
+++ b/web/app/components/app/type-selector/index.tsx
@@ -68,10 +68,10 @@ const AppTypeSelector = ({ value, onChange }: AppSelectorProps) => {
<AppTypeSelectorItem
key={mode}
type={mode}
- checked={Boolean(value.length > 0 && value?.indexOf(mode) !== -1)}
+ checked={value.includes(mode)}
onClick={() => {
- if (value?.indexOf(mode) !== -1) onChange(value?.filter((v) => v !== mode) ?? [])
- else onChange([...(value || []), mode])
+ if (value.includes(mode)) onChange(value.filter((v) => v !== mode))
+ else onChange([...value, mode])
}}
/>
))}
diff --git a/web/app/components/base/app-icon-picker/ImageInput.tsx b/web/app/components/base/app-icon-picker/ImageInput.tsx
index 65996087b9d..860429f1994 100644
--- a/web/app/components/base/app-icon-picker/ImageInput.tsx
+++ b/web/app/components/base/app-icon-picker/ImageInput.tsx
@@ -3,7 +3,7 @@
import type { ChangeEvent, FC } from 'react'
import type { Area, CropperProps } from 'react-easy-crop'
import { cn } from '@langgenius/dify-ui/cn'
-import { createRef, useEffect, useState } from 'react'
+import { useEffect, useRef, useState } from 'react'
import Cropper from 'react-easy-crop'
import { useTranslation } from 'react-i18next'
import { ALLOW_FILE_EXTENSIONS } from '@/types/app'
@@ -54,7 +54,7 @@ const ImageInput: FC<UploaderProps> = ({ className, cropShape, onImageInput }) =
const { isDragActive, handleDragEnter, handleDragOver, handleDragLeave, handleDrop } =
useDraggableUploader((file: File) => setInputImage({ file, url: URL.createObjectURL(file) }))
- const inputRef = createRef<HTMLInputElement>()
+ const inputRef = useRef<HTMLInputElement>(null)
const handleShowImage = () => {
if (isAnimatedImage) {
diff --git a/web/app/components/base/error-boundary/index.tsx b/web/app/components/base/error-boundary/index.tsx
index 66adb153baa..f71f9341c55 100644
--- a/web/app/components/base/error-boundary/index.tsx
+++ b/web/app/components/base/error-boundary/index.tsx
@@ -220,9 +220,9 @@ const ErrorBoundary: React.FC<ErrorBoundaryProps> = (props) => {
return (
<ErrorBoundaryInner
+ key={errorBoundaryKey}
{...props}
copy={copy}
- key={errorBoundaryKey}
resetErrorBoundary={resetErrorBoundary}
onResetKeysChange={onResetKeysChange}
/>
diff --git a/web/app/components/workflow/nodes/_base/components/variable/variable-label/hooks.ts b/web/app/components/workflow/nodes/_base/components/variable/variable-label/hooks.ts
index 3bd7716839e..48cdbf28e0e 100644
--- a/web/app/components/workflow/nodes/_base/components/variable/variable-label/hooks.ts
+++ b/web/app/components/workflow/nodes/_base/components/variable/variable-label/hooks.ts
@@ -64,12 +64,9 @@ export const useVarColor = (
export const useVarName = (variables: string[], notShowFullPath?: boolean) => {
const showName = VAR_SHOW_NAME_MAP[variables.join('.')]
- let variableFullPathName = variables.slice(1).join('.')
-
- if (isRagVariableVar(variables)) variableFullPathName = variables.slice(2).join('.')
const varName = useMemo(() => {
- variableFullPathName = variables.slice(1).join('.')
+ let variableFullPathName = variables.slice(1).join('.')
if (isRagVariableVar(variables)) variableFullPathName = variables.slice(2).join('.')
diff --git a/web/app/components/workflow/nodes/agent/node.tsx b/web/app/components/workflow/nodes/agent/node.tsx
index dcabda0fa44..ba0e790808a 100644
--- a/web/app/components/workflow/nodes/agent/node.tsx
+++ b/web/app/components/workflow/nodes/agent/node.tsx
@@ -108,7 +108,7 @@ const AgentNode: FC<NodeProps<AgentNodeType>> = (props) => {
}
>
{models.map((model) => {
- return <ModelBar {...model} key={model.param} />
+ return <ModelBar key={model.param} {...model} />
})}
</Group>
)}
@@ -122,7 +122,7 @@ const AgentNode: FC<NodeProps<AgentNodeType>> = (props) => {
>
<div className="grid grid-cols-10 gap-0.5">
{tools.map((tool, i) => (
- <ToolIcon {...tool} key={tool.id + i} />
+ <ToolIcon key={tool.id + i} {...tool} />
))}
</div>
</Group>
diff --git a/web/app/components/workflow/workflow-generator/example-prompts.tsx b/web/app/components/workflow/workflow-generator/example-prompts.tsx
index 7d64adf08a2..40af187cdd6 100644
--- a/web/app/components/workflow/workflow-generator/example-prompts.tsx
+++ b/web/app/components/workflow/workflow-generator/example-prompts.tsx
@@ -21,12 +21,6 @@ const SKELETONS = [
{ id: 'wide', width: 120 },
] as const
-// AbortController throws a DOMException in modern browsers and a plain Error in
-// older / non-DOM environments — accept both so a user-triggered abort (modal
-// close / regenerate) never surfaces as an error.
-const isAbortError = (e: unknown): boolean =>
- (e instanceof DOMException || e instanceof Error) && e.name === 'AbortError'
-
/**
* "Ideas for you" chips under the instruction textarea.
*
@@ -81,8 +75,7 @@ const ExamplePrompts = ({ mode, onSelect }: Props) => {
const next = (res?.suggestions ?? []).map((s) => s.trim()).filter(Boolean)
// Keep the previous set on an empty refresh so the row never flashes empty.
if (next.length) setCached(next)
- } catch (e) {
- if (isAbortError(e)) return
+ } catch {
// Silent: the static fallback keeps the row populated.
} finally {
setIsLoading(false)