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.

Fix/disable no constant binary expression (#25311)

Matri Qi563a5af9e770
diff --git a/web/.oxlintrc.json b/web/.oxlintrc.json
new file mode 100644
index 00000000000..1bfcca58f58
--- /dev/null
+++ b/web/.oxlintrc.json
@@ -0,0 +1,144 @@
+{
+ "plugins": [
+ "unicorn",
+ "typescript",
+ "oxc"
+ ],
+ "categories": {},
+ "rules": {
+ "for-direction": "error",
+ "no-async-promise-executor": "error",
+ "no-caller": "error",
+ "no-class-assign": "error",
+ "no-compare-neg-zero": "error",
+ "no-cond-assign": "warn",
+ "no-const-assign": "warn",
+ "no-constant-binary-expression": "error",
+ "no-constant-condition": "warn",
+ "no-control-regex": "warn",
+ "no-debugger": "warn",
+ "no-delete-var": "warn",
+ "no-dupe-class-members": "warn",
+ "no-dupe-else-if": "warn",
+ "no-dupe-keys": "warn",
+ "no-duplicate-case": "warn",
+ "no-empty-character-class": "warn",
+ "no-empty-pattern": "warn",
+ "no-empty-static-block": "warn",
+ "no-eval": "warn",
+ "no-ex-assign": "warn",
+ "no-extra-boolean-cast": "warn",
+ "no-func-assign": "warn",
+ "no-global-assign": "warn",
+ "no-import-assign": "warn",
+ "no-invalid-regexp": "warn",
+ "no-irregular-whitespace": "warn",
+ "no-loss-of-precision": "warn",
+ "no-new-native-nonconstructor": "warn",
+ "no-nonoctal-decimal-escape": "warn",
+ "no-obj-calls": "warn",
+ "no-self-assign": "warn",
+ "no-setter-return": "warn",
+ "no-shadow-restricted-names": "warn",
+ "no-sparse-arrays": "warn",
+ "no-this-before-super": "warn",
+ "no-unassigned-vars": "warn",
+ "no-unsafe-finally": "warn",
+ "no-unsafe-negation": "warn",
+ "no-unsafe-optional-chaining": "warn",
+ "no-unused-labels": "warn",
+ "no-unused-private-class-members": "warn",
+ "no-unused-vars": "warn",
+ "no-useless-backreference": "warn",
+ "no-useless-catch": "error",
+ "no-useless-escape": "warn",
+ "no-useless-rename": "warn",
+ "no-with": "warn",
+ "require-yield": "warn",
+ "use-isnan": "warn",
+ "valid-typeof": "warn",
+ "oxc/bad-array-method-on-arguments": "warn",
+ "oxc/bad-char-at-comparison": "warn",
+ "oxc/bad-comparison-sequence": "warn",
+ "oxc/bad-min-max-func": "warn",
+ "oxc/bad-object-literal-comparison": "warn",
+ "oxc/bad-replace-all-arg": "warn",
+ "oxc/const-comparisons": "warn",
+ "oxc/double-comparisons": "warn",
+ "oxc/erasing-op": "warn",
+ "oxc/missing-throw": "warn",
+ "oxc/number-arg-out-of-range": "warn",
+ "oxc/only-used-in-recursion": "warn",
+ "oxc/uninvoked-array-callback": "warn",
+ "typescript/await-thenable": "warn",
+ "typescript/no-array-delete": "warn",
+ "typescript/no-base-to-string": "warn",
+ "typescript/no-confusing-void-expression": "warn",
+ "typescript/no-duplicate-enum-values": "warn",
+ "typescript/no-duplicate-type-constituents": "warn",
+ "typescript/no-extra-non-null-assertion": "warn",
+ "typescript/no-floating-promises": "warn",
+ "typescript/no-for-in-array": "warn",
+ "typescript/no-implied-eval": "warn",
+ "typescript/no-meaningless-void-operator": "warn",
+ "typescript/no-misused-new": "warn",
+ "typescript/no-misused-spread": "warn",
+ "typescript/no-non-null-asserted-optional-chain": "warn",
+ "typescript/no-redundant-type-constituents": "warn",
+ "typescript/no-this-alias": "warn",
+ "typescript/no-unnecessary-parameter-property-assignment": "warn",
+ "typescript/no-unsafe-declaration-merging": "warn",
+ "typescript/no-unsafe-unary-minus": "warn",
+ "typescript/no-useless-empty-export": "warn",
+ "typescript/no-wrapper-object-types": "warn",
+ "typescript/prefer-as-const": "warn",
+ "typescript/require-array-sort-compare": "warn",
+ "typescript/restrict-template-expressions": "warn",
+ "typescript/triple-slash-reference": "warn",
+ "typescript/unbound-method": "warn",
+ "unicorn/no-await-in-promise-methods": "warn",
+ "unicorn/no-empty-file": "warn",
+ "unicorn/no-invalid-fetch-options": "warn",
+ "unicorn/no-invalid-remove-event-listener": "warn",
+ "unicorn/no-new-array": "warn",
+ "unicorn/no-single-promise-in-promise-methods": "warn",
+ "unicorn/no-thenable": "warn",
+ "unicorn/no-unnecessary-await": "warn",
+ "unicorn/no-useless-fallback-in-spread": "warn",
+ "unicorn/no-useless-length-check": "warn",
+ "unicorn/no-useless-spread": "warn",
+ "unicorn/prefer-set-size": "warn",
+ "unicorn/prefer-string-starts-ends-with": "warn"
+ },
+ "settings": {
+ "jsx-a11y": {
+ "polymorphicPropName": null,
+ "components": {},
+ "attributes": {}
+ },
+ "next": {
+ "rootDir": []
+ },
+ "react": {
+ "formComponents": [],
+ "linkComponents": []
+ },
+ "jsdoc": {
+ "ignorePrivate": false,
+ "ignoreInternal": false,
+ "ignoreReplacesDocs": true,
+ "overrideReplacesDocs": true,
+ "augmentsExtendsReplacesDocs": false,
+ "implementsReplacesDocs": false,
+ "exemptDestructuredRootsFromChecks": false,
+ "tagNamePreference": {}
+ }
+ },
+ "env": {
+ "builtin": true
+ },
+ "globals": {},
+ "ignorePatterns": [
+ "**/*.js"
+ ]
+}
\ No newline at end of file
diff --git a/web/app/components/base/chat/chat-with-history/hooks.tsx b/web/app/components/base/chat/chat-with-history/hooks.tsx
index 13594a84e8d..0e8da0d26d4 100644
--- a/web/app/components/base/chat/chat-with-history/hooks.tsx
+++ b/web/app/components/base/chat/chat-with-history/hooks.tsx
@@ -215,7 +215,7 @@ export const useChatWithHistory = (installedAppInfo?: InstalledApp) => {
}
}
if (item.number) {
- const convertedNumber = Number(initInputs[item.number.variable]) ?? undefined
+ const convertedNumber = Number(initInputs[item.number.variable])
return {
...item.number,
default: convertedNumber || item.default || item.number.default,
diff --git a/web/app/components/base/chat/embedded-chatbot/hooks.tsx b/web/app/components/base/chat/embedded-chatbot/hooks.tsx
index 01fb83f235f..14a32860b9b 100644
--- a/web/app/components/base/chat/embedded-chatbot/hooks.tsx
+++ b/web/app/components/base/chat/embedded-chatbot/hooks.tsx
@@ -188,7 +188,7 @@ export const useEmbeddedChatbot = () => {
}
}
if (item.number) {
- const convertedNumber = Number(initInputs[item.number.variable]) ?? undefined
+ const convertedNumber = Number(initInputs[item.number.variable])
return {
...item.number,
default: convertedNumber || item.default || item.number.default,
diff --git a/web/app/components/workflow/nodes/list-operator/default.ts b/web/app/components/workflow/nodes/list-operator/default.ts
index e2189bb86eb..a0b5f860094 100644
--- a/web/app/components/workflow/nodes/list-operator/default.ts
+++ b/web/app/components/workflow/nodes/list-operator/default.ts
@@ -51,7 +51,7 @@ const nodeDefault: NodeDefault<ListFilterNodeType> = {
if (!errorMessages && !filter_by.conditions[0]?.comparison_operator)
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.listFilter.filterConditionComparisonOperator') })
- if (!errorMessages && !comparisonOperatorNotRequireValue(filter_by.conditions[0]?.comparison_operator) && (item_var_type === VarType.boolean ? !filter_by.conditions[0]?.value === undefined : !filter_by.conditions[0]?.value))
+ if (!errorMessages && !comparisonOperatorNotRequireValue(filter_by.conditions[0]?.comparison_operator) && (item_var_type === VarType.boolean ? filter_by.conditions[0]?.value === undefined : !filter_by.conditions[0]?.value))
errorMessages = t(`${i18nPrefix}.fieldRequired`, { field: t('workflow.nodes.listFilter.filterConditionComparisonValue') })
}