Skip to content

Commit

Permalink
Fix ESLint with --fix flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sw-joelmut committed Nov 14, 2024
1 parent 006bcf0 commit 2e33245
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 44 deletions.
10 changes: 0 additions & 10 deletions libraries/botbuilder-testing/eslint.config.cjs

This file was deleted.

5 changes: 2 additions & 3 deletions libraries/botbuilder-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,15 @@
},
"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",
"build-docs": "typedoc --theme markdown --entryPoint botbuilder --excludePrivate --includeDeclarations --ignoreCompilerErrors --module amd --out ..\\..\\doc\\botbuilder .\\lib\\index.d.ts ..\\botbuilder-core\\lib\\index.d.ts ..\\botframework-schema\\lib\\index.d.ts --hideGenerator --name \"Bot Builder SDK\" --readme none",
"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"
Expand Down
12 changes: 6 additions & 6 deletions libraries/botbuilder-testing/src/dialogTestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,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.
Expand All @@ -81,7 +81,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.
Expand All @@ -97,7 +97,7 @@ export class DialogTestClient {
targetDialog: Dialog,
initialDialogOptions?: object,
middlewares?: Middleware[],
conversationState?: ConversationState
conversationState?: ConversationState,
) {
this.conversationState = conversationState || new ConversationState(new MemoryStorage());

Expand All @@ -108,7 +108,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;
Expand Down Expand Up @@ -140,7 +140,7 @@ 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<Activity> | string): Promise<any> {
await this._testAdapter.receiveActivity(activity);
return this._testAdapter.activityBuffer.shift();
Expand All @@ -158,7 +158,7 @@ export class DialogTestClient {
private getDefaultCallback(
targetDialog: Dialog,
initialDialogOptions: object,
dialogState: StatePropertyAccessor<DialogState>
dialogState: StatePropertyAccessor<DialogState>,
): (turnContext: TurnContext) => Promise<void> {
return async (turnContext: TurnContext): Promise<void> => {
const dialogSet = new DialogSet(dialogState);
Expand Down
48 changes: 23 additions & 25 deletions libraries/botbuilder-testing/src/dialogTestLogger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ResourceResponse[]> => {
// 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<ResourceResponse[]> => {
// 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();
}
}

0 comments on commit 2e33245

Please sign in to comment.