From 92ddb33467ae43fedb470760b20648b1fd7aeca2 Mon Sep 17 00:00:00 2001 From: Iku-turso Date: Fri, 3 Mar 2023 09:20:16 +0200 Subject: [PATCH] Fix linting Co-authored-by: Janne Savolainen Signed-off-by: Iku-turso --- ...metry-from-specific-function-calls.test.ts | 6 +- .../telemetry-decorator.injectable.ts | 69 +++++++++---------- 2 files changed, 37 insertions(+), 38 deletions(-) diff --git a/packages/core/src/features/telemetry/emit-telemetry-from-specific-function-calls.test.ts b/packages/core/src/features/telemetry/emit-telemetry-from-specific-function-calls.test.ts index ac57a7aa1e..0463e5aefc 100644 --- a/packages/core/src/features/telemetry/emit-telemetry-from-specific-function-calls.test.ts +++ b/packages/core/src/features/telemetry/emit-telemetry-from-specific-function-calls.test.ts @@ -63,14 +63,14 @@ describe("emit-telemetry-from-specific-function-calls", () => { di.register( whiteListedInjectable, whiteListedInjectableWithArgument, - nonWhiteListedInjectable + nonWhiteListedInjectable, ); }); injectedWhiteListedFunction = di.inject(whiteListedInjectable); injectedWhiteListedFunctionWithArgument = di.inject( - whiteListedInjectableWithArgument + whiteListedInjectableWithArgument, ); injectedNonWhiteListedFunction = di.inject(nonWhiteListedInjectable); @@ -135,7 +135,7 @@ describe("emit-telemetry-from-specific-function-calls", () => { injectedWhiteListedFunctionWithArgument( "irrelevant-argument", - someObservable + someObservable, ); }); diff --git a/packages/core/src/features/telemetry/renderer/telemetry-decorator.injectable.ts b/packages/core/src/features/telemetry/renderer/telemetry-decorator.injectable.ts index ea6e4c2e5d..7e2520bee5 100644 --- a/packages/core/src/features/telemetry/renderer/telemetry-decorator.injectable.ts +++ b/packages/core/src/features/telemetry/renderer/telemetry-decorator.injectable.ts @@ -14,9 +14,8 @@ import assert from "assert"; import { isFunction } from "lodash/fp"; import emitTelemetryInjectable from "./emit-telemetry.injectable"; -import telemetryWhiteListForFunctionsInjectable, { - WhiteListItem, -} from "./telemetry-white-list-for-functions.injectable"; +import type { WhiteListItem } from "./telemetry-white-list-for-functions.injectable"; +import telemetryWhiteListForFunctionsInjectable from "./telemetry-white-list-for-functions.injectable"; const telemetryDecoratorInjectable = getInjectable({ id: "telemetry-decorator", @@ -25,7 +24,7 @@ const telemetryDecoratorInjectable = getInjectable({ const emitTelemetry = diForDecorator.inject(emitTelemetryInjectable); const whiteList = diForDecorator.inject( - telemetryWhiteListForFunctionsInjectable + telemetryWhiteListForFunctionsInjectable, ); const whitleListMap = getWhitleListMap(whiteList); @@ -33,32 +32,32 @@ const telemetryDecoratorInjectable = getInjectable({ return { decorate: (instantiateToBeDecorated: any) => - (di: DiContainerForInjection, instantiationParameter: any) => { - const instance = instantiateToBeDecorated(di, instantiationParameter); + (di: DiContainerForInjection, instantiationParameter: any) => { + const instance = instantiateToBeDecorated(di, instantiationParameter); - if (isFunction(instance)) { - return (...args: any[]) => { - const currentContext = di.context.at(-1); + if (isFunction(instance)) { + return (...args: any[]) => { + const currentContext = di.context.at(-1); - assert(currentContext); + assert(currentContext); - const whiteListed = whitleListMap.get( - currentContext.injectable.id - ); + const whiteListed = whitleListMap.get( + currentContext.injectable.id, + ); - if (whiteListed) { - emitTelemetry({ - action: currentContext.injectable.id, - params: whiteListed.getParams(...args), - }); - } + if (whiteListed) { + emitTelemetry({ + action: currentContext.injectable.id, + params: whiteListed.getParams(...args), + }); + } - return instance(...args); - }; - } + return instance(...args); + }; + } - return instance; - }, + return instance; + }, }; }, @@ -73,18 +72,18 @@ const getWhitleListMap = (whiteList: WhiteListItem[]) => whiteList.map((item) => typeof item === "string" ? [ - item, - { - getParams: (...args: any[]) => undefined, - }, - ] + item, + { + getParams: () => undefined, + }, + ] : [ - item.id, - { - getParams: item.getParams, - }, - ] - ) + item.id, + { + getParams: item.getParams, + }, + ], + ), ); export default telemetryDecoratorInjectable;