From fe09df3afbc5f9e0d1116b967802c69a8d570bd2 Mon Sep 17 00:00:00 2001 From: yyh <92089059+lyzno1@users.noreply.github.com> Date: Tue, 22 Sep 2026 03:51:14 +0000 Subject: [PATCH] refactor(web): use Number.isNaN for numeric guards (#42692) --- oxlint-suppressions.json | 18 ------------------ .../datasets/hit-testing/components/score.tsx | 2 +- .../model-provider-page/model-modal/Input.tsx | 4 ++-- .../iteration-log/iteration-log-trigger.tsx | 2 +- .../workflow/run/loop-log/loop-log-trigger.tsx | 2 +- 5 files changed, 5 insertions(+), 23 deletions(-) diff --git a/oxlint-suppressions.json b/oxlint-suppressions.json index 51c00aab7a9..72925020904 100644 --- a/oxlint-suppressions.json +++ b/oxlint-suppressions.json @@ -2236,11 +2236,6 @@ "count": 2 } }, - "web/app/components/datasets/hit-testing/components/score.tsx": { - "unicorn/prefer-number-properties": { - "count": 1 - } - }, "web/app/components/datasets/list/dataset-card/components/operations-dropdown.tsx": { "jsx-a11y/click-events-have-key-events": { "count": 1 @@ -2434,11 +2429,6 @@ "count": 7 } }, - "web/app/components/header/account-setting/model-provider-page/model-modal/Input.tsx": { - "unicorn/prefer-number-properties": { - "count": 2 - } - }, "web/app/components/header/account-setting/model-provider-page/model-modal/index.tsx": { "typescript/no-explicit-any": { "count": 5 @@ -4435,9 +4425,6 @@ "web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx": { "dify/require-disable-directive-description": { "count": 2 - }, - "unicorn/prefer-number-properties": { - "count": 1 } }, "web/app/components/workflow/run/iteration-log/iteration-result-panel.tsx": { @@ -4464,11 +4451,6 @@ "count": 2 } }, - "web/app/components/workflow/run/loop-log/loop-log-trigger.tsx": { - "unicorn/prefer-number-properties": { - "count": 1 - } - }, "web/app/components/workflow/run/loop-log/loop-result-panel.tsx": { "jsx-a11y/click-events-have-key-events": { "count": 2 diff --git a/web/app/components/datasets/hit-testing/components/score.tsx b/web/app/components/datasets/hit-testing/components/score.tsx index 670fda868d1..ddef36afa95 100644 --- a/web/app/components/datasets/hit-testing/components/score.tsx +++ b/web/app/components/datasets/hit-testing/components/score.tsx @@ -9,7 +9,7 @@ type Props = { } const Score: FC = ({ value, besideChunkName }) => { - if (!value || isNaN(value)) return null + if (!value || Number.isNaN(value)) return null return (
= ({ const toLimit = (v: string) => { const minNum = Number.parseFloat(`${min}`) const maxNum = Number.parseFloat(`${max}`) - if (!isNaN(minNum) && Number.parseFloat(v) < minNum) { + if (!Number.isNaN(minNum) && Number.parseFloat(v) < minNum) { onChange(`${min}`) return } - if (!isNaN(maxNum) && Number.parseFloat(v) > maxNum) onChange(`${max}`) + if (!Number.isNaN(maxNum) && Number.parseFloat(v) > maxNum) onChange(`${max}`) } return ( diff --git a/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx b/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx index 1020a90e9d6..94d34fa0d5c 100644 --- a/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx +++ b/web/app/components/workflow/run/iteration-log/iteration-log-trigger.tsx @@ -73,7 +73,7 @@ const IterationLogTrigger = ({ if (parallelNodes.length > 0) return parallelNodes const serialIndex = Number.parseInt(key, 10) - if (!isNaN(serialIndex)) { + if (!Number.isNaN(serialIndex)) { const serialNodes = allExecutions.filter( (exec) => exec.execution_metadata?.iteration_id === nodeInfo.node_id && diff --git a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx index eb1b0928780..420a53fafc0 100644 --- a/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx +++ b/web/app/components/workflow/run/loop-log/loop-log-trigger.tsx @@ -25,7 +25,7 @@ const LoopLogTrigger = ({ nodeInfo, allExecutions, onShowLoopResultList }: LoopL if (parallelNodes.length > 0) return parallelNodes const serialIndex = Number.parseInt(key, 10) - if (!isNaN(serialIndex)) { + if (!Number.isNaN(serialIndex)) { const serialNodes = allExecutions.filter( (exec) => exec.execution_metadata?.loop_id === nodeInfo.node_id &&