Skip to content

Commit 7b1434f

Browse files
authored
fix: Remaining ESLint issues (#4846)
* Fix remaining ESLint issues * Fix platform specific slash
1 parent b3b1f65 commit 7b1434f

File tree

11 files changed

+50
-59
lines changed

11 files changed

+50
-59
lines changed

eslint.config.cjs

+17-1
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ const lodashPlugin = require('eslint-plugin-lodash');
1313
const mochaPlugin = require('eslint-plugin-mocha');
1414
const prettierPluginRecommended = require('eslint-plugin-prettier/recommended');
1515
const securityPlugin = require('eslint-plugin-security');
16+
const path = require('path');
1617

17-
module.exports = [
18+
module.exports = config = [
1819
// Base configurations.
1920
eslint.configs.recommended,
2021
...tseslint.configs.recommended,
@@ -193,3 +194,18 @@ module.exports = [
193194
},
194195
},
195196
];
197+
198+
// Apply only to repository tools.
199+
if (
200+
['testing', 'tools', 'tsup', 'botbuilder-vendors', 'botbuilder-repo-utils'].some((tool) =>
201+
process.cwd().includes(`${path.sep}${tool}`),
202+
)
203+
) {
204+
config.push({
205+
rules: {
206+
'security/detect-non-literal-fs-filename': 'off',
207+
'mocha/no-exports': 'off',
208+
'mocha/no-top-level-hooks': 'off',
209+
},
210+
});
211+
}

testing/bot-integration/eslint.config.cjs

-10
This file was deleted.

testing/bot-integration/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,14 @@
66
"scripts": {
77
"build": "tsc -b",
88
"clean": "rimraf lib tsconfig.tsbuildinfo",
9-
"lint": "eslint .",
9+
"lint": "eslint . --config ../../eslint.config.cjs",
1010
"test": "yarn build && mocha **/*.test.js"
1111
},
1212
"author": "Microsoft Corp.",
1313
"license": "MIT",
1414
"dependencies": {
1515
"botbuilder": "4.1.6",
16-
"botframework-connector": "4.1.6",
17-
"eslint-plugin-only-warn": "^1.1.0"
16+
"botframework-connector": "4.1.6"
1817
},
1918
"devDependencies": {
2019
"@types/express": "^4.17.21",

testing/bot-integration/src/channelServiceRoutes.test.ts

+4-6
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ describe('ChannelServiceRoutes - Integration Tests', function () {
1010
const app = express();
1111
const handler = new ChannelServiceHandler(
1212
new SimpleCredentialProvider('', ''),
13-
new AuthenticationConfiguration()
13+
new AuthenticationConfiguration(),
1414
);
1515
const routes = new ChannelServiceRoutes(handler);
1616

1717
routes.register(app);
1818

19-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2019
const bfRoutes = (app._router.stack as Array<any>).filter((layer) => {
2120
const route: express.IRoute = layer.route;
2221
if (route) {
@@ -31,13 +30,12 @@ describe('ChannelServiceRoutes - Integration Tests', function () {
3130
const app = express();
3231
const handler = new ChannelServiceHandler(
3332
new SimpleCredentialProvider('', ''),
34-
new AuthenticationConfiguration()
33+
new AuthenticationConfiguration(),
3534
);
3635
const routes = new ChannelServiceRoutes(handler);
3736

3837
routes.register(app, '/test');
3938

40-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4139
const bfRoutes = (app._router.stack as Array<any>).filter((layer) => {
4240
const route: express.IRoute = layer.route;
4341
if (route) {
@@ -52,7 +50,7 @@ describe('ChannelServiceRoutes - Integration Tests', function () {
5250
const server = createServer();
5351
const handler = new ChannelServiceHandler(
5452
new SimpleCredentialProvider('', ''),
55-
new AuthenticationConfiguration()
53+
new AuthenticationConfiguration(),
5654
);
5755
const routes = new ChannelServiceRoutes(handler);
5856

@@ -76,7 +74,7 @@ describe('ChannelServiceRoutes - Integration Tests', function () {
7674
const server = createServer();
7775
const handler = new ChannelServiceHandler(
7876
new SimpleCredentialProvider('', ''),
79-
new AuthenticationConfiguration()
77+
new AuthenticationConfiguration(),
8078
);
8179
const routes = new ChannelServiceRoutes(handler);
8280

testing/botbuilder-test-utils/eslint.config.cjs

-10
This file was deleted.

testing/botbuilder-test-utils/package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"build": "tsc -b",
99
"clean": "rimraf lib tsconfig.tsbuildinfo",
10-
"lint": "eslint ."
10+
"lint": "eslint . --config ../../eslint.config.cjs"
1111
},
1212
"peerDependencies": {
1313
"jsonwebtoken": "*",
@@ -19,7 +19,6 @@
1919
"@types/node-forge": "^1.3.11"
2020
},
2121
"dependencies": {
22-
"eslint-plugin-only-warn": "^1.1.0",
2322
"node-forge": "^1.3.1",
2423
"zod": "^3.23.8"
2524
}

testing/botbuilder-test-utils/src/jwt.ts

+12-5
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,18 @@ import { randomUUID } from 'crypto';
1313
* Registers mocha hooks for proper usage
1414
*/
1515
export function mocha(): void {
16-
before(() => nock.disableNetConnect());
17-
beforeEach(() => nock.cleanAll());
18-
after(() => nock.enableNetConnect());
19-
afterEach(() => nock.cleanAll());
16+
before(function () {
17+
nock.disableNetConnect();
18+
});
19+
beforeEach(function () {
20+
nock.cleanAll();
21+
});
22+
after(function () {
23+
nock.enableNetConnect();
24+
});
25+
afterEach(function () {
26+
nock.cleanAll();
27+
});
2028
}
2129

2230
export type Options = {
@@ -44,7 +52,6 @@ export type Result = {
4452
// encodes a forge big int as a base64 string
4553
const encodeBigInt = (bigInt: forge.jsbn.BigInteger): string =>
4654
// Note: the @types declarations for forge are wrong, `toString` does take a base.
47-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
4855
forge.util.encode64(forge.util.hexToBytes((bigInt as any).toString(16)));
4956

5057
const formatHost = (url: url.Url): string => `${url.protocol}//${url.host}`;

testing/botbuilder-test-utils/src/oauth.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,18 @@ import nock from 'nock'; // eslint-disable-line import/no-extraneous-dependencie
88
* Registers mocha hooks for proper usage
99
*/
1010
export function mocha(): void {
11-
before(() => nock.disableNetConnect());
12-
beforeEach(() => nock.cleanAll());
13-
after(() => nock.enableNetConnect());
14-
afterEach(() => nock.cleanAll());
11+
before(function () {
12+
nock.disableNetConnect();
13+
});
14+
beforeEach(function () {
15+
nock.cleanAll();
16+
});
17+
after(function () {
18+
nock.enableNetConnect();
19+
});
20+
afterEach(function () {
21+
nock.cleanAll();
22+
});
1523
}
1624

1725
export type Options = {

testing/consumer-test/eslint.config.cjs

-10
This file was deleted.

testing/consumer-test/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"private": true,
44
"version": "1.0.0",
55
"scripts": {
6-
"lint": "eslint .",
6+
"lint": "eslint . --config ../../eslint.config.cjs",
77
"test": "npm-run-all test:gen test:mocha",
88
"test:gen": "ts-node ./generateTests.ts",
99
"test:mocha": "mocha ./tests/generated/*.test.js --parallel"
@@ -36,8 +36,7 @@
3636
"botframework-config": "4.1.6",
3737
"botframework-connector": "4.1.6",
3838
"botframework-schema": "4.1.6",
39-
"botframework-streaming": "4.1.6",
40-
"eslint-plugin-only-warn": "^1.1.0"
39+
"botframework-streaming": "4.1.6"
4140
},
4241
"devDependencies": {
4342
"mocha": "^10.7.3"

yarn.lock

-5
Original file line numberDiff line numberDiff line change
@@ -8061,11 +8061,6 @@ eslint-plugin-mocha@^10.5.0:
80618061
globals "^13.24.0"
80628062
rambda "^7.4.0"
80638063

8064-
eslint-plugin-only-warn@^1.1.0:
8065-
version "1.1.0"
8066-
resolved "https://registry.yarnpkg.com/eslint-plugin-only-warn/-/eslint-plugin-only-warn-1.1.0.tgz#c6ddc37ddc4e72c121f07be565fcb7b6671fe78a"
8067-
integrity sha512-2tktqUAT+Q3hCAU0iSf4xAN1k9zOpjK5WO8104mB0rT/dGhOa09582HN5HlbxNbPRZ0THV7nLGvzugcNOSjzfA==
8068-
80698064
eslint-plugin-prettier@^5.2.1:
80708065
version "5.2.1"
80718066
resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-5.2.1.tgz#d1c8f972d8f60e414c25465c163d16f209411f95"

0 commit comments

Comments
 (0)