Skip to content

Commit

Permalink
Fix eslint issues in botbuilder-lg (#4803)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceciliaavila authored Dec 9, 2024
1 parent 925a2c6 commit 64a10b1
Show file tree
Hide file tree
Showing 19 changed files with 512 additions and 497 deletions.
11 changes: 3 additions & 8 deletions libraries/botbuilder-lg/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: ["**/generated/*"],
ignores: ['**/generated/*'],
},
{
plugins: {
"only-warn": onlyWarn,
},
}];
];
1 change: 0 additions & 1 deletion libraries/botbuilder-lg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"dependencies": {
"adaptive-expressions": "4.1.6",
"antlr4ts": "0.5.0-alpha.4",
"eslint-plugin-only-warn": "^1.1.0",
"lodash": "^4.17.19",
"uuid": "^10.0.0"
},
Expand Down
8 changes: 4 additions & 4 deletions libraries/botbuilder-lg/src/analyzer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable security/detect-object-injection */
/**
* @module botbuilder-lg
*/
Expand All @@ -16,7 +15,7 @@ import { LGTemplateParserVisitor } from './generated/LGTemplateParserVisitor';
import { Template } from './template';
import { TemplateExtensions } from './templateExtensions';
import { Templates } from './templates';
import keyBy = require('lodash/keyBy');
import keyBy from 'lodash/keyBy';

import {
IfConditionRuleContext,
Expand All @@ -37,7 +36,8 @@ import { TemplateErrors } from './templateErrors';
*/
export class Analyzer
extends AbstractParseTreeVisitor<AnalyzerResult>
implements LGTemplateParserVisitor<AnalyzerResult> {
implements LGTemplateParserVisitor<AnalyzerResult>
{
/**
* Templates.
*/
Expand Down Expand Up @@ -85,7 +85,7 @@ export class Analyzer
throw new Error(
`${TemplateErrors.loopDetected} ${this.evalutationTargetStack
.reverse()
.map((e) => e.templateName)} => ${templateName}`
.map((e) => e.templateName)} => ${templateName}`,
);
}
}
Expand Down
1 change: 0 additions & 1 deletion libraries/botbuilder-lg/src/customizedMemory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ export class CustomizedMemory implements MemoryInterface {
* @param _path Memory path.
* @param _value Value to set.
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
setValue(_path: string, _value: any): void {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder-lg/src/diagnostic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export class Diagnostic {
message: string,
severity: DiagnosticSeverity = DiagnosticSeverity.Error,
source?: string,
code?: string
code?: string,
) {
this.message = message;
this.range = range;
Expand Down
7 changes: 3 additions & 4 deletions libraries/botbuilder-lg/src/errorListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,21 @@ export class ErrorListener implements ANTLRErrorListener<void> {
offendingSymbol: any,
line: number,
charPositionInLine: number,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
msg: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
e: RecognitionException | undefined
e: RecognitionException | undefined,
): void {
const startPosition: Position = new Position(this.lineOffset + line, charPositionInLine);
const stopPosition: Position = new Position(
this.lineOffset + line,
charPositionInLine + offendingSymbol.stopIndex - offendingSymbol.startIndex + 1
charPositionInLine + offendingSymbol.stopIndex - offendingSymbol.startIndex + 1,
);
const range: Range = new Range(startPosition, stopPosition);
const diagnostic: Diagnostic = new Diagnostic(
range,
TemplateErrors.syntaxError(msg),
DiagnosticSeverity.Error,
this.source
this.source,
);

throw new TemplateException(diagnostic.toString(), [diagnostic]);
Expand Down
1 change: 0 additions & 1 deletion libraries/botbuilder-lg/src/evaluationOptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable security/detect-object-injection */
/**
* @module botbuilder-lg
*/
Expand Down
Loading

0 comments on commit 64a10b1

Please sign in to comment.