diff --git a/web/app/components/app/annotation/index.tsx b/web/app/components/app/annotation/index.tsx index 19977c8c50..553836d73c 100644 --- a/web/app/components/app/annotation/index.tsx +++ b/web/app/components/app/annotation/index.tsx @@ -203,7 +203,7 @@ const Annotation: FC = (props) => { {isLoading ? - // eslint-disable-next-line sonarjs/no-nested-conditional + : total > 0 ? ( = ({ }, ] as const - // eslint-disable-next-line sonarjs/no-nested-template-literals, sonarjs/no-nested-conditional const [instructionFromSessionStorage, setInstruction] = useSessionStorageState(`improve-instruction-${flowId}${isBasicMode ? '' : `-${nodeId}${editorId ? `-${editorId}` : ''}`}`) const instruction = instructionFromSessionStorage || '' const [ideaOutput, setIdeaOutput] = useState('') diff --git a/web/app/components/app/overview/settings/index.spec.tsx b/web/app/components/app/overview/settings/index.spec.tsx index 41d86047f0..776c55d149 100644 --- a/web/app/components/app/overview/settings/index.spec.tsx +++ b/web/app/components/app/overview/settings/index.spec.tsx @@ -175,7 +175,7 @@ describe('SettingsModal', () => { renderSettingsModal() fireEvent.click(screen.getByText('appOverview.overview.appInfo.settings.more.entry')) const privacyInput = screen.getByPlaceholderText('appOverview.overview.appInfo.settings.more.privacyPolicyPlaceholder') - // eslint-disable-next-line sonarjs/no-clear-text-protocols + fireEvent.change(privacyInput, { target: { value: 'ftp://invalid-url' } }) fireEvent.click(screen.getByText('common.operation.save')) diff --git a/web/app/components/base/markdown-blocks/code-block.tsx b/web/app/components/base/markdown-blocks/code-block.tsx index 79a374e291..b9b3074351 100644 --- a/web/app/components/base/markdown-blocks/code-block.tsx +++ b/web/app/components/base/markdown-blocks/code-block.tsx @@ -205,7 +205,7 @@ const CodeBlock: any = memo(({ inline, className, children = '', ...props }: any } catch { try { - // eslint-disable-next-line no-new-func, sonarjs/code-eval + // eslint-disable-next-line no-new-func const result = new Function(`return ${trimmedContent}`)() if (typeof result === 'object' && result !== null) { setFinalChartOption(result) @@ -250,7 +250,7 @@ const CodeBlock: any = memo(({ inline, className, children = '', ...props }: any } catch { try { - // eslint-disable-next-line no-new-func, sonarjs/code-eval + // eslint-disable-next-line no-new-func const result = new Function(`return ${trimmedContent}`)() if (typeof result === 'object' && result !== null) { setFinalChartOption(result) diff --git a/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.tsx b/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.tsx index df41e8c1e7..8fe6af6170 100644 --- a/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.tsx +++ b/web/app/components/datasets/documents/create-from-pipeline/processing/embedding-process/rule-detail.tsx @@ -28,10 +28,10 @@ const RuleDetail = ({ case 'mode': value = !sourceData?.mode ? value - // eslint-disable-next-line sonarjs/no-nested-conditional + : sourceData.mode === ProcessMode.general ? (t('embedding.custom', { ns: 'datasetDocuments' }) as string) - // eslint-disable-next-line sonarjs/no-nested-conditional + : `${t('embedding.hierarchical', { ns: 'datasetDocuments' })} ยท ${sourceData?.rules?.parent_mode === 'paragraph' ? t('parentMode.paragraph', { ns: 'dataset' }) : t('parentMode.fullDoc', { ns: 'dataset' })}` @@ -70,7 +70,7 @@ const RuleDetail = ({ src={ retrievalMethod === RETRIEVE_METHOD.fullText ? retrievalIcon.fullText - // eslint-disable-next-line sonarjs/no-nested-conditional + : retrievalMethod === RETRIEVE_METHOD.hybrid ? retrievalIcon.hybrid : retrievalIcon.vector diff --git a/web/app/components/datasets/settings/form/index.tsx b/web/app/components/datasets/settings/form/index.tsx index 206c264a88..6081a36fcc 100644 --- a/web/app/components/datasets/settings/form/index.tsx +++ b/web/app/components/datasets/settings/form/index.tsx @@ -403,7 +403,7 @@ const Form = () => { ) - // eslint-disable-next-line sonarjs/no-nested-conditional + : indexMethod ? ( <> diff --git a/web/app/components/tools/edit-custom-collection-modal/get-schema.spec.tsx b/web/app/components/tools/edit-custom-collection-modal/get-schema.spec.tsx index de156ce68a..fa316c4aab 100644 --- a/web/app/components/tools/edit-custom-collection-modal/get-schema.spec.tsx +++ b/web/app/components/tools/edit-custom-collection-modal/get-schema.spec.tsx @@ -23,7 +23,7 @@ describe('GetSchema', () => { it('shows an error when the URL is not http', () => { fireEvent.click(screen.getByText('tools.createTool.importFromUrl')) const input = screen.getByPlaceholderText('tools.createTool.importFromUrlPlaceHolder') - // eslint-disable-next-line sonarjs/no-clear-text-protocols + fireEvent.change(input, { target: { value: 'ftp://invalid' } }) fireEvent.click(screen.getByText('common.operation.ok')) diff --git a/web/app/components/workflow/nodes/_base/components/variable/utils.ts b/web/app/components/workflow/nodes/_base/components/variable/utils.ts index e5e8174456..2f83945dc2 100644 --- a/web/app/components/workflow/nodes/_base/components/variable/utils.ts +++ b/web/app/components/workflow/nodes/_base/components/variable/utils.ts @@ -474,7 +474,6 @@ const formatItem = ( break } - // eslint-disable-next-line sonarjs/no-duplicated-branches case BlockEnum.VariableAggregator: { const { output_type, advanced_settings } = data as VariableAssignerNodeType @@ -1875,7 +1874,7 @@ export const updateNodeVars = ( } break } - // eslint-disable-next-line sonarjs/no-duplicated-branches + case BlockEnum.VariableAggregator: { const payload = data as VariableAssignerNodeType if (payload.variables) { diff --git a/web/app/components/workflow/nodes/data-source/panel.tsx b/web/app/components/workflow/nodes/data-source/panel.tsx index f29c37d16d..eb233c01c8 100644 --- a/web/app/components/workflow/nodes/data-source/panel.tsx +++ b/web/app/components/workflow/nodes/data-source/panel.tsx @@ -139,20 +139,22 @@ const Panel: FC> = ({ id, data }) => { return (
- {outputItem.value?.type === 'object' ? ( - - ) : ( - - )} + {outputItem.value?.type === 'object' + ? ( + + ) + : ( + + )}
) })} diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx b/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx index e7860d2fb2..c3eef42a39 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx +++ b/web/app/components/workflow/nodes/knowledge-retrieval/components/retrieval-config.tsx @@ -100,7 +100,7 @@ const RetrievalConfig: FC = ({ score_threshold: configs.score_threshold_enabled ? (configs.score_threshold ?? DATASET_DEFAULT.score_threshold) : null, reranking_model: retrieval_mode === RETRIEVE_TYPE.oneWay ? undefined - // eslint-disable-next-line sonarjs/no-nested-conditional + : (!configs.reranking_model?.reranking_provider_name ? undefined : { diff --git a/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts b/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts index a30ec8e735..2ce57bc270 100644 --- a/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts +++ b/web/app/components/workflow/nodes/knowledge-retrieval/utils.ts @@ -135,7 +135,7 @@ export const getMultipleRetrievalConfig = ( vector_setting: { vector_weight: allHighQualityVectorSearch ? DEFAULT_WEIGHTED_SCORE.allHighQualityVectorSearch.semantic - // eslint-disable-next-line sonarjs/no-nested-conditional + : allHighQualityFullTextSearch ? DEFAULT_WEIGHTED_SCORE.allHighQualityFullTextSearch.semantic : DEFAULT_WEIGHTED_SCORE.other.semantic, @@ -145,7 +145,7 @@ export const getMultipleRetrievalConfig = ( keyword_setting: { keyword_weight: allHighQualityVectorSearch ? DEFAULT_WEIGHTED_SCORE.allHighQualityVectorSearch.keyword - // eslint-disable-next-line sonarjs/no-nested-conditional + : allHighQualityFullTextSearch ? DEFAULT_WEIGHTED_SCORE.allHighQualityFullTextSearch.keyword : DEFAULT_WEIGHTED_SCORE.other.keyword, @@ -232,7 +232,6 @@ export const getMultipleRetrievalConfig = ( result.reranking_mode = RerankingModeEnum.RerankingModel result.reranking_enable = true - // eslint-disable-next-line sonarjs/nested-control-flow if ((!result.reranking_model?.provider || !result.reranking_model?.model) && isFallbackRerankModelValid) { result.reranking_model = { provider: fallbackRerankModel.provider || '', diff --git a/web/app/components/workflow/nodes/tool/panel.tsx b/web/app/components/workflow/nodes/tool/panel.tsx index 9ff649b207..899a26ff4f 100644 --- a/web/app/components/workflow/nodes/tool/panel.tsx +++ b/web/app/components/workflow/nodes/tool/panel.tsx @@ -124,20 +124,22 @@ const Panel: FC> = ({ // TODO empty object type always match `qa_structured` schema type return (
- {outputItem.value?.type === 'object' ? ( - - ) : ( - - )} + {outputItem.value?.type === 'object' + ? ( + + ) + : ( + + )}
) })} diff --git a/web/app/components/workflow/note-node/note-editor/utils.ts b/web/app/components/workflow/note-node/note-editor/utils.ts index dff98a8301..22cfc3726a 100644 --- a/web/app/components/workflow/note-node/note-editor/utils.ts +++ b/web/app/components/workflow/note-node/note-editor/utils.ts @@ -18,5 +18,4 @@ export function getSelectedNode( return $isAtNodeEnd(anchor) ? anchorNode : focusNode } -// eslint-disable-next-line sonarjs/empty-string-repetition export const urlRegExp = /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*)?)/ diff --git a/web/eslint-suppressions.json b/web/eslint-suppressions.json index 755ea07f56..4f274115c8 100644 --- a/web/eslint-suppressions.json +++ b/web/eslint-suppressions.json @@ -3280,9 +3280,6 @@ } }, "app/components/workflow/nodes/data-source/panel.tsx": { - "style/multiline-ternary": { - "count": 2 - }, "ts/no-explicit-any": { "count": 3 } @@ -3665,9 +3662,6 @@ } }, "app/components/workflow/nodes/tool/panel.tsx": { - "style/multiline-ternary": { - "count": 2 - }, "ts/no-explicit-any": { "count": 2 } diff --git a/web/i18n-config/settings.ts b/web/i18n-config/settings.ts index 1bf37ab21d..ea2a8a0058 100644 --- a/web/i18n-config/settings.ts +++ b/web/i18n-config/settings.ts @@ -9,5 +9,8 @@ export function getInitOptions(): InitOptions { partialBundledLanguages: true, keySeparator: false, ns: namespacesCamelCase, + interpolation: { + escapeValue: false, + }, } } diff --git a/web/scripts/analyze-i18n-diff.ts b/web/scripts/analyze-i18n-diff.ts index 9fd5f3b4a7..bd830c5523 100644 --- a/web/scripts/analyze-i18n-diff.ts +++ b/web/scripts/analyze-i18n-diff.ts @@ -106,7 +106,7 @@ function parseTsContent(content: string): NestedTranslation { // Use Function constructor to safely evaluate the object literal // This handles JS object syntax like unquoted keys, template literals, etc. try { - // eslint-disable-next-line no-new-func, sonarjs/code-eval + // eslint-disable-next-line no-new-func const fn = new Function(`return (${cleaned})`) return fn() as NestedTranslation } @@ -123,7 +123,7 @@ function parseTsContent(content: string): NestedTranslation { function getMainBranchFile(filePath: string): string | null { try { const relativePath = `./i18n/${LOCALE}/${filePath}` - // eslint-disable-next-line sonarjs/os-command + return execSync(`git show main:${relativePath}`, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], @@ -148,12 +148,12 @@ function getTranslationFiles(): string[] { function getMainBranchNamespaces(): string[] { try { const relativePath = `./i18n/${LOCALE}` - // eslint-disable-next-line sonarjs/os-command + const output = execSync(`git ls-tree --name-only main ${relativePath}/`, { encoding: 'utf-8', stdio: ['pipe', 'pipe', 'pipe'], }) - // eslint-disable-next-line sonarjs/os-command + return output .trim() .split('\n')