Skip to content

Commit

Permalink
Fix ESLint issues 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 2bdedaa commit 728fca6
Show file tree
Hide file tree
Showing 42 changed files with 60 additions and 51 deletions.
10 changes: 0 additions & 10 deletions libraries/botbuilder-dialogs-adaptive-testing/eslint.config.cjs

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/botbuilder-dialogs-adaptive-testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "tsc -b",
"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": "npm-run-all build test:mocha",
"test:mocha": "mocha tests/*.test.js",
Expand All @@ -32,7 +32,6 @@
"botbuilder-dialogs-adaptive-runtime-core": "4.1.6",
"botbuilder-dialogs-declarative": "4.1.6",
"botbuilder-stdlib": "4.1.6",
"eslint-plugin-only-warn": "^1.1.0",
"murmurhash-js": "^1.0.0",
"nock": "^13.5.5",
"url-parse": "^1.5.10",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export class AssertCondition<O extends object = {}> extends Dialog<O> implements
*
* @param property Properties that extend RecognizerConfiguration.
* @returns Expression converter.
*
*/
getConverter(property: keyof AssertConditionConfiguration): Converter | ConverterFactory {
switch (property) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class AdaptiveTestBotComponent extends BotComponent {
{ kind: AssertTelemetryContains.$kind, type: AssertTelemetryContains },
];
},
})
}),
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class MockHttpRequestMiddleware implements Middleware {
const origins = new Set<string>(
this._httpRequestMocks
.filter((mock) => mock instanceof HttpRequestSequenceMock)
.map((mock: HttpRequestSequenceMock) => parse(mock.url).origin)
.map((mock: HttpRequestSequenceMock) => parse(mock.url).origin),
);

// call fallback functions if mocks not catched
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function flattenSettings(settings: Record<string, any>): Record<string, string>
*/
export function useMockLuisSettings(
directory: string,
endpoint = 'https://westus.api.cognitive.microsoft.com'
endpoint = 'https://westus.api.cognitive.microsoft.com',
): Record<string, string> {
const files = fs.readdirSync(directory);
const settings = files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export class MockLuisLoader implements CustomDeserializer<MockLuisRecognizer, Lu
* @param {ResourceExplorer} _resourceExplorer ResourceExplorer to use.
* @param {Record<string, string>} _configuration Configuration to use.
*/
constructor(private _resourceExplorer: ResourceExplorer, private _configuration?: Record<string, string>) {}
constructor(
private _resourceExplorer: ResourceExplorer,
private _configuration?: Record<string, string>,
) {}

/**
* @param config Config to recognize intents and entities in a users utterance.
Expand All @@ -36,7 +39,7 @@ export class MockLuisLoader implements CustomDeserializer<MockLuisRecognizer, Lu
const externalEntityRecognizer = config.externalEntityRecognizer;
if (typeof externalEntityRecognizer === 'string') {
recognizer.externalEntityRecognizer = this._resourceExplorer.loadType<Recognizer>(
`${externalEntityRecognizer}.dialog`
`${externalEntityRecognizer}.dialog`,
);
}
let name = recognizer.applicationId.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class MockLuisRecognizer extends Recognizer {
dialogContext: DialogContext,
activity: Activity,
telemetryProperties?: Record<string, string>,
telemetryMetrics?: Record<string, number>
telemetryMetrics?: Record<string, number>,
): Promise<RecognizerResult> {
const options = this._recognizer.recognizerOptions(dialogContext);
options.includeAPIResults = true;
Expand Down Expand Up @@ -164,7 +164,7 @@ export class MockLuisRecognizer extends Recognizer {
private async _fallback(
_request: HttpRequestMessage,
utterance: string,
options: LuisRecognizerOptionsV3
options: LuisRecognizerOptionsV3,
): Promise<HttpResponseMessage> {
const responsePath: string = this._responsePath(utterance, options);
if (fs.existsSync(responsePath)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export abstract class TestAction extends Configurable {
abstract execute(
adapter: TestAdapter,
callback: (context: TurnContext) => Promise<void>,
inspector?: Inspector
inspector?: Inspector,
): void;
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class AssertNoActivity extends TestAction implements AssertNoActivityConf
async execute(
adapter: TestAdapter,
_callback: (context: TurnContext) => Promise<void>,
_inspector?: Inspector
_inspector?: Inspector,
): Promise<void> {
if (adapter.activeQueue.length > 0) {
throw new Error(this.getConditionDescription());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export class AssertReply extends AssertReplyActivity implements AssertReplyConfi
if (this.exact) {
if (activity.type == ActivityTypes.Message && activity.text != this.text) {
throw new Error(
this.description || `Text ${activity.text} didn't match expected text: ${this.text}`
this.description || `Text ${activity.text} didn't match expected text: ${this.text}`,
);
}
} else {
Expand All @@ -58,7 +58,7 @@ export class AssertReply extends AssertReplyActivity implements AssertReplyConfi
!activity.text.toLowerCase().trim().includes(this.text.toLowerCase().trim())
) {
throw new Error(
this.description || `Text ${activity.text} didn't match expected text: ${this.text}`
this.description || `Text ${activity.text} didn't match expected text: ${this.text}`,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ export class AssertReplyActivity extends TestAction implements AssertReplyActivi
async execute(
testAdapter: TestAdapter,
_callback: (context: TurnContext) => Promise<any>,
_inspector?: Inspector
_inspector?: Inspector,
): Promise<any> {
const start = new Date();
/* eslint-disable no-constant-condition */

while (true) {
const current = new Date();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class AssertReplyOneOf extends AssertReplyActivity implements AssertReply

if (!found) {
throw new Error(
this.description || `Text ${activity.text} didn't match one of expected text: ${this.text.join('\n')}`
this.description || `Text ${activity.text} didn't match one of expected text: ${this.text.join('\n')}`,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class AssertTelemetryContains extends TestAction implements AssertTelemet
async execute(
_adapter: TestAdapter,
_callback: (context: TurnContext) => Promise<void>,
inspector?: Inspector
inspector?: Inspector,
): Promise<void> {
if (inspector) {
await inspector((dc) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class CustomEvent<T = unknown> extends TestAction implements CustomEventC
async execute(
testAdapter: TestAdapter,
callback: (context: TurnContext) => Promise<void>,
_inspector?: Inspector
_inspector?: Inspector,
): Promise<void> {
if (!this.name) {
throw Error('You must define the event name.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class MemoryAssertions extends TestAction implements MemoryAssertionsConf
async execute(
_adapter: TestAdapter,
_callback: (context: TurnContext) => Promise<void>,
inspector?: Inspector
inspector?: Inspector,
): Promise<void> {
if (inspector) {
await inspector((dc) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export class SetProperties extends TestAction {
async execute(
_adapter: TestAdapter,
_callback: (context: TurnContext) => Promise<void>,
inspector?: Inspector
inspector?: Inspector,
): Promise<void> {
if (inspector) {
await inspector((dc) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class UserActivity extends TestAction implements UserActivityConfiguratio
async execute(
testAdapter: TestAdapter,
callback: (context: TurnContext) => Promise<void>,
_inspector?: Inspector
_inspector?: Inspector,
): Promise<void> {
if (!this.activity) {
throw new Error('You must define one of Text of Activity properties');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class UserConversationUpdate extends TestAction implements UserConversati
async execute(
testAdapter: TestAdapter,
callback: (context: TurnContext) => Promise<void>,
_inspector?: Inspector
_inspector?: Inspector,
): Promise<void> {
const activity = testAdapter.makeActivity();
activity.type = ActivityTypes.ConversationUpdate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class UserDelay extends TestAction implements UserDelayConfiguration {
async execute(
_testAdapter: TestAdapter,
_callback: (context: TurnContext) => Promise<any>,
_inspector?: Inspector
_inspector?: Inspector,
): Promise<void> {
await Promise.resolve((resolve) => setTimeout(resolve, this.timespan));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class UserSays extends TestAction implements UserSaysConfiguration {
async execute(
testAdapter: TestAdapter,
callback: (context: TurnContext) => Promise<void>,
_inspector?: Inspector
_inspector?: Inspector,
): Promise<void> {
if (!this.text) {
throw new Error('You must define the text property');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class UserTyping extends Configurable implements TestAction, UserTypingCo
async execute(
testAdapter: TestAdapter,
callback: (context: TurnContext) => Promise<any>,
_inspector?: Inspector
_inspector?: Inspector,
): Promise<any> {
const typing = testAdapter.makeActivity();
typing.type = ActivityTypes.Typing;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export class TestScript extends Configurable implements TestScriptConfiguration
const activity = TurnContext.applyConversationReference(
{ name: 'inspector', type: ActivityTypes.Event },
adapter.conversation,
true
true,
);
await adapter.processActivity(activity, async (turnContext) => await di.inspect(turnContext, inspector));
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class SetSkillBotFrameworkClientMiddleware {

describe('ActionTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('ActionTests', LanguageGenerationBotComponent);
});
Expand Down Expand Up @@ -158,7 +159,7 @@ describe('ActionTests', function () {
undefined,
undefined,
new SetSkillConversationIdFactoryBaseMiddleware(),
new SetSkillBotFrameworkClientMiddleware()
new SetSkillBotFrameworkClientMiddleware(),
);
});

Expand Down Expand Up @@ -214,7 +215,7 @@ describe('ActionTests', function () {
undefined,
undefined,
new SetSkillConversationIdFactoryBaseMiddleware(),
new SetSkillBotFrameworkClientMiddleware()
new SetSkillBotFrameworkClientMiddleware(),
);
});

Expand Down Expand Up @@ -400,8 +401,8 @@ describe('ActionTests', function () {
Object.assign({}, [
{ text: 'Joe is 52', age: 52 },
{ text: 'text', age: 11 },
])
)
]),
),
)
.reply(200, 'array');
nock('http://foo.com')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { makeResourceExplorer } = require('./utils');

describe('ActionScopeTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('ActionScopeTests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { makeResourceExplorer } = require('./utils');

describe('AdaptiveDialogTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('AdaptiveDialogTests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const { LuisAdaptiveRecognizer, LuisBotComponent } = require('botbuilder-ai');

describe('ConditionalsTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('ConditionalsTests');
});
Expand All @@ -24,7 +25,7 @@ describe('ConditionalsTests', function () {
resourceExplorer.registerType(
LuisAdaptiveRecognizer.$kind,
MockLuisRecognizer,
new MockLuisLoader(resourceExplorer, config)
new MockLuisLoader(resourceExplorer, config),
);
await TestUtils.runTestScript(resourceExplorer, 'ChooseEntity', undefined, config);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ const getDialogContext = (testName, text, locale = 'en-us') => {
from: bot,
locale,
}),
{}
{},
);
};

describe('CrossTrainedRecognizerSetTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('CrossTrainedRecognizerSetTests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { makeResourceExplorer } = require('./utils');

describe('ActionScopeTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('FunctionsTests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { makeResourceExplorer } = require('./utils');

describe('ActionScopeTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('InjectLGTests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { makeResourceExplorer } = require('./utils');

describe('LGGeneratorTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('LGGeneratorTests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { makeResourceExplorer } = require('./utils');

describe('MiscTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('MiscTests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { makeResourceExplorer } = require('./utils');

describe('MultiLanguageGeneratorTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('MultiLanguageGeneratorTests');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const createRecognizer = () =>

describe('MultiLanguageRecognizerTests', function () {
let resourceExplorer;

before(function () {
resourceExplorer = makeResourceExplorer('MultiLanguageRecognizerTests');
});
Expand All @@ -48,7 +49,7 @@ describe('MultiLanguageRecognizerTests', function () {
it('EnUsFallback_AcitivtyLocaleCasing', async function () {
await TestUtils.runTestScript(
resourceExplorer,
'MultiLanguageRecognizerTest_EnUsFallback_ActivityLocaleCasing'
'MultiLanguageRecognizerTest_EnUsFallback_ActivityLocaleCasing',
);
});

Expand Down
Loading

0 comments on commit 728fca6

Please sign in to comment.