diff --git a/src/App-routes.spec.ts b/src/App-routes.spec.ts index adb833589..559185864 100644 --- a/src/App-routes.spec.ts +++ b/src/App-routes.spec.ts @@ -841,11 +841,11 @@ describe('App event routing', () => { const callNextMiddleware = () => - async ({ next }: { next?: NextFn }) => { - if (next) { - await next(); - } - }; + async ({ next }: { next?: NextFn }) => { + if (next) { + await next(); + } + }; const fakeMessageEvent = (receiver: FakeReceiver, message: string): Promise => receiver.sendEvent({ @@ -861,11 +861,11 @@ describe('App event routing', () => { const controlledMiddleware = (shouldCallNext: boolean) => - async ({ next }: { next?: NextFn }) => { - if (next && shouldCallNext) { - await next(); - } - }; + async ({ next }: { next?: NextFn }) => { + if (next && shouldCallNext) { + await next(); + } + }; const assertMiddlewaresCalledOnce = () => { assert(fakeMiddleware1.calledOnce); @@ -1078,7 +1078,7 @@ async function importApp( function withNoopWebClient(): Override { return { '@slack/web-api': { - WebClient: class { }, + WebClient: class {}, }, }; } diff --git a/src/WorkflowStep.ts b/src/WorkflowStep.ts index 85db8f67b..bc80a7a3e 100644 --- a/src/WorkflowStep.ts +++ b/src/WorkflowStep.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-explicit-any */ import type { WorkflowStepExecuteEvent } from '@slack/types'; import type { Block, @@ -32,15 +31,16 @@ export interface StepConfigureArguments { } export interface StepUpdateArguments { - inputs?: { - [key: string]: { + inputs?: Record< + string, + { + // biome-ignore lint/suspicious/noExplicitAny: user-defined workflow inputs could be anything value: any; skip_variable_replacement?: boolean; - variables?: { - [key: string]: any; - }; - }; - }; + // biome-ignore lint/suspicious/noExplicitAny: user-defined workflow inputs could be anything + variables?: Record; + } + >; outputs?: { name: string; type: string; @@ -51,9 +51,8 @@ export interface StepUpdateArguments { } export interface StepCompleteArguments { - outputs?: { - [key: string]: any; - }; + // biome-ignore lint/suspicious/noExplicitAny: user-defined workflow outputs could be anything + outputs?: Record; } export interface StepFailArguments { @@ -142,7 +141,7 @@ export class WorkflowStep { } public getMiddleware(): Middleware { - return async (args): Promise => { + return async (args): Promise => { if (isStepEvent(args) && this.matchesConstraints(args)) { return this.processEvent(args); } @@ -193,11 +192,11 @@ export function validate(callbackId: string, config: WorkflowStepConfig): void { // Check for missing required keys const requiredKeys: (keyof WorkflowStepConfig)[] = ['save', 'edit', 'execute']; const missingKeys: (keyof WorkflowStepConfig)[] = []; - requiredKeys.forEach((key) => { + for (const key of requiredKeys) { if (config[key] === undefined) { missingKeys.push(key); } - }); + } if (missingKeys.length > 0) { const errorMsg = `WorkflowStep is missing required keys: ${missingKeys.join(', ')}`; @@ -206,12 +205,12 @@ export function validate(callbackId: string, config: WorkflowStepConfig): void { // Ensure a callback or an array of callbacks is present const requiredFns: (keyof WorkflowStepConfig)[] = ['save', 'edit', 'execute']; - requiredFns.forEach((fn) => { + for (const fn of requiredFns) { if (typeof config[fn] !== 'function' && !Array.isArray(config[fn])) { const errorMsg = `WorkflowStep ${fn} property must be a function or an array of functions`; throw new WorkflowStepInitializationError(errorMsg); } - }); + } } /** @@ -341,8 +340,9 @@ function createStepFail(args: AllWorkflowStepMiddlewareArgs