Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable typescript-eslint/no-explicit-any in internal code of web-api #1374

Merged
merged 1 commit into from Nov 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions packages/web-api/src/WebClient.ts
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
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
Expand Up @@ -2075,9 +2075,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