refactor(web): use Number.isNaN for numeric guards (#42692)

This commit is contained in:
yyh authored and GitHub committed 2026-09-22 03:51:14 +00:00
1 parent 1ff8a5ff4f
commit fe09df3afb
5 files changed
+5 -23

No files matched your search

-18
View File
@@ -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
@@ -9,7 +9,7 @@ type Props = {
}
const Score: FC<Props> = ({ value, besideChunkName }) => {
if (!value || isNaN(value)) return null
if (!value || Number.isNaN(value)) return null
return (
<div
className={cn(
@@ -29,11 +29,11 @@ const Input: FC<InputProps> = ({
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 (
@@ -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 &&
@@ -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 &&