Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: [#4684] ESLint issues in botbuilder-dialogs-adaptive #4826

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 3 additions & 8 deletions libraries/botbuilder-dialogs-adaptive/eslint.config.cjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
const onlyWarn = require("eslint-plugin-only-warn");
const sharedConfig = require("../../eslint.config.cjs")
const sharedConfig = require('../../eslint.config.cjs');

module.exports = [
...sharedConfig,
{
ignores: ["tests/choiceSet.test.js", "tests/expressionProperty.test.js"],
ignores: ['tests/choiceSet.test.js', 'tests/expressionProperty.test.js'],
},
{
plugins: {
"only-warn": onlyWarn,
},
}];
];
1 change: 0 additions & 1 deletion libraries/botbuilder-dialogs-adaptive/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"botbuilder-dialogs-declarative": "4.1.6",
"botbuilder-lg": "4.1.6",
"botframework-connector": "4.1.6",
"eslint-plugin-only-warn": "^1.1.0",
"lodash": "^4.17.21",
"node-fetch": "^2.7.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class ActionContext extends DialogContext {
parentDialogContext: DialogContext,
state: DialogState,
actions: ActionState[],
changeKey: symbol
changeKey: symbol,
) {
super(dialogs, parentDialogContext, state);
this.actions = actions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ export interface ActionScopeConfiguration extends DialogConfiguration {
*/
export class ActionScope<O extends object = {}>
extends Dialog<O>
implements DialogDependencies, ActionScopeConfiguration {
implements DialogDependencies, ActionScopeConfiguration
{
/**
* Creates a new `ActionScope` instance.
*
Expand Down Expand Up @@ -144,7 +145,7 @@ export class ActionScope<O extends object = {}>
*/
protected async onActionScopeResult(
dc: DialogContext,
actionScopeResult: ActionScopeResult
actionScopeResult: ActionScopeResult,
): Promise<DialogTurnResult> {
switch (actionScopeResult.actionScopeCommand) {
case ActionScopeCommands.GotoAction:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export interface BaseInvokeDialogConfiguration extends DialogConfiguration {
*/
export class BaseInvokeDialog<O extends object = {}>
extends Dialog<O>
implements DialogDependencies, BaseInvokeDialogConfiguration {
implements DialogDependencies, BaseInvokeDialogConfiguration
{
/**
* Initializes a new instance of the [BaseInvokeDialog](xref:botbuilder-dialogs-adaptive.BaseInvokeDialog) class.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ export class BeginSkill extends SkillDialog implements BeginSkillConfiguration {
const { conversationState, skillClient, conversationIdFactory, ...rest } = this;
return rest;
},
})
}),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export interface CancelAllDialogsBaseConfiguration extends DialogConfiguration {
*/
export class CancelAllDialogsBase<O extends object = {}>
extends Dialog<O>
implements CancelAllDialogsBaseConfiguration {
implements CancelAllDialogsBaseConfiguration
{
constructor();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export class ContinueConversation extends Dialog implements ContinueConversation
value: this.value?.getValue(dc.state),
},
conversationReference,
true
true,
);

const queueStorage: QueueStorage = dc.context.turnState.get(DialogTurnStateConstants.queueStorage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class ContinueConversationLater extends Dialog implements ContinueConvers
relatesTo: reference as ConversationReference,
},
reference,
true
true,
);
activity.value = this.value && this.value.getValue(dc.state);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ export interface EditActionsConfiguration extends DialogConfiguration {
*/
export class EditActions<O extends object = {}>
extends Dialog<O>
implements DialogDependencies, EditActionsConfiguration {
implements DialogDependencies, EditActionsConfiguration
{
static $kind = 'Microsoft.EditActions';

constructor();
Expand Down Expand Up @@ -120,15 +121,13 @@ export class EditActions<O extends object = {}>
}

if (dc.parent instanceof ActionContext) {
const planActions = this.actions.map(
(action: Dialog): ActionState => {
return {
dialogStack: [],
dialogId: action.id,
options: options,
};
}
);
const planActions = this.actions.map((action: Dialog): ActionState => {
return {
dialogStack: [],
dialogId: action.id,
options: options,
};
});

const changes: ActionChangeList = {
changeType: this.changeType.getValue(dc.state),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export class EditArray<O extends object = {}> extends Dialog<O> implements EditA

if (!this.itemsProperty) {
throw new Error(
`EditArray: "${this.changeType.toString()}" operation couldn't be performed because the itemsProperty wasn't specified.`
`EditArray: "${this.changeType.toString()}" operation couldn't be performed because the itemsProperty wasn't specified.`,
);
}

Expand Down Expand Up @@ -224,7 +224,7 @@ export class EditArray<O extends object = {}> extends Dialog<O> implements EditA
throw new Error(
`EditArray: "${this.changeType.toString()}" operation couldn't be performed for list "${
this.itemsProperty
}" because a value wasn't specified.`
}" because a value wasn't specified.`,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export class ForEach<O extends object = {}> extends ActionScope<O> implements Fo
*/
protected async onContinueLoop(
dc: DialogContext,
_actionScopeResult: ActionScopeResult
_actionScopeResult: ActionScopeResult,
): Promise<DialogTurnResult> {
return await this.nextItem(dc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export class ForEachPage<O extends object = {}> extends ActionScope<O> implement
*/
protected async onContinueLoop(
dc: DialogContext,
_actionScopeResult: ActionScopeResult
_actionScopeResult: ActionScopeResult,
): Promise<DialogTurnResult> {
return await this.nextPage(dc);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ export interface GetConversationMembersConfiguration extends DialogConfiguration
*/
export class GetConversationMembers<O extends object = {}>
extends Dialog<O>
implements GetConversationMembersConfiguration {
implements GetConversationMembersConfiguration
{
static $kind = 'Microsoft.GetConversationMembers';

constructor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
* Licensed under the MIT License.
*/
import { StatusCodes } from 'botbuilder-core';
import fetch, { FetchError } from 'node-fetch';
import fetch, { FetchError, Response, Headers } from 'node-fetch';
import { Activity } from 'botbuilder';
import { BoolProperty, EnumProperty, StringProperty, UnknownProperty } from '../properties';
import { Response, Headers } from 'node-fetch';
import { evaluateExpression } from '../jsonExtensions';

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ export interface IfConditionConfiguration extends DialogConfiguration {
*/
export class IfCondition<O extends object = {}>
extends Dialog<O>
implements DialogDependencies, IfConditionConfiguration {
implements DialogDependencies, IfConditionConfiguration
{
static $kind = 'Microsoft.IfCondition';

constructor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export class SendActivity<O extends object = {}> extends Dialog<O> implements Se
{
utterance: dc.context.activity.text || '',
},
options
options,
);

const activityResult = await this.activity.bind(dc, data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class SetProperties<O extends object = {}> extends Dialog<O> implements S
protected onComputeId(): string {
return `SetProperties[${StringUtils.ellipsis(
this.assignments.map((item): string => item.property.toString()).join(','),
50
50,
)}]`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type CaseInput = {
class CasesConverter implements Converter<Array<CaseInput | Case>, Case[]> {
convert(items: Array<CaseInput | Case>): Case[] {
return items.map(
(item: CaseInput | Case): Case => (item instanceof Case ? item : new Case(item.value, item.actions))
(item: CaseInput | Case): Case => (item instanceof Case ? item : new Case(item.value, item.actions)),
);
}
}
Expand All @@ -59,7 +59,8 @@ export interface SwitchConditionConfiguration extends DialogConfiguration {
*/
export class SwitchCondition<O extends object = {}>
extends Dialog<O>
implements DialogDependencies, SwitchConditionConfiguration {
implements DialogDependencies, SwitchConditionConfiguration
{
static $kind = 'Microsoft.SwitchCondition';

constructor();
Expand Down Expand Up @@ -176,8 +177,8 @@ export class SwitchCondition<O extends object = {}>
caseScope.value,
Expression.orExpression(
Expression.equalsExpression(this.condition, new Constant(intVal)),
Expression.equalsExpression(this.condition, new Constant(caseScope.value))
)
Expression.equalsExpression(this.condition, new Constant(caseScope.value)),
),
);
continue;
}
Expand All @@ -188,8 +189,8 @@ export class SwitchCondition<O extends object = {}>
caseScope.value,
Expression.orExpression(
Expression.equalsExpression(this.condition, new Constant(floatVal)),
Expression.equalsExpression(this.condition, new Constant(caseScope.value))
)
Expression.equalsExpression(this.condition, new Constant(caseScope.value)),
),
);
continue;
}
Expand All @@ -200,8 +201,8 @@ export class SwitchCondition<O extends object = {}>
caseScope.value,
Expression.orExpression(
Expression.equalsExpression(this.condition, new Constant(true)),
Expression.equalsExpression(this.condition, new Constant(caseScope.value))
)
Expression.equalsExpression(this.condition, new Constant(caseScope.value)),
),
);
continue;
}
Expand All @@ -211,8 +212,8 @@ export class SwitchCondition<O extends object = {}>
caseScope.value,
Expression.orExpression(
Expression.equalsExpression(this.condition, new Constant(false)),
Expression.equalsExpression(this.condition, new Constant(caseScope.value))
)
Expression.equalsExpression(this.condition, new Constant(caseScope.value)),
),
);
continue;
}
Expand All @@ -221,7 +222,7 @@ export class SwitchCondition<O extends object = {}>
const { value } = new ValueExpression(caseScope.value).tryGetValue(dc.state);
this._caseExpresssions.set(
caseScope.value,
Expression.equalsExpression(this.condition, new Constant(value))
Expression.equalsExpression(this.condition, new Constant(value)),
);
}
}
Expand All @@ -234,7 +235,7 @@ export class SwitchCondition<O extends object = {}>
const { value, error } = caseCondition.tryEvaluate(dc.state);
if (error) {
throw new Error(
`Expression evaluation resulted in an error. Expression: ${caseCondition.toString()}. Error: ${error}`
`Expression evaluation resulted in an error. Expression: ${caseCondition.toString()}. Error: ${error}`,
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ export interface TelemetryTrackEventActionConfiguration extends DialogConfigurat
*/
export class TelemetryTrackEventAction<O extends object = {}>
extends Dialog
implements TelemetryTrackEventActionConfiguration {
implements TelemetryTrackEventActionConfiguration
{
static $kind = 'Microsoft.TelemetryTrackEventAction';

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export class UpdateActivity<O extends object = {}> extends Dialog<O> implements
utterance: dc.context.activity.text || '',
},
dc.state,
options
options,
);
const activityResult = await this.activity.bind(dc, data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ export class AdaptiveBotComponent extends BotComponent {
loader: new DynamicBeginDialogDeserializer(resourceExplorer, resourceId),
}));
},
}
)
},
),
);
}
}
Loading
Loading