[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:
@ -1,5 +1,6 @@
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const sanitizeCalendarEvent = <T extends Record<string, any>>(
|
||||
event: T,
|
||||
propertiesToSanitize: (keyof T)[],
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
export const valuesStringForBatchRawQuery = (
|
||||
values: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[key: string]: any;
|
||||
}[],
|
||||
typesArray: string[] = [],
|
||||
|
||||
@ -285,5 +285,6 @@ export class CompanyWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -17,12 +17,16 @@ export class GmailFetchByBatchService {
|
||||
boundary: string,
|
||||
): Promise<{
|
||||
messageIdsByBatch: string[][];
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
batchResponses: AxiosResponse<any, any>[];
|
||||
}> {
|
||||
const batchLimit = 20;
|
||||
|
||||
let batchOffset = 0;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let batchResponses: AxiosResponse<any, any>[] = [];
|
||||
|
||||
const messageIdsByBatch: string[][] = [];
|
||||
@ -54,6 +58,8 @@ export class GmailFetchByBatchService {
|
||||
batchOffset: number,
|
||||
batchLimit: number,
|
||||
boundary: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): Promise<AxiosResponse<any, any>> {
|
||||
const queries = createQueriesFromMessageIds(messageIds);
|
||||
|
||||
@ -98,6 +104,8 @@ export class GmailFetchByBatchService {
|
||||
}
|
||||
|
||||
parseBatch(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
responseCollection: AxiosResponse<any, any>,
|
||||
): GmailMessageParsedResponse[] {
|
||||
const responseItems: GmailMessageParsedResponse[] = [];
|
||||
@ -124,6 +132,8 @@ export class GmailFetchByBatchService {
|
||||
return responseItems;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
getBatchSeparator(responseCollection: AxiosResponse<any, any>): string {
|
||||
const headers = responseCollection.headers;
|
||||
|
||||
|
||||
@ -66,6 +66,8 @@ export class GmailGetMessagesService {
|
||||
|
||||
private formatBatchResponseAsMessage(
|
||||
messageIds: string[],
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
responseCollection: AxiosResponse<any, any>,
|
||||
connectedAccount: Pick<
|
||||
ConnectedAccountWorkspaceEntity,
|
||||
|
||||
@ -8,6 +8,7 @@ import { parseGmailMessagesImportError } from 'src/modules/messaging/message-imp
|
||||
export class GmailHandleErrorService {
|
||||
constructor() {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public handleGmailMessageListFetchError(error: any): void {
|
||||
const gaxiosError = parseGaxiosError(error);
|
||||
|
||||
@ -19,6 +20,7 @@ export class GmailHandleErrorService {
|
||||
}
|
||||
|
||||
public handleGmailMessagesImportError(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
error: any,
|
||||
messageExternalId: string,
|
||||
): void {
|
||||
|
||||
@ -82,6 +82,7 @@ export class MicrosoftFetchByBatchService {
|
||||
* },
|
||||
* }
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private isTemporaryError(error: any): boolean {
|
||||
return error?.body?.includes('Unexpected token < in JSON at position');
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ export interface MicrosoftGraphBatchResponse {
|
||||
createdDateTime?: string;
|
||||
lastModifiedDateTime?: string;
|
||||
changeKey?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
categories?: any[];
|
||||
receivedDateTime?: string;
|
||||
sentDateTime?: string;
|
||||
|
||||
@ -133,6 +133,7 @@ export class MicrosoftGetMessagesService {
|
||||
return [];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return batchResponse.responses.map((response: any) => {
|
||||
if (response.status === 200) {
|
||||
return response.body;
|
||||
|
||||
@ -8,6 +8,7 @@ import { MicrosoftImportDriverException } from 'src/modules/messaging/message-im
|
||||
|
||||
@Injectable()
|
||||
export class MicrosoftHandleErrorService {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public handleMicrosoftMessageFetchError(error: any): void {
|
||||
if (!error.statusCode) {
|
||||
throw new MessageImportDriverException(
|
||||
@ -43,6 +44,7 @@ export class MicrosoftHandleErrorService {
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public throwMicrosoftBatchError(error: any): void {
|
||||
throw new MicrosoftImportDriverException(
|
||||
error.message,
|
||||
|
||||
@ -160,5 +160,6 @@ export class NoteWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -240,5 +240,6 @@ export class OpportunityWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -304,5 +304,6 @@ export class PersonWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -215,5 +215,6 @@ export class TaskWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ type TimelineActivity = Omit<ObjectRecordNonDestructiveEvent, 'properties'> & {
|
||||
linkedRecordCachedName?: string;
|
||||
linkedRecordId?: string;
|
||||
linkedObjectMetadataId?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
properties: Record<string, any>; // more relaxed conditions than for internal events
|
||||
};
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ export type CallWebhookJobData = {
|
||||
workspaceId: string;
|
||||
webhookId: string;
|
||||
eventDate: Date;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
record: any;
|
||||
updatedFields?: string[];
|
||||
secret?: string;
|
||||
|
||||
@ -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(
|
||||
|
||||
@ -358,5 +358,6 @@ export class WorkspaceMemberWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceIsNullable()
|
||||
@WorkspaceIsSystem()
|
||||
@WorkspaceFieldIndex({ indexType: IndexType.GIN })
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
searchVector: any;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user