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 botframework-config #4815

Open
wants to merge 2 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
10 changes: 0 additions & 10 deletions libraries/botframework-config/eslint.config.cjs

This file was deleted.

3 changes: 1 addition & 2 deletions libraries/botframework-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
"url": "[email protected]:Microsoft/botbuilder-js.git"
},
"dependencies": {
"eslint-plugin-only-warn": "^1.1.0",
"fs-extra": "^11.2.0",
"uuid": "^10.0.0"
},
Expand All @@ -45,7 +44,7 @@
"build": "tsc -b",
"build:rollup": "yarn clean && yarn build && api-extractor run --verbose --local",
"clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo",
"lint": "eslint .",
"lint": "eslint . --config ../../eslint.config.cjs",
"postbuild": "downlevel-dts lib _ts3.4/lib --checksum",
"test": "yarn build && nyc mocha tests/",
"test:compat": "api-extractor run --verbose"
Expand Down
8 changes: 4 additions & 4 deletions libraries/botframework-config/src/botConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class BotConfiguration extends BotConfigurationBase {
}
}
throw new Error(
`Error: no bot file found in ${folder}. Choose a different location or use msbot init to create a .bot file."`
`Error: no bot file found in ${folder}. Choose a different location or use msbot init to create a .bot file."`,
);
}

Expand All @@ -94,7 +94,7 @@ export class BotConfiguration extends BotConfigurationBase {
}
}
throw new Error(
`Error: no bot file found in ${folder}. Choose a different location or use msbot init to create a .bot file."`
`Error: no bot file found in ${folder}. Choose a different location or use msbot init to create a .bot file."`,
);
}

