Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions Composer/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ module.exports = {
enforceInMethodNames: true,
},
],
'prefer-arrow-callback': 'error',

// plugin: import
'import/first': 'error',
Expand Down
8 changes: 4 additions & 4 deletions Composer/packages/electron-server/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ async function main() {

mainWindow.show();

mainWindow.on('closed', function () {
mainWindow.on('closed', () => {
ElectronWindow.destroy();
});
log('Rendered application.');
Expand Down Expand Up @@ -188,23 +188,23 @@ async function run() {
});

// Quit when all windows are closed.
app.on('window-all-closed', function () {
app.on('window-all-closed', () => {
// On OS X it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (!isMac()) {
app.quit();
}
});

app.on('activate', function () {
app.on('activate', () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (!ElectronWindow.isBrowserWindowCreated) {
main();
}
});

app.on('will-finish-launching', function () {
app.on('will-finish-launching', () => {
// Protocol handler for osx
app.on('open-url', (event, url) => {
event.preventDefault();
Expand Down
2 changes: 1 addition & 1 deletion Composer/packages/lib/code-editor/src/LuEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const LuEditor: React.FC<LULSPEditorProps> = (props) => {
if (m) {
// this is the correct way to combine keycodes in Monaco
// eslint-disable-next-line no-bitwise
editor.addCommand(m.KeyMod.Shift | m.KeyCode.Enter, function () {
editor.addCommand(m.KeyMod.Shift | m.KeyCode.Enter, () => {
const position = editor.getPosition();
SendRequestWithRetry(languageClient, 'labelingExperienceRequest', { uri, position });
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ describe('copyTo', () => {
let files: string[] = [];
if (fs.existsSync(path)) {
files = fs.readdirSync(path);
files.forEach(function (file) {
files.forEach((file) => {
const curPath = path + '/' + file;
if (fs.statSync(curPath).isDirectory()) {
// recurse
Expand Down
6 changes: 3 additions & 3 deletions Composer/packages/server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export async function start(pluginDir?: string): Promise<number | string> {
'upgrade-insecure-requests;',
];

app.all('*', function (req: Request, res: Response, next: NextFunction) {
app.all('*', (req: Request, res: Response, next: NextFunction) => {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'GET,HEAD,OPTIONS,POST,PUT,DELETE');
res.header('Access-Control-Allow-Headers', 'Origin, X-Requested-With, Content-Type, Accept, Authorization');
Expand Down Expand Up @@ -103,14 +103,14 @@ export async function start(pluginDir?: string): Promise<number | string> {

// next needs to be an arg in order for express to recognize this as the error handler
// eslint-disable-next-line @typescript-eslint/no-unused-vars
app.use(function (err: Error, req: Request, res: Response, _next: NextFunction) {
app.use((err: Error, req: Request, res: Response, _next: NextFunction) => {
if (err) {
log(err);
res.status(500).json({ message: err.message });
}
});

app.get('*', function (req, res) {
app.get('*', (req, res) => {
res.render(path.resolve(clientDirectory, 'index.ejs'), { __nonce__: req.__nonce__ });
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { textFromTemplate, checkTemplate, updateTemplate } from '../../src/utils';

describe('LG LSP server util function test', () => {
it('text from template', function () {
it('text from template', () => {
const template = {
name: 'Greeting',
body: '-hi',
Expand All @@ -13,7 +13,7 @@ describe('LG LSP server util function test', () => {
expect(templateText).toContain('# Greeting');
});

it('check a valid template', function () {
it('check a valid template', () => {
const template = {
name: 'Greeting',
body: '-hi',
Expand All @@ -22,7 +22,7 @@ describe('LG LSP server util function test', () => {
expect(diags).toHaveLength(0);
});

it('check an invalid template', function () {
it('check an invalid template', () => {
const template = {
name: 'Greeting',
body: 'hi ${ ',
Expand All @@ -31,7 +31,7 @@ describe('LG LSP server util function test', () => {
expect(diags).toHaveLength(1);
});

it('update template', function () {
it('update template', () => {
const content = `
# Greeting
- hello
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ const text = `@ml location hasRoles homeaddress
@ regex zipcode = /[0-9]{5}/
@ ml mail usesFeature address
#checktemperature
-it is sunny and the temperature is
- the temperature is 35
-it is sunny and the temperature is
- the temperature is 35
- address is {address=[beijing,100080]}
`;

Expand All @@ -37,33 +37,33 @@ const luisObject = {
prebuiltEntities: [],
};

describe('LU LSP Server Function Unit Tests', function () {
it('Test Get ML Entities', function () {
describe('LU LSP Server Function Unit Tests', () => {
it('Test Get ML Entities', () => {
const result = util.getMLEntities(text);
assert.deepStrictEqual(result, ['location', 'mail']);
});

it('Test Get Composites Entities', function () {
it('Test Get Composites Entities', () => {
const result = util.getCompositesEntities(luisObject);
assert.deepStrictEqual(result, ['geoInfo']);
});

it('Test Get RegExp Entities', function () {
it('Test Get RegExp Entities', () => {
const result = util.getRegexEntities(luisObject);
assert.deepStrictEqual(result, ['zipcode']);
});

it('Test Get All Parsed Entities', function () {
it('Test Get All Parsed Entities', () => {
const result = util.getSuggestionEntities(luisObject, util.suggestionAllEntityTypes);
assert.deepStrictEqual(result, ['address', 'zipcode', 'city', 'geoInfo']);
});

it('Test Get All Parsed Roles', function () {
it('Test Get All Parsed Roles', () => {
const result = util.getSuggestionRoles(luisObject, util.suggestionAllEntityTypes);
assert.deepStrictEqual(result, ['role1', 'role2']);
});

it('Test Entity Can UsesFeature', function () {
it('Test Entity Can UsesFeature', () => {
let lineContent = '@ geoInfo usesFeature ';
let result = util.matchedEntityCanUsesFeature(lineContent, text, luisObject);
assert.equal(result, true);
Expand All @@ -81,7 +81,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Intent Can UsesFeature', function () {
it('Test Intent Can UsesFeature', () => {
let text = '@ intent mockIntent usesFeature ';
let result = util.matchIntentUsesFeatures(text);
assert.equal(result, true);
Expand All @@ -91,7 +91,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Intent In a Entity Definiton', function () {
it('Test Intent In a Entity Definiton', () => {
let text = '@ intent mockIntent';
let result = util.matchIntentInEntityDef(text);
assert.equal(result, true);
Expand All @@ -101,7 +101,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Entity Definition', function () {
it('Test Entity Definition', () => {
let text = '@ ';
let result = util.isEntityType(text);
assert.equal(result, true);
Expand All @@ -111,7 +111,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Prebuilt Entity Definition', function () {
it('Test Prebuilt Entity Definition', () => {
let text = '@ prebuilt ';
let result = util.isPrebuiltEntity(text);
assert.equal(result, true);
Expand All @@ -121,7 +121,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test RegExp Entity Definition', function () {
it('Test RegExp Entity Definition', () => {
let text = '@ regex zipcode =';
let result = util.isRegexEntity(text);
assert.equal(result, true);
Expand All @@ -131,7 +131,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Seperated Line Entity', function () {
it('Test Seperated Line Entity', () => {
let text = '@ zipcode =';
let result = util.isSeperatedEntityDef(text);
assert.equal(result, true);
Expand All @@ -141,7 +141,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Entity Name ', function () {
it('Test Entity Name ', () => {
let text = '@ ml location';
let result = util.isEntityName(text);
assert.equal(result, true);
Expand All @@ -155,7 +155,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Composite Entity ', function () {
it('Test Composite Entity ', () => {
let text = '@ composite location = [';
let result = util.isCompositeEntity(text);
assert.equal(result, true);
Expand All @@ -169,7 +169,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Entering Pattern ', function () {
it('Test Entering Pattern ', () => {
let text = '- The weather in Seattle is { ';
let result = util.matchedEnterPattern(text);
assert.equal(result, true);
Expand All @@ -183,7 +183,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Entering Roles ', function () {
it('Test Entering Roles ', () => {
let text = '- The weather in Seattle is {morning: ';
let result = util.matchedRolesPattern(text);
assert.equal(result, true);
Expand All @@ -197,7 +197,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Entering Entity ', function () {
it('Test Entering Entity ', () => {
let text = '- The weather in Seattle is {@ ';
let result = util.matchedEntityPattern(text);
assert.equal(result, true);
Expand All @@ -211,7 +211,7 @@ describe('LU LSP Server Function Unit Tests', function () {
assert.equal(result, false);
});

it('Test Remove Labeled Utterance', function () {
it('Test Remove Labeled Utterance', () => {
let text = '- this is a {type = Audio} message from {device = PC}';
let result = util.removeLabelsInUtterance(text);
assert.equal(result, '- this is a Audio message from PC');
Expand Down