[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:
Paul Rastoin
2025-05-15 16:26:38 +02:00
committed by GitHub
parent c95c4383b4
commit a8423e8503
213 changed files with 453 additions and 4 deletions
@@ -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 = {