diff --git a/libraries/botbuilder-testing/eslint.config.cjs b/libraries/botbuilder-testing/eslint.config.cjs deleted file mode 100644 index 63647b52cc..0000000000 --- a/libraries/botbuilder-testing/eslint.config.cjs +++ /dev/null @@ -1,10 +0,0 @@ -const onlyWarn = require("eslint-plugin-only-warn"); -const sharedConfig = require("../../eslint.config.cjs") - -module.exports = [ - ...sharedConfig, - { - plugins: { - "only-warn": onlyWarn, - }, - }]; diff --git a/libraries/botbuilder-testing/package.json b/libraries/botbuilder-testing/package.json index 941b541e4e..e0ffc30476 100644 --- a/libraries/botbuilder-testing/package.json +++ b/libraries/botbuilder-testing/package.json @@ -28,8 +28,7 @@ }, "dependencies": { "botbuilder-core": "4.1.6", - "botbuilder-dialogs": "4.1.6", - "eslint-plugin-only-warn": "^1.1.0" + "botbuilder-dialogs": "4.1.6" }, "scripts": { "build": "tsc -b", @@ -37,7 +36,7 @@ "build:rollup": "yarn clean && yarn build && api-extractor run --verbose --local", "clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo", "depcheck": "depcheck --config ../../.depcheckrc", - "lint": "eslint .", + "lint": "eslint . --config ../../eslint.config.cjs", "postbuild": "downlevel-dts lib _ts3.4/lib --checksum", "test": "yarn build && nyc mocha tests/", "test:compat": "api-extractor run --verbose" diff --git a/libraries/botbuilder-testing/src/dialogTestClient.ts b/libraries/botbuilder-testing/src/dialogTestClient.ts index f762b5969f..17ff08f776 100644 --- a/libraries/botbuilder-testing/src/dialogTestClient.ts +++ b/libraries/botbuilder-testing/src/dialogTestClient.ts @@ -6,8 +6,6 @@ * Licensed under the MIT License. */ -/* eslint-disable @typescript-eslint/ban-types */ - import { Activity, TestAdapter, @@ -60,7 +58,7 @@ export class DialogTestClient { targetDialog: Dialog, initialDialogOptions?: unknown, middlewares?: Middleware[], - conversationState?: ConversationState + conversationState?: ConversationState, ); /** * Creates a [DialogTestClient](xref:botbuilder-testing.DialogTestClient) to test a [Dialog](xref:botbuilder-dialogs.Dialog) without having to create a full-fledged adapter. @@ -81,7 +79,7 @@ export class DialogTestClient { targetDialog: Dialog, initialDialogOptions?: unknown, middlewares?: Middleware[], - conversationState?: ConversationState + conversationState?: ConversationState, ); /** * Creates a [DialogTestClient](xref:botbuilder-testing.DialogTestClient) to test a [Dialog](xref:botbuilder-dialogs.Dialog) without having to create a full-fledged adapter. @@ -97,7 +95,7 @@ export class DialogTestClient { targetDialog: Dialog, initialDialogOptions?: object, middlewares?: Middleware[], - conversationState?: ConversationState + conversationState?: ConversationState, ) { this.conversationState = conversationState || new ConversationState(new MemoryStorage()); @@ -108,7 +106,7 @@ export class DialogTestClient { if (typeof channelOrAdapter == 'string') { const channelIdToUse: string = channelOrAdapter; this._testAdapter = new TestAdapter(this._callback, { channelId: channelIdToUse }).use( - new AutoSaveStateMiddleware(this.conversationState) + new AutoSaveStateMiddleware(this.conversationState), ); } else { const testAdapterToUse: TestAdapter = channelOrAdapter; @@ -140,7 +138,6 @@ export class DialogTestClient { * @param activity an activity potentially with text * @returns a TestFlow that can be used to assert replies etc */ - // eslint-disable-next-line @typescript-eslint/no-explicit-any async sendActivity(activity: Partial | string): Promise { await this._testAdapter.receiveActivity(activity); return this._testAdapter.activityBuffer.shift(); @@ -158,7 +155,7 @@ export class DialogTestClient { private getDefaultCallback( targetDialog: Dialog, initialDialogOptions: object, - dialogState: StatePropertyAccessor + dialogState: StatePropertyAccessor, ): (turnContext: TurnContext) => Promise { return async (turnContext: TurnContext): Promise => { const dialogSet = new DialogSet(dialogState); diff --git a/libraries/botbuilder-testing/src/dialogTestLogger.ts b/libraries/botbuilder-testing/src/dialogTestLogger.ts index 734fb2a207..e521063ace 100644 --- a/libraries/botbuilder-testing/src/dialogTestLogger.ts +++ b/libraries/botbuilder-testing/src/dialogTestLogger.ts @@ -61,32 +61,30 @@ export class DialogTestLogger implements Middleware { const timestamp = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`; this.logger.log(`-> ts: ${timestamp}`); - context.onSendActivities( - async (context, activities, next): Promise => { - // log outgoing - activities.forEach((activity) => { - if (activity.type == ActivityTypes.Message) { - this.logger.log(`Bot: Text = ${activity.text}`); - this.logger.log(` Speak = ${activity.speak}`); - this.logger.log(` InputHint = ${activity.inputHint}`); - } else { - this.logger.log(`Bot: Activity = ${activity.type}`); - JSON.stringify(activity, null, 2) - .split(/\n/) - .forEach((line) => { - this.logger.log(line); - }); - } - }); - const now = new Date(); - const stopwatch = context.turnState[this._stopwatchStateKey]; - const mms = now.getTime() - stopwatch.getTime(); - const timestamp = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`; - this.logger.log(`-> ts: ${timestamp} elapsed ${mms} ms`); + context.onSendActivities(async (context, activities, next): Promise => { + // log outgoing + activities.forEach((activity) => { + if (activity.type == ActivityTypes.Message) { + this.logger.log(`Bot: Text = ${activity.text}`); + this.logger.log(` Speak = ${activity.speak}`); + this.logger.log(` InputHint = ${activity.inputHint}`); + } else { + this.logger.log(`Bot: Activity = ${activity.type}`); + JSON.stringify(activity, null, 2) + .split(/\n/) + .forEach((line) => { + this.logger.log(line); + }); + } + }); + const now = new Date(); + const stopwatch = context.turnState[this._stopwatchStateKey]; + const mms = now.getTime() - stopwatch.getTime(); + const timestamp = `${now.getHours()}:${now.getMinutes()}:${now.getSeconds()}`; + this.logger.log(`-> ts: ${timestamp} elapsed ${mms} ms`); - return next(); - } - ); + return next(); + }); await next(); } }