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

ESLint Config Migration: Fix indentation linter warnings #1033

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/App.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
32 changes: 15 additions & 17 deletions src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<BlockAction | InteractiveMessage>['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<BlockAction | InteractiveMessage>['body']).actions[0]
: (bodyArg as (
| Exclude<
AnyMiddlewareArgs,
SlackEventMiddlewareArgs | SlackActionMiddlewareArgs | SlackViewMiddlewareArgs
>
| SlackActionMiddlewareArgs<Exclude<SlackAction, BlockAction | InteractiveMessage>>
)['body']),
>
| SlackActionMiddlewareArgs<Exclude<SlackAction, BlockAction | InteractiveMessage>>
)['body']),
};

// Set aliases
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/WorkflowStep.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
5 changes: 1 addition & 4 deletions src/middleware/builtin.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions src/middleware/builtin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,9 @@ export function directMention(): Middleware<SlackEventMiddlewareArgs<'message'>>

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;
}
Expand Down
8 changes: 4 additions & 4 deletions src/receivers/ExpressReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/types/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ export interface SlackActionMiddlewareArgs<Action extends SlackAction = SlackAct
payload: Action extends BlockAction<infer ElementAction>
? ElementAction
: Action extends InteractiveMessage<infer InteractiveAction>
? InteractiveAction
: Action;
? InteractiveAction
: Action;
action: this['payload'];
body: Action;
// all action types except dialog submission have a channel context
Expand All @@ -54,5 +54,5 @@ export interface SlackActionMiddlewareArgs<Action extends SlackAction = SlackAct
type ActionAckFn<A extends SlackAction> = A extends InteractiveMessage
? AckFn<string | SayArguments>
: A extends DialogSubmitAction
? AckFn<DialogValidation> // message action and block actions don't accept any value in the ack response
: AckFn<void>;
? AckFn<DialogValidation> // message action and block actions don't accept any value in the ack response
: AckFn<void>;
16 changes: 8 additions & 8 deletions src/types/events/base-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/types/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ export interface DialogSuggestion extends StringIndexed {
type OptionsAckFn<Source extends OptionsSource> = Source extends 'block_suggestion'
? AckFn<XOR<BlockOptions, OptionGroups<BlockOptions>>>
: Source extends 'interactive_message'
? AckFn<XOR<MessageOptions, OptionGroups<MessageOptions>>>
: AckFn<XOR<DialogOptions, OptionGroups<DialogOptions>>>;
? AckFn<XOR<MessageOptions, OptionGroups<MessageOptions>>>
: AckFn<XOR<DialogOptions, OptionGroups<DialogOptions>>>;

export interface BlockOptions {
options: Option[];
Expand Down
4 changes: 1 addition & 3 deletions src/types/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ export interface SayFn {
(message: string | SayArguments): Promise<ChatPostMessageResponse>;
}

export type RespondArguments = Pick<
ChatPostMessageArguments,
Exclude<ChatPostMessageArgumentsKnownKeys, 'channel' | 'text'>
export type RespondArguments = Pick<ChatPostMessageArguments, Exclude<ChatPostMessageArgumentsKnownKeys, 'channel' | 'text'>
> & {
/** Response URLs can be used to send ephemeral messages or in-channel messages using this argument */
response_type?: 'in_channel' | 'ephemeral';
Expand Down