Skip to content

Commit

Permalink
Disnable typescript-eslint/no-explicit-any in internal code of web-api (
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch committed Nov 8, 2021
1 parent 3ab30c8 commit 8b3fb8d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/web-api/src/WebClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export interface PaginatePredicate {
(page: WebAPICallResult): boolean | undefined | void;
}

// eslint-disable-next-line @typescript-eslint/no-explicit-any
export interface PageReducer<A = any> {
(accumulator: A | undefined, page: WebAPICallResult, index: number): A;
}
Expand Down Expand Up @@ -378,6 +379,7 @@ export class WebClient extends Methods {
/**
* Low-level function to make a single API request. handles queuing, retries, and http-level errors
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private async makeRequest(url: string, body: any, headers: any = {}): Promise<AxiosResponse> {
// TODO: better input types - remove any
const task = () => this.requestQueue.add(async () => {
Expand Down Expand Up @@ -424,6 +426,7 @@ export class WebClient extends Methods {
return response;
} catch (error) {
// To make this compatible with tsd, casting here instead of `catch (error: any)`
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const e = error as any;
this.logger.warn('http request failed', e.message);
if (e.request) {
Expand All @@ -445,10 +448,12 @@ export class WebClient extends Methods {
* @param options - arguments for the Web API method
* @param headers - a mutable object representing the HTTP headers for the outgoing request
*/
// eslint-disable-next-line @typescript-eslint/no-explicit-any
private serializeApiCallOptions(options: WebAPICallOptions, headers?: any): string | Readable {
// The following operation both flattens complex objects into a JSON-encoded strings and searches the values for
// binary content
let containsBinaryData: boolean = false;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const flattened = Object.entries(options).map<[string, any] | []>(([key, value]) => {
if (value === undefined || value === null) {
return [];
Expand Down Expand Up @@ -479,6 +484,7 @@ export class WebClient extends Methods {
// https://github.com/form-data/form-data/blob/028c21e0f93c5fefa46a7bbf1ba753e4f627ab7a/lib/form_data.js#L227-L230
// formidable and the browser add a name property
// fs- and request- streams have path property
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const streamOrBuffer: any = (value as any);
if (typeof streamOrBuffer.name === 'string') {
return basename(streamOrBuffer.name);
Expand Down Expand Up @@ -508,6 +514,7 @@ export class WebClient extends Methods {
// Otherwise, a simple key-value object is returned
// eslint-disable-next-line no-param-reassign
headers['Content-Type'] = 'application/x-www-form-urlencoded';
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const initialValue: { [key: string]: any; } = {};
return qsStringify(flattened.reduce(
(accumulator, [key, value]) => {
Expand Down
1 change: 1 addition & 0 deletions packages/web-api/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export interface WebAPIHTTPError extends CodedError {
statusCode: number;
statusMessage: string;
headers: IncomingHttpHeaders;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
body?: any;
}

Expand Down
2 changes: 2 additions & 0 deletions packages/web-api/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2073,9 +2073,11 @@ export interface WorkflowsUpdateStepArguments extends WebAPICallOptions, TokenOv
step_name?: string;
inputs?: {
[name: string]: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
value: any;
skip_variable_replacement?: boolean;
variables?: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
[key: string]: any;
};
},
Expand Down

0 comments on commit 8b3fb8d

Please sign in to comment.