diff --git a/web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx b/web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx index 77f2b54533..e6cb56f490 100644 --- a/web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx +++ b/web/app/components/app/configuration/config-var/config-modal/__tests__/index-logic.spec.tsx @@ -43,7 +43,7 @@ vi.mock('../form-fields', () => ({ > invalid-name-change - + diff --git a/web/app/components/base/markdown-with-directive/index.tsx b/web/app/components/base/markdown-with-directive/index.tsx index 552d8a3aaa..8da4cf7ede 100644 --- a/web/app/components/base/markdown-with-directive/index.tsx +++ b/web/app/components/base/markdown-with-directive/index.tsx @@ -91,7 +91,7 @@ function buildDirectiveRehypePlugins(): PluggableList { ]) const attributes: Record = { - ...(defaultSanitizeSchema.attributes ?? {}), + ...defaultSanitizeSchema.attributes, } for (const [tagName, allowedAttributes] of Object.entries(DIRECTIVE_ALLOWED_TAGS)) diff --git a/web/app/components/base/markdown/streamdown-wrapper.tsx b/web/app/components/base/markdown/streamdown-wrapper.tsx index 342f5cf44b..e566ffc611 100644 --- a/web/app/components/base/markdown/streamdown-wrapper.tsx +++ b/web/app/components/base/markdown/streamdown-wrapper.tsx @@ -86,7 +86,7 @@ function buildRehypePlugins(extraPlugins?: PluggableList): PluggableList { ]) const mergedAttributes: Record = { - ...(defaultSanitizeSchema.attributes ?? {}), + ...defaultSanitizeSchema.attributes, } for (const tag of Object.keys(ALLOWED_TAGS)) { diff --git a/web/app/components/datasets/documents/detail/metadata/hooks/use-metadata-state.ts b/web/app/components/datasets/documents/detail/metadata/hooks/use-metadata-state.ts index 7bfa64ac8e..7fc0c17cb0 100644 --- a/web/app/components/datasets/documents/detail/metadata/hooks/use-metadata-state.ts +++ b/web/app/components/datasets/documents/detail/metadata/hooks/use-metadata-state.ts @@ -75,7 +75,7 @@ export function useMetadataState({ docDetail, onUpdate }: UseMetadataStateOption setEditStatus(true) } const cancelEdit = () => { - setMetadataParams({ documentType: docType || '', metadata: { ...(docDetail?.doc_metadata || {}) } }) + setMetadataParams({ documentType: docType || '', metadata: { ...docDetail?.doc_metadata } }) setEditStatus(!docType) if (!docType) setShowDocTypes(true) diff --git a/web/app/components/plugins/marketplace/search-box/__tests__/tags-filter.spec.tsx b/web/app/components/plugins/marketplace/search-box/__tests__/tags-filter.spec.tsx index bb5d8e734c..117b8cdfab 100644 --- a/web/app/components/plugins/marketplace/search-box/__tests__/tags-filter.spec.tsx +++ b/web/app/components/plugins/marketplace/search-box/__tests__/tags-filter.spec.tsx @@ -47,7 +47,7 @@ vi.mock('@/app/components/base/input', () => ({ })) vi.mock('@/app/components/base/portal-to-follow-elem', async () => { - const React = await import('react') + const _React = await import('react') return { PortalToFollowElem: ({ children }: { children: React.ReactNode }) =>
{children}
, PortalToFollowElemTrigger: ({ diff --git a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/log-viewer.spec.tsx b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/log-viewer.spec.tsx index 3594c10ce2..3b179d0881 100644 --- a/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/log-viewer.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/subscription-list/__tests__/log-viewer.spec.tsx @@ -145,7 +145,7 @@ describe('LogViewer', () => { }) it('should parse request data when it is raw JSON', () => { - const log = createLog({ request: { ...createLog().request, data: '{\"hello\":1}' } }) + const log = createLog({ request: { ...createLog().request, data: '{"hello":1}' } }) render() diff --git a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx index beab35595c..3c56089b97 100644 --- a/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx +++ b/web/app/components/plugins/plugin-detail-panel/tool-selector/components/__tests__/reasoning-config-form.spec.tsx @@ -67,7 +67,7 @@ vi.mock('@/app/components/plugins/plugin-detail-panel/model-selector', () => ({ vi.mock('@/app/components/workflow/nodes/_base/components/editor/code-editor', () => ({ default: ({ onChange }: { onChange: (value: string) => void }) => ( - ), diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/strategy-picker.spec.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/strategy-picker.spec.tsx index 5be10ff146..e287e48985 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/strategy-picker.spec.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/strategy-picker.spec.tsx @@ -14,7 +14,7 @@ vi.mock('@langgenius/dify-ui/button', () => ({ })) vi.mock('@/app/components/base/portal-to-follow-elem', async () => { - const React = await import('react') + const _React = await import('react') return { PortalToFollowElem: ({ open, diff --git a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/tool-picker.spec.tsx b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/tool-picker.spec.tsx index 9e63622d3f..e89b1b3161 100644 --- a/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/tool-picker.spec.tsx +++ b/web/app/components/plugins/reference-setting-modal/auto-update-setting/__tests__/tool-picker.spec.tsx @@ -22,7 +22,7 @@ vi.mock('@/app/components/base/loading', () => ({ })) vi.mock('@/app/components/base/portal-to-follow-elem', async () => { - const React = await import('react') + const _React = await import('react') return { PortalToFollowElem: ({ open, diff --git a/web/app/components/workflow-app/hooks/__tests__/use-workflow-run.spec.ts b/web/app/components/workflow-app/hooks/__tests__/use-workflow-run.spec.ts index 7b54598774..59ba667f8d 100644 --- a/web/app/components/workflow-app/hooks/__tests__/use-workflow-run.spec.ts +++ b/web/app/components/workflow-app/hooks/__tests__/use-workflow-run.spec.ts @@ -501,7 +501,8 @@ describe('useWorkflowRun', () => { windowWithDebugControllers.__allTriggersDebugAbortController = { abort: allTriggersAbort } const refController = new AbortController() const refAbortSpy = vi.spyOn(refController, 'abort') - const { getAbortController } = mocks.mockSsePost.mock.calls.at(-1)?.[2] as { + const lastCall = mocks.mockSsePost.mock.calls.at(-1) + const { getAbortController } = (lastCall?.[2] ?? {}) as { getAbortController?: (controller: AbortController) => void } getAbortController?.(refController) diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.ts index f0e23586eb..0ce86602fa 100644 --- a/web/app/components/workflow/hooks/use-nodes-interactions.ts +++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts @@ -1543,7 +1543,7 @@ export const useNodesInteractions = () => { targetHandle, type: CUSTOM_EDGE, data: { - ...(edge.data || {}), + ...edge.data, sourceType: newCurrentNode.data.type, targetType: targetNodeForEdge.data.type, isInIteration, @@ -1583,7 +1583,7 @@ export const useNodesInteractions = () => { targetHandle, type: CUSTOM_EDGE, data: { - ...(edge.data || {}), + ...edge.data, sourceType: sourceNode.data.type, targetType: newCurrentNode.data.type, isInIteration: newNodeIsInIteration, diff --git a/web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsx index 5cd378ffa2..f1feb0a669 100644 --- a/web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsx +++ b/web/app/components/workflow/nodes/assigner/__tests__/integration.spec.tsx @@ -320,7 +320,7 @@ describe('assigner path', () => { true)} filterToAssignedVar={vi.fn(() => true)} @@ -332,9 +332,9 @@ describe('assigner path', () => { />, ) - fireEvent.change(screen.getByLabelText('code-editor'), { target: { value: '{\"a\":2}' } }) + fireEvent.change(screen.getByLabelText('code-editor'), { target: { value: '{"a":2}' } }) expect(onChange).toHaveBeenLastCalledWith([ - createOperation({ operation: WriteMode.set, value: '{\"a\":2}' }), + createOperation({ operation: WriteMode.set, value: '{"a":2}' }), ], '{"a":2}') onChange.mockClear() diff --git a/web/app/components/workflow/nodes/http/components/__tests__/curl-panel.spec.tsx b/web/app/components/workflow/nodes/http/components/__tests__/curl-panel.spec.tsx index 141f8fd5f9..069ab4547e 100644 --- a/web/app/components/workflow/nodes/http/components/__tests__/curl-panel.spec.tsx +++ b/web/app/components/workflow/nodes/http/components/__tests__/curl-panel.spec.tsx @@ -32,7 +32,7 @@ describe('curl-panel', () => { describe('parseCurl', () => { it('should parse method, headers, json body, and query params from a valid curl command', () => { - const { node, error } = curlParser.parseCurl('curl -X POST -H \"Authorization: Bearer token\" --json \"{\"name\":\"openai\"}\" https://example.com/users?page=1&size=2') + const { node, error } = curlParser.parseCurl('curl -X POST -H "Authorization: Bearer token" --json "{"name":"openai"}" https://example.com/users?page=1&size=2') expect(error).toBeNull() expect(node).toMatchObject({ diff --git a/web/app/components/workflow/nodes/loop/__tests__/integration.spec.tsx b/web/app/components/workflow/nodes/loop/__tests__/integration.spec.tsx index 0af05e9674..a4a00fee67 100644 --- a/web/app/components/workflow/nodes/loop/__tests__/integration.spec.tsx +++ b/web/app/components/workflow/nodes/loop/__tests__/integration.spec.tsx @@ -563,7 +563,7 @@ describe('loop path', () => { id: 'loop-var-object', var_type: VarType.arrayObject, value_type: ValueType.constant, - value: '[{\"id\":1}]', + value: '[{"id":1}]', })} onChange={onObjectChange} /> @@ -571,7 +571,7 @@ describe('loop path', () => { ) fireEvent.change(screen.getByDisplayValue('draft'), { target: { value: 'published' } }) - fireEvent.change(screen.getByLabelText('code-editor'), { target: { value: '[{\"id\":2}]' } }) + fireEvent.change(screen.getByLabelText('code-editor'), { target: { value: '[{"id":2}]' } }) expect(onStringChange).toHaveBeenCalledWith('published') expect(onObjectChange).toHaveBeenCalledWith('[{"id":2}]') diff --git a/web/context/modal-context-provider.tsx b/web/context/modal-context-provider.tsx index 5facc9a202..fcc37a1030 100644 --- a/web/context/modal-context-provider.tsx +++ b/web/context/modal-context-provider.tsx @@ -122,7 +122,7 @@ export const ModalContextProvider = ({ const setShowAccountSettingModal = useCallback((next: SetStateAction | null>) => { const currentState = accountSettingTab - ? { payload: accountSettingTab, ...(accountSettingCallbacksRef.current ?? {}) } + ? { payload: accountSettingTab, ...accountSettingCallbacksRef.current } : null const resolvedState = typeof next === 'function' ? next(currentState) : next if (!resolvedState) { diff --git a/web/public/embed.js b/web/public/embed.js index d5eabc0533..f7c6fdaf4a 100644 --- a/web/public/embed.js +++ b/web/public/embed.js @@ -312,9 +312,11 @@ } targetIframe.style.display = targetIframe.style.display === "none" ? "block" : "none"; - targetIframe.style.display === "none" - ? setSvgIcon("open") - : setSvgIcon("close"); + if (targetIframe.style.display === "none") { + setSvgIcon("open") + } else { + setSvgIcon("close") + } if (targetIframe.style.display === "none") { document.removeEventListener("keydown", handleEscKey); diff --git a/web/scripts/check-i18n.js b/web/scripts/check-i18n.js index 34b842cc00..6936bcb452 100644 --- a/web/scripts/check-i18n.js +++ b/web/scripts/check-i18n.js @@ -116,7 +116,7 @@ async function getKeysFromLanguage(language) { } // Filter only .json files - const translationFiles = files.filter(file => /\.json$/.test(file)) + const translationFiles = files.filter(file => file.endsWith('.json')) translationFiles.forEach((file) => { const filePath = path.join(folderPath, file) @@ -263,7 +263,7 @@ async function main() { // Get all translation files const i18nFolder = path.resolve(__dirname, '../i18n', language) const files = fs.readdirSync(i18nFolder) - .filter(file => /\.json$/.test(file)) + .filter(file => file.endsWith('.json')) .map(file => file.replace(/\.json$/, '')) .filter(f => targetFiles.length === 0 || targetFiles.includes(f)) diff --git a/web/scripts/component-analyzer.js b/web/scripts/component-analyzer.js index 4612981f82..59f1e3f10e 100644 --- a/web/scripts/component-analyzer.js +++ b/web/scripts/component-analyzer.js @@ -206,10 +206,10 @@ export class ComponentAnalyzer { const escapedName = ComponentAnalyzer.escapeRegExp(searchName) const patterns = [ - new RegExp(`from\\s+['\"][^'\"]*(?:/|^)${escapedName}(?:['\"/]|$)`), - new RegExp(`import\\s*\\(\\s*['\"][^'\"]*(?:/|^)${escapedName}(?:['\"/]|$)`), - new RegExp(`export\\s+(?:\\*|{[^}]*})\\s*from\\s+['\"][^'\"]*(?:/|^)${escapedName}(?:['\"/]|$)`), - new RegExp(`require\\(\\s*['\"][^'\"]*(?:/|^)${escapedName}(?:['\"/]|$)`), + new RegExp(`from\\s+['"][^'"]*(?:/|^)${escapedName}(?:['"/]|$)`), + new RegExp(`import\\s*\\(\\s*['"][^'"]*(?:/|^)${escapedName}(?:['"/]|$)`), + new RegExp(`export\\s+(?:\\*|{[^}]*})\\s*from\\s+['"][^'"]*(?:/|^)${escapedName}(?:['"/]|$)`), + new RegExp(`require\\s*\\(\\s*['"][^'"]*(?:/|^)${escapedName}(?:['"/]|$)`), ] const visited = new Set() diff --git a/web/types/doc-paths.ts b/web/types/doc-paths.ts index a0f2d12097..3f030a2733 100644 --- a/web/types/doc-paths.ts +++ b/web/types/doc-paths.ts @@ -272,9 +272,6 @@ export type DocPathWithoutLang = | DocPathWithoutLangBase | `${DocPathWithoutLangBase}#${string}` -// Full documentation path with language prefix -type DifyDocPath = `${DocLanguage}/${DocPathWithoutLang}` - // API Reference path translations (English -> other languages) export const apiReferencePathTranslations: Record = { '/api-reference/annotations/configure-annotation-reply': { zh: '/api-reference/标注管理/配置标注回复', ja: '/api-reference/アノテーション管理/アノテーション返信を設定' },