Skip to content
This repository was archived by the owner on Jun 30, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
"devDependencies": {
"@types/i18next-node-fs-backend": "^0.0.30",
"@types/restify": "^7.2.4",
"@typescript-eslint/eslint-plugin": "^1.10.2",
"@typescript-eslint/eslint-plugin-tslint": "^1.10.2",
"@typescript-eslint/parser": "^1.10.2",
"@typescript-eslint/eslint-plugin": "^2.1.0",
"@typescript-eslint/eslint-plugin-tslint": "^2.1.0",
"@typescript-eslint/parser": "^2.1.0",
"copyfiles": "^2.1.0",
"eslint": "^5.16.0",
"mocha": "^6.1.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ export class CancelDialog extends ComponentDialog {
prompt: await this.responder.renderTemplate
(
sc.context,
<string> sc.context.activity.locale,
sc.context.activity.locale as string,
CancelResponses.responseIds.cancelPrompt
)
});
}

private async finishCancelDialog(sc: WaterfallStepContext): Promise<DialogTurnResult> {
return sc.endDialog(<boolean> sc.result);
return sc.endDialog(sc.result as boolean);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export class MainDialog extends RouterDialog {
switch (ev.name) {
case Events.timeZoneEvent: {
try {
const timezone: string = <string> ev.value;
const timezone: string = ev.value as string;
const tz: string = new Date().toLocaleString(timezone);
const timeZoneObj: {
timezone: string;
Expand All @@ -213,7 +213,7 @@ export class MainDialog extends RouterDialog {
break;
}
case Events.locationEvent: {
const location: string = <string> ev.value;
const location: string = ev.value as string;
const locationObj: {
location: string;
} = {
Expand Down Expand Up @@ -324,7 +324,7 @@ export class MainDialog extends RouterDialog {
if (!supported) {
throw new Error('OAuthPrompt.SignOutUser(): not supported by the current adapter');
} else {
adapter = <BotFrameworkAdapter> dc.context.adapter;
adapter = dc.context.adapter as BotFrameworkAdapter;
}

await dc.cancelAllDialogs();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ export class OnboardingDialog extends ComponentDialog {
prompt: await OnboardingDialog.responder.renderTemplate(
sc.context,
OnboardingResponses.responseIds.namePrompt,
<string> sc.context.activity.locale)
sc.context.activity.locale as string)
});
}

public async finishOnboardingDialog(sc: WaterfallStepContext<IOnboardingState>): Promise<DialogTurnResult> {
this.state = await this.getStateFromAccessor(sc.context);
this.state.name = <string> sc.result;
this.state.name = sc.result as string;
await this.accessor.set(sc.context, this.state);

await OnboardingDialog.responder.replyWith(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const cognitiveModels: Map<string, ICognitiveModelConfiguration> = new Map();
const cognitiveModelDictionary: { [key: string]: Object } = cognitiveModelsRaw.cognitiveModels;
const cognitiveModelMap: Map<string, Object> = new Map(Object.entries(cognitiveModelDictionary));
cognitiveModelMap.forEach((value: Object, key: string): void => {
cognitiveModels.set(key, <ICognitiveModelConfiguration> value);
cognitiveModels.set(key, value as ICognitiveModelConfiguration);
});

const botSettings: Partial<IBotSettings> = {
Expand Down Expand Up @@ -96,11 +96,11 @@ const adapterSettings: Partial<BotFrameworkAdapterSettings> = {
appPassword: botSettings.microsoftAppPassword
};

let cosmosDbStorageSettings: CosmosDbStorageSettings;
if (botSettings.cosmosDb === undefined) {
throw new Error();
}
cosmosDbStorageSettings = {

const cosmosDbStorageSettings: CosmosDbStorageSettings = {
authKey: botSettings.cosmosDb.authKey,
collectionId: botSettings.cosmosDb.collectionId,
databaseId: botSettings.cosmosDb.databaseId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export class EscalateResponses extends TemplateManager {

// Declare the responses map prompts
private static readonly responseTemplates: LanguageTemplateDictionary = new Map([
['default', <TemplateIdMap> new Map([
['default', new Map([
[
EscalateResponses.responseIds.sendPhoneMessage,
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/tslint/config
(context: TurnContext, data: any): Promise<Activity> => EscalateResponses.buildEscalateCard(context, data)
]
])]
]) as TemplateIdMap]
]);

// Initialize the responses class properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ export class TemplateManager {
const templateOutput: any = await renderer.renderTemplate(turnContext, locale, templateId, data);
if (templateOutput) {
if (typeof templateOutput === 'string' || templateOutput instanceof String) {
const def: Partial <Activity> = { type: ActivityTypes.Message, text: <string> templateOutput};
const def: Partial <Activity> = { type: ActivityTypes.Message, text: templateOutput as string};

return <Activity> def;
return def as Activity;
} else {
return <Activity>templateOutput;
return templateOutput as Activity;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"no-function-constructor-with-string-args": false,
"no-reserved-keywords": false,
"no-increment-decrement": false,
"no-unnecessary-bind": false
"no-unnecessary-bind": false,
"prefer-type-cast": false
},
"rulesDirectory": [
"tslint-microsoft-contrib"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
"@types/i18next-node-fs-backend": "^0.0.30",
"@types/node": "^10.10.1",
"@types/restify": "^7.2.4",
"@typescript-eslint/eslint-plugin": "^1.10.2",
"@typescript-eslint/eslint-plugin-tslint": "^1.10.2",
"@typescript-eslint/parser": "^1.10.2",
"@typescript-eslint/eslint-plugin": "^2.1.0",
"@typescript-eslint/eslint-plugin-tslint": "^2.1.0",
"@typescript-eslint/parser": "^2.1.0",
"copyfiles": "^2.1.0",
"eslint": "^5.16.0",
"nock": "^10.0.6",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class MainDialog extends RouterDialog {
protected async onEvent(dc: DialogContext): Promise<void> {
switch (dc.context.activity.name) {
case Events.skillBeginEvent: {
const userData: Map<string, Object> = <Map<string, Object>>dc.context.activity.value;
const userData: Map<string, Object> = dc.context.activity.value as Map<string, Object>;
if (userData === undefined) {
throw new Error('userData is not an instance of Map<string, Object>');
}
Expand Down Expand Up @@ -229,7 +229,7 @@ export class MainDialog extends RouterDialog {
throw new Error('OAuthPrompt.SignOutUser(): not supported by the current adapter');
}

const adapter: BotFrameworkAdapter = <BotFrameworkAdapter> dc.context.adapter;
const adapter: BotFrameworkAdapter = dc.context.adapter as BotFrameworkAdapter;
await dc.cancelAllDialogs();

// Sign out user
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class SkillDialogBase extends ComponentDialog {
try {
return await sc.prompt(MultiProviderAuthDialog.name, {});
} catch (err) {
await this.handleDialogExceptions(sc, <Error>err);
await this.handleDialogExceptions(sc, err as Error);

return {
status: DialogTurnStatus.cancelled,
Expand All @@ -91,7 +91,7 @@ export class SkillDialogBase extends ComponentDialog {
try {
// When the user authenticates interactively we pass on the tokens/Response event which surfaces as a JObject
// When the token is cached we get a TokenResponse object.
const providerTokenResponse: IProviderTokenResponse | undefined = <IProviderTokenResponse>sc.result;
const providerTokenResponse: IProviderTokenResponse | undefined = sc.result as IProviderTokenResponse;

if (providerTokenResponse !== undefined) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/tslint/config
Expand All @@ -102,7 +102,7 @@ export class SkillDialogBase extends ComponentDialog {

return await sc.next();
} catch (err) {
await this.handleDialogExceptions(sc, <Error>err);
await this.handleDialogExceptions(sc, err as Error);

return {
status: DialogTurnStatus.cancelled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export class SampleDialog extends SkillDialogBase {

public async greetUser(sc: WaterfallStepContext): Promise<DialogTurnResult> {
const tokens: Map<string, string> = new Map<string, string>();
tokens.set(this.nameKey, <string>sc.result);
tokens.set(this.nameKey, sc.result as string);

// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/tslint/config
const response: any = this.responseManager.getResponse(SampleResponses.haveNameMessage, tokens);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const cognitiveModels: Map<string, ICognitiveModelConfiguration> = new Map();
const cognitiveModelDictionary: { [key: string]: Object } = cognitiveModelsRaw.cognitiveModels;
const cognitiveModelMap: Map<string, Object> = new Map(Object.entries(cognitiveModelDictionary));
cognitiveModelMap.forEach((value: Object, key: string): void => {
cognitiveModels.set(key, <ICognitiveModelConfiguration> value);
cognitiveModels.set(key, value as ICognitiveModelConfiguration);
});

const botSettings: Partial<IBotSettings> = {
Expand Down Expand Up @@ -88,12 +88,11 @@ function getTelemetryClient(settings: Partial<IBotSettings>): BotTelemetryClient

const telemetryClient: BotTelemetryClient = getTelemetryClient(botSettings);

let cosmosDbStorageSettings: CosmosDbStorageSettings;
if (botSettings.cosmosDb === undefined) {
throw new Error();
}

cosmosDbStorageSettings = {
const cosmosDbStorageSettings: CosmosDbStorageSettings = {
authKey: botSettings.cosmosDb.authKey,
collectionId: botSettings.cosmosDb.collectionId,
databaseId: botSettings.cosmosDb.databaseId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import { RecognizerResult } from 'botbuilder';
export class SkillState {
public readonly token: string = '';
public luisResult: RecognizerResult | undefined;
// tslint:disable-next-line: no-empty
// eslint-disable-next-line @typescript-eslint/no-empty-function, @typescript-eslint/tslint/config
public clear(): void {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"no-function-constructor-with-string-args": false,
"no-reserved-keywords": false,
"no-increment-decrement": false,
"no-unnecessary-bind": false
"no-unnecessary-bind": false,
"prefer-type-cast": false
},
"rulesDirectory": [
"tslint-microsoft-contrib"
Expand Down
Loading