From e33068635ff34a53aee5476afd5071912d65dcc6 Mon Sep 17 00:00:00 2001 From: CeciliaAvila Date: Mon, 28 Oct 2024 12:53:32 -0300 Subject: [PATCH] Fix issues in botbuilder-stdlib --- libraries/botbuilder-stdlib/eslint.config.cjs | 10 ---------- libraries/botbuilder-stdlib/package.json | 5 +---- libraries/botbuilder-stdlib/src/retry.ts | 2 +- libraries/botbuilder-stdlib/src/stringify.ts | 4 +--- libraries/botbuilder-stdlib/src/types.ts | 2 +- libraries/botbuilder-stdlib/tests/delay.test.js | 1 + libraries/botbuilder-stdlib/tests/stringify.test.js | 2 +- 7 files changed, 6 insertions(+), 20 deletions(-) delete mode 100644 libraries/botbuilder-stdlib/eslint.config.cjs diff --git a/libraries/botbuilder-stdlib/eslint.config.cjs b/libraries/botbuilder-stdlib/eslint.config.cjs deleted file mode 100644 index 63647b52cc..0000000000 --- a/libraries/botbuilder-stdlib/eslint.config.cjs +++ /dev/null @@ -1,10 +0,0 @@ -const onlyWarn = require("eslint-plugin-only-warn"); -const sharedConfig = require("../../eslint.config.cjs") - -module.exports = [ - ...sharedConfig, - { - plugins: { - "only-warn": onlyWarn, - }, - }]; diff --git a/libraries/botbuilder-stdlib/package.json b/libraries/botbuilder-stdlib/package.json index 0f9fe3500b..3ab4eff14b 100644 --- a/libraries/botbuilder-stdlib/package.json +++ b/libraries/botbuilder-stdlib/package.json @@ -9,9 +9,6 @@ "bugs": { "url": "https://github.com/Microsoft/botbuilder-js/issues" }, - "dependencies": { - "eslint-plugin-only-warn": "^1.1.0" - }, "repository": { "type": "git", "url": "https://github.com/Microsoft/botbuilder-js.git" @@ -20,7 +17,7 @@ "build": "tsc -b", "clean": "rimraf _ts3.4 lib tsconfig.tsbuildinfo", "depcheck": "depcheck --config ../../.depcheckrc", - "lint": "eslint .", + "lint": "eslint . --config ../../eslint.config.cjs", "postbuild": "downlevel-dts lib _ts3.4/lib", "test": "yarn build && nyc mocha --check-leaks tests" }, diff --git a/libraries/botbuilder-stdlib/src/retry.ts b/libraries/botbuilder-stdlib/src/retry.ts index 9bc9e1d060..803ed27d42 100644 --- a/libraries/botbuilder-stdlib/src/retry.ts +++ b/libraries/botbuilder-stdlib/src/retry.ts @@ -12,7 +12,7 @@ export async function retry( promise: (n: number) => Promise, maxRetries: number, - initialDelay = 500 + initialDelay = 500, ): Promise { let delay = initialDelay, n = 1, diff --git a/libraries/botbuilder-stdlib/src/stringify.ts b/libraries/botbuilder-stdlib/src/stringify.ts index 23b7e9909a..8c42d2edb4 100644 --- a/libraries/botbuilder-stdlib/src/stringify.ts +++ b/libraries/botbuilder-stdlib/src/stringify.ts @@ -1,8 +1,6 @@ // Copyright (c) Microsoft Corporation. // Licensed under the MIT License. -/* eslint-disable @typescript-eslint/no-explicit-any */ - /** * Encapsulates JSON.stringify function to detect and handle different types of errors (eg. Circular Structure). * @@ -64,7 +62,7 @@ export function stringify(value: any, replacer?: (key: string, value: any) => an const value = stringifyReplacer(replacer)(key, val); return value; }, - space + space, ); } } diff --git a/libraries/botbuilder-stdlib/src/types.ts b/libraries/botbuilder-stdlib/src/types.ts index 056a782b27..9e0f963ff9 100644 --- a/libraries/botbuilder-stdlib/src/types.ts +++ b/libraries/botbuilder-stdlib/src/types.ts @@ -11,4 +11,4 @@ export type Maybe = T | Nil; export type Newable = new (...args: A) => T; // Extends mimics Newable, but works for abstract classes as well -export type Extends = Function & { prototype: T }; // eslint-disable-line @typescript-eslint/ban-types +export type Extends = Function & { prototype: T }; // eslint-disable-line @typescript-eslint/no-unsafe-function-type diff --git a/libraries/botbuilder-stdlib/tests/delay.test.js b/libraries/botbuilder-stdlib/tests/delay.test.js index 27ebba5322..bba021902f 100644 --- a/libraries/botbuilder-stdlib/tests/delay.test.js +++ b/libraries/botbuilder-stdlib/tests/delay.test.js @@ -7,6 +7,7 @@ const { delay } = require('../'); describe('delay', function () { let sandbox; + beforeEach(function () { sandbox = sinon.createSandbox({ useFakeTimers: true }); }); diff --git a/libraries/botbuilder-stdlib/tests/stringify.test.js b/libraries/botbuilder-stdlib/tests/stringify.test.js index 0a4fa54f66..39e4d08cd2 100644 --- a/libraries/botbuilder-stdlib/tests/stringify.test.js +++ b/libraries/botbuilder-stdlib/tests/stringify.test.js @@ -99,7 +99,7 @@ describe('stringify', function () { const withoutReplacerToJSON = stringify(value); const assertWithReplacerToJSON = JSON.stringify( - _replacer.call(JSON.parse(JSON.stringify(value, replacer))) + _replacer.call(JSON.parse(JSON.stringify(value, replacer))), ); assert.ok(withReplacerToJSON.includes('"_id":":toJSON:replacer:_replacer"')); assert.strictEqual(withReplacerToJSON, assertWithReplacerToJSON);