Expand Down Expand Up @@ -330,7 +330,7 @@ export class BotConfiguration extends BotConfigurationBase {
validateSecret(secret: string): void {
if (!secret) {
throw new Error(
'You are attempting to perform an operation which needs access to the secret and --secret is missing'
'You are attempting to perform an operation which needs access to the secret and --secret is missing',
);
}

Expand All @@ -344,7 +344,7 @@ export class BotConfiguration extends BotConfigurationBase {
}
} catch {
throw new Error(
'You are attempting to perform an operation which needs access to the secret and --secret is incorrect.'
'You are attempting to perform an operation which needs access to the secret and --secret is incorrect.',
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ export class ConnectedService implements IConnectedService {
* @param source (Optional) JSON based service definition.
* @param type (Optional) type of service being defined.
*/
constructor(source: IConnectedService = {} as IConnectedService, public type?: ServiceTypes) {
constructor(
source: IConnectedService = {} as IConnectedService,
public type?: ServiceTypes,
) {
Object.assign(this, source);
if (type) {
this.type = type;
Expand Down
15 changes: 8 additions & 7 deletions libraries/botframework-config/tests/botRecipe.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@ const { BotRecipe } = require('../lib');
function assertService(newService, oldService) {
assert(
newService.type === oldService.type,
`newService.type [${newService.type}] !== oldService.type [${oldService.type}]`
`newService.type [${newService.type}] !== oldService.type [${oldService.type}]`,
);
assert(newService.id === oldService.id, `newService.id [${newService.id}] !== oldService.id [${oldService.id}]`);
assert(
newService.name === oldService.name,
`newService.name [${newService.name}] !== oldService.name [${oldService.name}]`
`newService.name [${newService.name}] !== oldService.name [${oldService.name}]`,
);
assert(
newService.url === oldService.url,
`newService.url [${newService.url}] !== oldService.url [${oldService.url}]`
`newService.url [${newService.url}] !== oldService.url [${oldService.url}]`,
);
}

describe('BotRecipe', function () {
const recipe = new BotRecipe();

it("should have a default version of '1.0'.", function () {
assert(recipe.version === '1.0', `expected version '1.0', instead received ${recipe.version}`);
});

it('should have default resources be an empty array.', function () {
assert(
Array.isArray(recipe.resources),
`expected resources to be an Array, instead it is type "${typeof recipe.resources}"`
`expected resources to be an Array, instead it is type "${typeof recipe.resources}"`,
);
assert(recipe.resources.length === 0, `initial resources should be length 0, not ${recipe.resources.length}`);
});
Expand All @@ -45,15 +46,15 @@ describe('BotRecipe', function () {

assert(
newRecipe.version === oldVersion,
`expected version ${oldVersion}, instead received ${newRecipe.version}`
`expected version ${oldVersion}, instead received ${newRecipe.version}`,
);
assert(
Array.isArray(newRecipe.resources),
`expected resources to be an Array, instead it is type "${typeof newRecipe.resources}"`
`expected resources to be an Array, instead it is type "${typeof newRecipe.resources}"`,
);
assert(
newRecipe.resources.length === oldResources.length,
`initial resources should be length ${oldResources.length}, not ${newRecipe.resources.length}`
`initial resources should be length ${oldResources.length}, not ${newRecipe.resources.length}`,
);
assertService(newRecipe.resources[0], oldEndpoint);
});
Expand Down
2 changes: 1 addition & 1 deletion libraries/botframework-config/tests/encryption.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe('EncryptionTests', function () {

assert.throws(
() => encrypt.decryptString(encrypted, encrypt.generateKey()),
new Error('error:1C800064:Provider routines::bad decrypt')
new Error('error:1C800064:Provider routines::bad decrypt'),
);
});
});
18 changes: 9 additions & 9 deletions libraries/botframework-config/tests/loadAndSave.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('LoadAndSaveTests', function () {
await assert.rejects(
bf.BotConfiguration.load(saveBotPath),
new Error(
'You are attempting to perform an operation which needs access to the secret and --secret is missing'
'You are attempting to perform an operation which needs access to the secret and --secret is missing',
),
);
}
Expand Down Expand Up @@ -158,12 +158,12 @@ describe('LoadAndSaveTests', function () {
const appInsights = config2.services[i];
assert.ok(
appInsights.instrumentationKey.includes('0000000'),
'failed to decrypt instrumentationKey'
'failed to decrypt instrumentationKey',
);
assert.equal(
appInsights.applicationId,
'00000000-0000-0000-0000-000000000007',
'failed to decrypt applicationId'
'failed to decrypt applicationId',
);
assert.equal(appInsights.apiKeys.key1, 'testKey1', 'failed to decrypt key1');
assert.equal(appInsights.apiKeys.key2, 'testKey2', 'failed to decrypt key2');
Expand All @@ -175,7 +175,7 @@ describe('LoadAndSaveTests', function () {
const storage = config2.services[i];
assert.ok(
storage.connectionString.includes('UseDevelopmentStorage'),
'failed to decrypt connectionString'
'failed to decrypt connectionString',
);
assert.equal(storage.container, 'testContainer', 'failed to decrypt container');
}
Expand All @@ -188,7 +188,7 @@ describe('LoadAndSaveTests', function () {
assert.equal(
storage.key,
'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==',
'failed to decrypt key'
'failed to decrypt key',
);
assert.equal(storage.database, 'testDatabase', 'failed to decrypt database');
assert.equal(storage.collection, 'testCollection', 'failed to decrypt collection');
Expand Down Expand Up @@ -264,12 +264,12 @@ describe('LoadAndSaveTests', function () {
const appInsights = config2.services[i];
assert.ok(
!appInsights.instrumentationKey.includes('0000000'),
'failed to encrypt instrumentationKey'
'failed to encrypt instrumentationKey',
);
assert.equal(
appInsights.applicationId,
'00000000-0000-0000-0000-000000000007',
'should not encrypt applicationId'
'should not encrypt applicationId',
);
assert.notEqual(appInsights.apiKeys.key1, 'testKey1', 'failed to encrypt key1');
assert.notEqual(appInsights.apiKeys.key2, 'testKey2', 'failed to encrypt key2');
Expand All @@ -281,7 +281,7 @@ describe('LoadAndSaveTests', function () {
const storage = config2.services[i];
assert.ok(
!storage.connectionString.includes('UseDevelopmentStorage'),
'failed to encrypt connectionString'
'failed to encrypt connectionString',
);
assert.equal(storage.container, 'testContainer', 'should not have encrypted container');
}
Expand All @@ -294,7 +294,7 @@ describe('LoadAndSaveTests', function () {
assert.notEqual(
storage.key,
'C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==',
'failed to encrypt key'
'failed to encrypt key',
);
assert.equal(storage.database, 'testDatabase', 'should not have encrypted database');
assert.equal(storage.collection, 'testCollection', 'should not have encrypted collection');
Expand Down
2 changes: 1 addition & 1 deletion libraries/botframework-config/tests/service.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Service Tests', function () {
});
assert.equal(
qnaWithQnamakerHostname.hostname,
'https://MyServiceThatDoesntNeedAppending.azurewebsites.net/qnamaker'
'https://MyServiceThatDoesntNeedAppending.azurewebsites.net/qnamaker',
);
});

Expand Down
Loading