From 2b9b1fb7d6898bfbc29d4436e47e20e12672777e Mon Sep 17 00:00:00 2001 From: Filip Maj Date: Wed, 4 Aug 2021 15:59:38 -0400 Subject: [PATCH] Fix indentation linter warnings --- src/App.spec.ts | 20 ++++++++++---------- src/App.ts | 32 +++++++++++++++----------------- src/WorkflowStep.spec.ts | 4 ++-- src/middleware/builtin.spec.ts | 5 +---- src/middleware/builtin.ts | 6 +++--- src/receivers/ExpressReceiver.ts | 8 ++++---- src/types/actions/index.ts | 8 ++++---- src/types/events/base-events.ts | 16 ++++++++-------- src/types/options/index.ts | 4 ++-- src/types/utilities.ts | 4 +--- 10 files changed, 50 insertions(+), 57 deletions(-) diff --git a/src/App.spec.ts b/src/App.spec.ts index 708afd7a7..0789ff812 100644 --- a/src/App.spec.ts +++ b/src/App.spec.ts @@ -489,16 +489,16 @@ describe('App', () => { */ const assertOrderMiddleware = (orderDown: number, orderUp: number) => - async ({ next }: { next?: NextFn }) => { - await delay(100); - middlewareCount += 1; - assert.equal(middlewareCount, orderDown); - if (next !== undefined) { - await next(); - } - middlewareCount += 1; - assert.equal(middlewareCount, orderUp); - }; + async ({ next }: { next?: NextFn }) => { + await delay(100); + middlewareCount += 1; + assert.equal(middlewareCount, orderDown); + if (next !== undefined) { + await next(); + } + middlewareCount += 1; + assert.equal(middlewareCount, orderUp); + }; app.use(assertOrderMiddleware(1, 8)); app.message(message, assertOrderMiddleware(3, 6), assertOrderMiddleware(4, 5)); diff --git a/src/App.ts b/src/App.ts index b5d98931c..ff36ea2c5 100644 --- a/src/App.ts +++ b/src/App.ts @@ -724,19 +724,19 @@ export default class App { type === IncomingEventType.Event ? (bodyArg as SlackEventMiddlewareArgs['body']).event : type === IncomingEventType.ViewAction - ? (bodyArg as SlackViewMiddlewareArgs['body']).view - : type === IncomingEventType.Shortcut - ? (bodyArg as SlackShortcutMiddlewareArgs['body']) - : type === IncomingEventType.Action && - isBlockActionOrInteractiveMessageBody(bodyArg as SlackActionMiddlewareArgs['body']) - ? (bodyArg as SlackActionMiddlewareArgs['body']).actions[0] - : (bodyArg as ( - | Exclude< + ? (bodyArg as SlackViewMiddlewareArgs['body']).view + : type === IncomingEventType.Shortcut + ? (bodyArg as SlackShortcutMiddlewareArgs['body']) + : type === IncomingEventType.Action && + isBlockActionOrInteractiveMessageBody(bodyArg as SlackActionMiddlewareArgs['body']) + ? (bodyArg as SlackActionMiddlewareArgs['body']).actions[0] + : (bodyArg as ( + | Exclude< AnyMiddlewareArgs, SlackEventMiddlewareArgs | SlackActionMiddlewareArgs | SlackViewMiddlewareArgs - > - | SlackActionMiddlewareArgs> - )['body']), + > + | SlackActionMiddlewareArgs> + )['body']), }; // Set aliases @@ -893,12 +893,10 @@ function runAuthTestForBotToken( // TODO: warn when something needed isn't found return authorization.botUserId !== undefined && authorization.botId !== undefined ? Promise.resolve({ botUserId: authorization.botUserId, botId: authorization.botId }) - : client.auth.test({ token: authorization.botToken }).then((result) => { - return { - botUserId: result.user_id as string, - botId: result.bot_id as string, - }; - }); + : client.auth.test({ token: authorization.botToken }).then((result) => ({ + botUserId: result.user_id as string, + botId: result.bot_id as string, + })); } // the shortened type, which is supposed to be used only in this source file diff --git a/src/WorkflowStep.spec.ts b/src/WorkflowStep.spec.ts index 00a783c56..66fb968cd 100644 --- a/src/WorkflowStep.spec.ts +++ b/src/WorkflowStep.spec.ts @@ -147,8 +147,8 @@ describe('WorkflowStep', () => { it('should return true if recognized workflow step payload type', async () => { const fakeEditArgs = createFakeStepEditAction() as unknown as SlackWorkflowStepMiddlewareArgs & AllMiddlewareArgs; const fakeSaveArgs = createFakeStepSaveEvent() as unknown as SlackWorkflowStepMiddlewareArgs & AllMiddlewareArgs; - const fakeExecuteArgs = createFakeStepExecuteEvent() as unknown as SlackWorkflowStepMiddlewareArgs & - AllMiddlewareArgs; + const fakeExecuteArgs = createFakeStepExecuteEvent() as unknown as SlackWorkflowStepMiddlewareArgs + & AllMiddlewareArgs; const { isStepEvent } = await importWorkflowStep(); diff --git a/src/middleware/builtin.spec.ts b/src/middleware/builtin.spec.ts index 4c847eb1a..f0ee08580 100644 --- a/src/middleware/builtin.spec.ts +++ b/src/middleware/builtin.spec.ts @@ -748,10 +748,7 @@ interface MiddlewareCommonArgs { type MessageMiddlewareArgs = SlackEventMiddlewareArgs<'message'> & MiddlewareCommonArgs; type TokensRevokedMiddlewareArgs = SlackEventMiddlewareArgs<'tokens_revoked'> & MiddlewareCommonArgs; -type MemberJoinedOrLeftChannelMiddlewareArgs = SlackEventMiddlewareArgs< - 'member_joined_channel' | 'member_left_channel' -> & - MiddlewareCommonArgs; +type MemberJoinedOrLeftChannelMiddlewareArgs = SlackEventMiddlewareArgs<'member_joined_channel' | 'member_left_channel'> & MiddlewareCommonArgs; type CommandMiddlewareArgs = SlackCommandMiddlewareArgs & MiddlewareCommonArgs; diff --git a/src/middleware/builtin.ts b/src/middleware/builtin.ts index 3cdc44b82..dc978b08b 100644 --- a/src/middleware/builtin.ts +++ b/src/middleware/builtin.ts @@ -381,9 +381,9 @@ export function directMention(): Middleware> function isBlockPayload( payload: - | SlackActionMiddlewareArgs['payload'] - | SlackOptionsMiddlewareArgs['payload'] - | SlackViewMiddlewareArgs['payload'], + | SlackActionMiddlewareArgs['payload'] + | SlackOptionsMiddlewareArgs['payload'] + | SlackViewMiddlewareArgs['payload'], ): payload is BlockElementAction | BlockSuggestion { return (payload as BlockElementAction | BlockSuggestion).action_id !== undefined; } diff --git a/src/receivers/ExpressReceiver.ts b/src/receivers/ExpressReceiver.ts index 6a541c19a..bf5934646 100644 --- a/src/receivers/ExpressReceiver.ts +++ b/src/receivers/ExpressReceiver.ts @@ -22,10 +22,10 @@ export interface ExpressReceiverOptions { logger?: Logger; logLevel?: LogLevel; endpoints?: - | string - | { - [endpointType: string]: string; - }; + | string + | { + [endpointType: string]: string; + }; processBeforeResponse?: boolean; clientId?: string; clientSecret?: string; diff --git a/src/types/actions/index.ts b/src/types/actions/index.ts index 879969648..c33f6b41d 100644 --- a/src/types/actions/index.ts +++ b/src/types/actions/index.ts @@ -37,8 +37,8 @@ export interface SlackActionMiddlewareArgs ? ElementAction : Action extends InteractiveMessage - ? InteractiveAction - : Action; + ? InteractiveAction + : Action; action: this['payload']; body: Action; // all action types except dialog submission have a channel context @@ -54,5 +54,5 @@ export interface SlackActionMiddlewareArgs = A extends InteractiveMessage ? AckFn : A extends DialogSubmitAction - ? AckFn // message action and block actions don't accept any value in the ack response - : AckFn; + ? AckFn // message action and block actions don't accept any value in the ack response + : AckFn; diff --git a/src/types/events/base-events.ts b/src/types/events/base-events.ts index 93c0a6480..27a951c7d 100644 --- a/src/types/events/base-events.ts +++ b/src/types/events/base-events.ts @@ -689,14 +689,14 @@ export interface UserChangeEvent { image_1024?: string; team: string; fields: - | { - [key: string]: { - value: string; - alt: string; - }; - } - | [] - | null; + | { + [key: string]: { + value: string; + alt: string; + }; + } + | [] + | null; }; is_admin: boolean; is_owner: boolean; diff --git a/src/types/options/index.ts b/src/types/options/index.ts index c20cf0731..56c277fa7 100644 --- a/src/types/options/index.ts +++ b/src/types/options/index.ts @@ -145,8 +145,8 @@ export interface DialogSuggestion extends StringIndexed { type OptionsAckFn = Source extends 'block_suggestion' ? AckFn>> : Source extends 'interactive_message' - ? AckFn>> - : AckFn>>; + ? AckFn>> + : AckFn>>; export interface BlockOptions { options: Option[]; diff --git a/src/types/utilities.ts b/src/types/utilities.ts index 75900eb8e..390e64b5b 100644 --- a/src/types/utilities.ts +++ b/src/types/utilities.ts @@ -29,9 +29,7 @@ export interface SayFn { (message: string | SayArguments): Promise; } -export type RespondArguments = Pick< - ChatPostMessageArguments, - Exclude +export type RespondArguments = Pick > & { /** Response URLs can be used to send ephemeral messages or in-channel messages using this argument */ response_type?: 'in_channel' | 'ephemeral';