[QRQC_2] No explicit any in twenty-server (#12068)
# Introduction Added a no-explicit-any rule to the twenty-server, not applicable to tests and integration tests folder Related to https://github.com/twentyhq/core-team-issues/issues/975 Discussed with Charles ## In case of conflicts Until this is approved I won't rebased and handle conflict, just need to drop two latest commits and re run the scripts etc ## Legacy We decided not to handle the existing lint error occurrences and programmatically ignored them through a disable next line rule comment ## Open question We might wanna activate the [no-explicit-any](https://typescript-eslint.io/rules/no-explicit-any/) `ignoreRestArgs` for our use case ? ``` ignoreRestArgs?: boolean; ``` --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
@ -149,6 +149,7 @@ export class WorkflowRunWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
icon: 'IconHierarchy2',
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
context: Record<string, any> | null;
|
||||
|
||||
@WorkspaceField({
|
||||
|
||||
@ -5,6 +5,7 @@ export type Leaf = {
|
||||
type?: InputSchemaPropertyType;
|
||||
icon?: string;
|
||||
label?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
value: any;
|
||||
};
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ export type WorkflowCodeActionInput = {
|
||||
serverlessFunctionId: string;
|
||||
serverlessFunctionVersion: string;
|
||||
serverlessFunctionInput: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[key: string]: any;
|
||||
};
|
||||
};
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
export type FilterOperator = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
eq?: any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
ne?: any;
|
||||
gt?: number;
|
||||
gte?: number;
|
||||
@ -7,6 +9,8 @@ export type FilterOperator = {
|
||||
lte?: number;
|
||||
like?: string;
|
||||
ilike?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
in?: any[];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
is?: 'NULL' | any;
|
||||
};
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { FilterCondition } from 'src/modules/workflow/workflow-executor/workflow-actions/filter/types/filter-condition.type';
|
||||
import { FilterOperator } from 'src/modules/workflow/workflow-executor/workflow-actions/filter/types/filter-operator.type';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const applyFilter = <T extends Record<string, any>>(
|
||||
array: T[],
|
||||
filter: FilterCondition,
|
||||
@ -9,6 +10,7 @@ export const applyFilter = <T extends Record<string, any>>(
|
||||
};
|
||||
|
||||
const evaluateFilter = (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
item: Record<string, any>,
|
||||
filter: FilterCondition,
|
||||
): boolean => {
|
||||
@ -73,6 +75,7 @@ const evaluateNestedConditions = (
|
||||
}
|
||||
|
||||
return Object.entries(conditions).every(([field, nestedConditions]) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const nestedValue = (value as Record<string, any>)[field];
|
||||
|
||||
if (isOperator(nestedConditions)) {
|
||||
@ -86,6 +89,7 @@ const evaluateNestedConditions = (
|
||||
});
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const evaluateCondition = (value: any, condition: FilterOperator): boolean => {
|
||||
const [[operator, targetValue]] = Object.entries(condition);
|
||||
|
||||
@ -132,6 +136,7 @@ const evaluateCondition = (value: any, condition: FilterOperator): boolean => {
|
||||
}
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const matchesLike = (value: any, pattern: string): boolean => {
|
||||
if (typeof value !== 'string') {
|
||||
return false;
|
||||
@ -142,6 +147,7 @@ const matchesLike = (value: any, pattern: string): boolean => {
|
||||
return new RegExp(`^${regexPattern}$`).test(value);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const matchesILike = (value: any, pattern: string): boolean => {
|
||||
if (typeof value !== 'string') {
|
||||
return false;
|
||||
@ -152,6 +158,7 @@ const matchesILike = (value: any, pattern: string): boolean => {
|
||||
return new RegExp(`^${regexPattern}$`, 'i').test(value);
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const isOperator = (obj: any): boolean => {
|
||||
if (typeof obj !== 'object' || obj === null) {
|
||||
return false;
|
||||
|
||||
@ -7,6 +7,7 @@ import { WorkflowAction } from 'src/modules/workflow/workflow-executor/workflow-
|
||||
export const getPreviousStepOutput = (
|
||||
steps: WorkflowAction[],
|
||||
currentStepId: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
context: Record<string, any>,
|
||||
) => {
|
||||
const previousSteps = steps.filter((step) =>
|
||||
|
||||
@ -6,8 +6,10 @@ export type FormFieldMetadata = {
|
||||
name: string;
|
||||
label: string;
|
||||
type: WorkflowFormFieldType;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
value?: any;
|
||||
placeholder?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
settings?: Record<string, any>;
|
||||
};
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ import {
|
||||
ObjectRecordOrderBy,
|
||||
} from 'src/engine/api/graphql/workspace-query-builder/interfaces/object-record.interface';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type ObjectRecord = Record<string, any>;
|
||||
|
||||
export type WorkflowCreateRecordActionInput = {
|
||||
|
||||
@ -171,6 +171,7 @@ export class RunWorkflowJob {
|
||||
workflowRunId: string;
|
||||
currentStepId: string;
|
||||
steps: WorkflowAction[];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
context: Record<string, any>;
|
||||
}) {
|
||||
const { error, pendingEvent } =
|
||||
|
||||
@ -115,6 +115,7 @@ export class WorkflowRunWorkspaceService {
|
||||
output,
|
||||
}: {
|
||||
workflowRunId: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
context: Record<string, any>;
|
||||
output: WorkflowRunOutput;
|
||||
}) {
|
||||
@ -205,6 +206,7 @@ export class WorkflowRunWorkspaceService {
|
||||
}: {
|
||||
workflowRunId: string;
|
||||
stepOutput: StepOutput;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
context: Record<string, any>;
|
||||
}) {
|
||||
const workflowRunRepository =
|
||||
|
||||
@ -73,6 +73,7 @@ function assertVersionIsValid(workflowVersion: WorkflowVersionWorkspaceEntity) {
|
||||
|
||||
function assertTriggerSettingsAreValid(
|
||||
triggerType: WorkflowTriggerType,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
settings: any,
|
||||
) {
|
||||
switch (triggerType) {
|
||||
@ -93,6 +94,7 @@ function assertTriggerSettingsAreValid(
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
if (!settings?.type) {
|
||||
throw new WorkflowTriggerException(
|
||||
@ -191,6 +193,7 @@ function assertCronTriggerSettingsAreValid(settings: any) {
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function assertDatabaseEventTriggerSettingsAreValid(settings: any) {
|
||||
if (!settings?.eventName) {
|
||||
throw new WorkflowTriggerException(
|
||||
|
||||
Reference in New Issue
Block a user