Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
filmaj committed Oct 2, 2024
1 parent ffaf37a commit f829e88
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ import type {
WorkflowStepEdit,
} from './types';
import { type AllMiddlewareArgs, contextBuiltinKeys } from './types/middleware';
import { isRejected, type StringIndexed } from './types/utilities';
import { type StringIndexed, isRejected } from './types/utilities';
const packageJson = require('../package.json');

export type { ActionConstraints, OptionsConstraints, ShortcutConstraints, ViewConstraints } from './types';
Expand Down
16 changes: 4 additions & 12 deletions src/WorkflowStep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,30 +76,22 @@ export interface StepFailArguments {
/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
* version.
*/
export interface StepConfigureFn {
(params: StepConfigureArguments): Promise<ViewsOpenResponse>;
}
export type StepConfigureFn = (params: StepConfigureArguments) => Promise<ViewsOpenResponse>;

/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
* version.
*/
export interface StepUpdateFn {
(params?: StepUpdateArguments): Promise<WorkflowsUpdateStepResponse>;
}
export type StepUpdateFn = (params?: StepUpdateArguments) => Promise<WorkflowsUpdateStepResponse>;

/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
* version.
*/
export interface StepCompleteFn {
(params?: StepCompleteArguments): Promise<WorkflowsStepCompletedResponse>;
}
export type StepCompleteFn = (params?: StepCompleteArguments) => Promise<WorkflowsStepCompletedResponse>;

/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
* version.
*/
export interface StepFailFn {
(params: StepFailArguments): Promise<WorkflowsStepFailedResponse>;
}
export type StepFailFn = (params: StepFailArguments) => Promise<WorkflowsStepFailedResponse>;

/** @deprecated Steps from Apps are no longer supported and support for them will be removed in the next major bolt-js
* version.
Expand Down
4 changes: 2 additions & 2 deletions src/receivers/AwsLambdaReceiver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { ConsoleLogger, LogLevel, type Logger } from '@slack/logger';
import tsscmp from 'tsscmp';
import type App from '../App';
import { ReceiverMultipleAckError } from '../errors';
import type { StringIndexed } from '../types/utilities';
import type { Receiver, ReceiverEvent } from '../types/receiver';
import type { StringIndexed } from '../types/utilities';

export type AwsEvent = AwsEventV1 | AwsEventV2;
type AwsEventStringParameters = Record<string, string | undefined>;
Expand Down Expand Up @@ -235,7 +235,7 @@ export default class AwsLambdaReceiver implements Receiver {
if (!isAcknowledged) {
this.logger.error(
'An incoming event was not acknowledged within 3 seconds. ' +
'Ensure that the ack() argument is called in a listener.',
'Ensure that the ack() argument is called in a listener.',
);
}
}, 3001);
Expand Down
2 changes: 1 addition & 1 deletion src/types/actions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export type SlackActionMiddlewareArgs<Action extends SlackAction = SlackAction>
complete?: FunctionCompleteFn;
fail?: FunctionFailFn;
inputs?: FunctionInputs;
// TODO: remove workflow step stuff in bolt v5
// TODO: remove workflow step stuff in bolt v5
} & (Action extends Exclude<SlackAction, DialogSubmitAction | WorkflowStepEdit>
? // all action types except dialog submission and steps from apps have a channel context
// TODO: not exactly true: a block action could occur from a view. should improve this.
Expand Down
2 changes: 1 addition & 1 deletion src/types/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import type { WebClient } from '@slack/web-api';
import type { SlackActionMiddlewareArgs } from './actions';
import type { SlackCommandMiddlewareArgs } from './command';
import type { FunctionInputs, SlackEventMiddlewareArgs } from './events';
import type { StringIndexed } from './utilities';
import type { SlackOptionsMiddlewareArgs } from './options';
import type { SlackShortcutMiddlewareArgs } from './shortcuts';
import type { StringIndexed } from './utilities';
import type { SlackViewMiddlewareArgs } from './view';

// TODO: rename this to AnyListenerArgs, and all the constituent types
Expand Down
2 changes: 1 addition & 1 deletion src/types/receiver.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type App from '../App';
import type { StringIndexed } from './utilities';
import type { AckFn } from './index';
import type { StringIndexed } from './utilities';

export interface ReceiverEvent {
// Parsed HTTP request body / Socket Mode message body
Expand Down
2 changes: 1 addition & 1 deletion src/types/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { ChatPostMessageArguments, ChatPostMessageResponse } from '@slack/w
/**
* Extend this interface to build a type that is treated as an open set of properties, where each key is a string.
*/
// biome-ignore lint/suspicious/noExplicitAny: we're being quite explicit here
export type StringIndexed = Record<string, any>;

// TODO: unclear if this is helpful or just complicates further
Expand All @@ -12,7 +13,6 @@ export type StringIndexed = Record<string, any>;
export type XOR<T, U> = T | U extends Record<string, unknown> ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;

type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
/* eslint-disable @typescript-eslint/no-explicit-any */

/** Type predicate for use with `Promise.allSettled` for filtering for resolved results. */
export const isFulfilled = <T>(p: PromiseSettledResult<T>): p is PromiseFulfilledResult<T> => p.status === 'fulfilled';
Expand Down

0 comments on commit f829e88

Please sign in to comment.