[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:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user