Skip to content

Commit

Permalink
fix(lint): disable no-any warning certain types
Browse files Browse the repository at this point in the history
  • Loading branch information
atticusofsparta committed Feb 13, 2024
1 parent e4bbc6e commit de5f108
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .releaserc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"prerelease": true
}
],
"repositoryUrl": "https://github.com/ardriveapp/node-sdk-template",
"repositoryUrl": "https://github.com/ar-io/ar-io-sdk",
"debug": "false",
"plugins": [
"@semantic-release/commit-analyzer",
Expand Down
6 changes: 4 additions & 2 deletions src/common/ArIo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ export class ArIo implements ContractStateProvider {
retryDelay: axiosRetry.exponentialDelay,
retryCondition: (error) => {
this.logger.debug(`Retrying request: ${error.message}`);
return RESPONSE_RETRY_CODES.has(error.response!.status);
return (
!!error.response && RESPONSE_RETRY_CODES.has(error.response.status)
);
},
}) as any as AxiosInstance;
}) as unknown as AxiosInstance;
}

/**
Expand Down
16 changes: 10 additions & 6 deletions src/common/ContractStateProviders/ArNSRemoteCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ export class ArNSRemoteCache implements ContractStateProvider {
retryDelay: axiosRetry.exponentialDelay,
retryCondition: (error) => {
this.logger.debug(`Retrying request. Error: ${error}`);
return RESPONSE_RETRY_CODES.has(error.response!.status);
return (
!!error.response && RESPONSE_RETRY_CODES.has(error.response.status)
);
},
}) as any as AxiosInstance;
}) as unknown as AxiosInstance;
}

async getContractState<ContractState>(
Expand All @@ -68,10 +70,12 @@ export class ArNSRemoteCache implements ContractStateProvider {
const contractLogger = this.logger.logger.child({ contractId });
contractLogger.debug(`Fetching contract state`);

const response = await this.http<any, any>(`/contract/${contractId}`).catch(
(error) =>
contractLogger.debug(`Failed to fetch contract state: ${error}`),
);
const response = await this.http<ContractState>(
`/contract/${contractId}`,
).catch((error) => {
contractLogger.debug(`Failed to fetch contract state: ${error}`);
return error;
});

if (!response) {
throw new BadRequest(
Expand Down
2 changes: 2 additions & 0 deletions src/common/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export class ArIoWinstonLogger implements ArIoLogger {
});
}

/* eslint-disable @typescript-eslint/no-explicit-any */
info(message: string, ...args: any[]) {
this.logger.info(message, ...args);
}
Expand All @@ -60,6 +61,7 @@ export class ArIoWinstonLogger implements ArIoLogger {
setLogFormat(logFormat: string) {
this.logger.format = getLogFormat(logFormat);
}
/* eslint-enable @typescript-eslint/no-explicit-any */
}

function getLogFormat(logFormat: string) {
Expand Down
3 changes: 2 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface ContractStateProvider {
*/
getContractState<T>(contractId: string): Promise<T>;
}

/* eslint-disable @typescript-eslint/no-explicit-any */
export interface ArIoLogger {
setLogLevel: (level: string) => void;
setLogFormat: (logFormat: string) => void;
Expand All @@ -30,3 +30,4 @@ export interface ArIoLogger {
error: (message: string, ...args: any[]) => void;
debug: (message: string, ...args: any[]) => void;
}
/* eslint-enable @typescript-eslint/no-explicit-any */

0 comments on commit de5f108

Please sign in to comment.