diff --git a/.eslintrc b/.eslintrc index 641cb4f55..f2f9c58ed 100755 --- a/.eslintrc +++ b/.eslintrc @@ -41,6 +41,8 @@ "react/display-name": "off", "react/prop-types": "off", "no-explicit-any": "off", - "@typescript-eslint/no-explicit-any": "off" + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/ban-ts-comment": "off", + "@typescript-eslint/no-var-requires": "off" } } diff --git a/packages/core/client/src/schema-component/antd/form-v2/utils.tsx b/packages/core/client/src/schema-component/antd/form-v2/utils.tsx index 3a3c9bd7b..6669d7ed7 100644 --- a/packages/core/client/src/schema-component/antd/form-v2/utils.tsx +++ b/packages/core/client/src/schema-component/antd/form-v2/utils.tsx @@ -1,7 +1,8 @@ -import { last, cloneDeep } from 'lodash'; -import { conditionAnalyse } from '../../common/utils/uitls'; +import { evaluators } from '@nocobase/evaluators/client'; +import { cloneDeep, last } from 'lodash'; import { ActionType } from '../../../schema-settings/LinkageRules/type'; -import evaluators from '@nocobase/evaluators/client'; +import { conditionAnalyse } from '../../common/utils/uitls'; + export const linkageMergeAction = ({ operator, value }, field, condition, values) => { const requiredResult = field?.linkageProperty?.required || [field?.initProperty?.required || false]; const displayResult = field?.linkageProperty?.display || [field?.initProperty?.display]; diff --git a/packages/plugins/formula-field/src/client/components/Formula/Result.tsx b/packages/plugins/formula-field/src/client/components/Formula/Result.tsx index 212c1c23b..93182f8d6 100644 --- a/packages/plugins/formula-field/src/client/components/Formula/Result.tsx +++ b/packages/plugins/formula-field/src/client/components/Formula/Result.tsx @@ -1,11 +1,10 @@ -import React from 'react'; import { onFormValuesChange } from '@formily/core'; import { useFieldSchema, useFormEffects } from '@formily/react'; -import cloneDeep from 'lodash/cloneDeep'; - -import evaluators, { Evaluator } from '@nocobase/evaluators/client'; +import { Checkbox, DatePicker, InputNumber, Input as InputString, useCollection } from '@nocobase/client'; +import { Evaluator, evaluators } from '@nocobase/evaluators/client'; import { Registry, toFixedByStep } from '@nocobase/utils/client'; -import { Checkbox, DatePicker, Input as InputString, InputNumber, useCollection } from '@nocobase/client'; +import cloneDeep from 'lodash/cloneDeep'; +import React from 'react'; import { toDbType } from '../../../utils'; diff --git a/packages/plugins/formula-field/src/client/interfaces/formula.tsx b/packages/plugins/formula-field/src/client/interfaces/formula.tsx index ece5e3167..6eb7a9590 100644 --- a/packages/plugins/formula-field/src/client/interfaces/formula.tsx +++ b/packages/plugins/formula-field/src/client/interfaces/formula.tsx @@ -1,8 +1,7 @@ -import { cloneDeep } from 'lodash'; import { i18n, IField, interfacesProperties } from '@nocobase/client'; -import evaluators, { Evaluator } from '@nocobase/evaluators/client'; +import { Evaluator, evaluators } from '@nocobase/evaluators/client'; import { Registry } from '@nocobase/utils/client'; - +import { cloneDeep } from 'lodash'; import { NAMESPACE } from '../locale'; // const booleanReactions = [ diff --git a/packages/plugins/formula-field/src/server/formula-field.ts b/packages/plugins/formula-field/src/server/formula-field.ts index c948d864e..936bfac6e 100644 --- a/packages/plugins/formula-field/src/server/formula-field.ts +++ b/packages/plugins/formula-field/src/server/formula-field.ts @@ -1,8 +1,6 @@ -import { DataTypes } from 'sequelize'; - import { BaseFieldOptions, Field } from '@nocobase/database'; -import evaluators from '@nocobase/evaluators'; - +import { evaluators } from '@nocobase/evaluators'; +import { DataTypes } from 'sequelize'; import { toDbType } from '../utils'; export interface FormulaFieldOptions extends BaseFieldOptions { diff --git a/packages/plugins/workflow/src/client/components/renderEngineReference.tsx b/packages/plugins/workflow/src/client/components/renderEngineReference.tsx index 208cc7c71..d017e4c77 100644 --- a/packages/plugins/workflow/src/client/components/renderEngineReference.tsx +++ b/packages/plugins/workflow/src/client/components/renderEngineReference.tsx @@ -1,8 +1,7 @@ -import React from 'react'; import { css } from '@emotion/css'; - import { i18n } from '@nocobase/client'; -import evaluators from '@nocobase/evaluators/client'; +import { evaluators } from '@nocobase/evaluators/client'; +import React from 'react'; export const renderEngineReference = (key: string) => { const engine = evaluators.get(key); diff --git a/packages/plugins/workflow/src/client/nodes/calculation.tsx b/packages/plugins/workflow/src/client/nodes/calculation.tsx index 8e796db78..51b3e5bf7 100644 --- a/packages/plugins/workflow/src/client/nodes/calculation.tsx +++ b/packages/plugins/workflow/src/client/nodes/calculation.tsx @@ -1,19 +1,16 @@ -import React from 'react'; -import { observer } from '@formily/react'; -import { FormLayout, FormItem } from '@formily/antd'; import { css } from '@emotion/css'; -import parse from 'json-templates'; -import { useTranslation } from 'react-i18next'; +import { FormItem, FormLayout } from '@formily/antd'; +import { SchemaInitializer, SchemaInitializerItemOptions, Variable, useCollectionManager } from '@nocobase/client'; +import { Evaluator, evaluators, getOptions } from '@nocobase/evaluators/client'; import { Radio } from 'antd'; - -import { SchemaInitializer, SchemaInitializerItemOptions, useCollectionManager, Variable } from '@nocobase/client'; -import { evaluators, Evaluator, getOptions } from '@nocobase/evaluators/client'; - +import parse from 'json-templates'; +import React from 'react'; +import { useTranslation } from 'react-i18next'; import { useFlowContext } from '../FlowContext'; -import { lang, NAMESPACE } from '../locale'; -import { BaseTypeSets, useWorkflowVariableOptions } from '../variable'; import { RadioWithTooltip } from '../components/RadioWithTooltip'; import { renderEngineReference } from '../components/renderEngineReference'; +import { NAMESPACE, lang } from '../locale'; +import { BaseTypeSets, useWorkflowVariableOptions } from '../variable'; function matchDynamicExpressionCollectionField(field): boolean { const { getCollectionFields, getCollection } = useCollectionManager(); diff --git a/packages/plugins/workflow/src/client/nodes/condition.tsx b/packages/plugins/workflow/src/client/nodes/condition.tsx index 3c5bd2b7a..6e41b175c 100644 --- a/packages/plugins/workflow/src/client/nodes/condition.tsx +++ b/packages/plugins/workflow/src/client/nodes/condition.tsx @@ -1,21 +1,19 @@ -import React from 'react'; -import { css, cx } from '@emotion/css'; -import { Button, Select } from 'antd'; import { CloseCircleOutlined } from '@ant-design/icons'; -import { Trans, useTranslation } from 'react-i18next'; - -import { Registry } from '@nocobase/utils/client'; +import { css, cx } from '@emotion/css'; import { Variable, useCompile } from '@nocobase/client'; import { evaluators } from '@nocobase/evaluators/client'; - +import { Registry } from '@nocobase/utils/client'; +import { Button, Select } from 'antd'; +import React from 'react'; +import { Trans, useTranslation } from 'react-i18next'; import { NodeDefaultView } from '.'; import { Branch } from '../Branch'; import { useFlowContext } from '../FlowContext'; -import { branchBlockClass, nodeSubtreeClass } from '../style'; -import { lang, NAMESPACE } from '../locale'; -import { useWorkflowVariableOptions } from '../variable'; import { RadioWithTooltip, RadioWithTooltipOption } from '../components/RadioWithTooltip'; import { renderEngineReference } from '../components/renderEngineReference'; +import { NAMESPACE, lang } from '../locale'; +import { branchBlockClass, nodeSubtreeClass } from '../style'; +import { useWorkflowVariableOptions } from '../variable'; interface Calculator { name: string; diff --git a/packages/plugins/workflow/src/server/Processor.ts b/packages/plugins/workflow/src/server/Processor.ts index 228376709..5d30b53fa 100644 --- a/packages/plugins/workflow/src/server/Processor.ts +++ b/packages/plugins/workflow/src/server/Processor.ts @@ -1,15 +1,13 @@ -import { Transaction, Transactionable } from 'sequelize'; -import parse from 'json-templates'; - import { Model } from '@nocobase/database'; import { appendArrayColumn } from '@nocobase/evaluators'; - -import Plugin from '.'; -import ExecutionModel from './models/Execution'; -import JobModel from './models/Job'; -import FlowNodeModel from './models/FlowNode'; -import { EXECUTION_STATUS, JOB_STATUS } from './constants'; import { Logger } from '@nocobase/logger'; +import parse from 'json-templates'; +import { Transaction, Transactionable } from 'sequelize'; +import Plugin from '.'; +import { EXECUTION_STATUS, JOB_STATUS } from './constants'; +import ExecutionModel from './models/Execution'; +import FlowNodeModel from './models/FlowNode'; +import JobModel from './models/Job'; export interface ProcessorOptions extends Transactionable { plugin: Plugin; diff --git a/packages/plugins/workflow/src/server/instructions/calculation.ts b/packages/plugins/workflow/src/server/instructions/calculation.ts index d988515ef..cf6cd8b4a 100644 --- a/packages/plugins/workflow/src/server/instructions/calculation.ts +++ b/packages/plugins/workflow/src/server/instructions/calculation.ts @@ -1,11 +1,9 @@ +import { Evaluator, evaluators } from '@nocobase/evaluators'; import parse from 'json-templates'; - -import evaluators, { Evaluator } from '@nocobase/evaluators'; - +import { Instruction } from '.'; import { Processor } from '..'; import { JOB_STATUS } from '../constants'; import FlowNodeModel from '../models/FlowNode'; -import { Instruction } from '.'; interface CalculationConfig { dynamic?: boolean | string; diff --git a/packages/plugins/workflow/src/server/instructions/condition.ts b/packages/plugins/workflow/src/server/instructions/condition.ts index a7a9661dc..1f1793f48 100644 --- a/packages/plugins/workflow/src/server/instructions/condition.ts +++ b/packages/plugins/workflow/src/server/instructions/condition.ts @@ -1,10 +1,9 @@ +import { evaluators } from '@nocobase/evaluators'; import { Registry } from '@nocobase/utils'; -import evaluators from '@nocobase/evaluators'; - +import { Instruction } from '.'; import { Processor } from '..'; import { JOB_STATUS } from '../constants'; import FlowNodeModel from '../models/FlowNode'; -import { Instruction } from '.'; export const calculators = new Registry(); diff --git a/tsconfig.json b/tsconfig.json index 78f254ed0..656dcef93 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -32,6 +32,9 @@ "@nocobase/preset-*": [ "packages/presets/*/src" ], + "@nocobase/evaluators/client": [ + "packages/core/evaluators/src/client" + ], "@nocobase/utils/client": [ "packages/core/utils/src/client" ],