chore: Fix lint after rebase

Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
Sebastian Malton committed 2023-06-01 11:54:24 -04:00
1 parent 69324ff555
commit 369f934159
11 files changed
+67 -46

No files matched your search

+6
View File
@@ -0,0 +1,6 @@
module.exports = {
extends: "@k8slens/eslint-config/eslint",
parserOptions: {
project: "./tsconfig.json",
},
};
+1 -1
View File
@@ -38,7 +38,7 @@
"winston": "^3.8.2"
},
"devDependencies": {
"@k8slens/eslint-config": "6.5.0-alpha.1",
"@k8slens/eslint-config": "^6.5.0",
"@k8slens/jest": "^6.5.0",
"@k8slens/react-testing-library-discovery": "^1.0.0",
"@k8slens/webpack": "^6.5.0"
+19 -19
View File
@@ -20,6 +20,25 @@ export interface Logger {
silly: LogFunction;
}
const screamingKebabCase = (str: string) => pipeline(str, kebabCase, toUpper);
const getLogFunctionFor = (
scenario: keyof Logger,
namespace: string | undefined
) => {
const prefix = namespace
? `[${screamingKebabCase(namespace.replace(/-feature$/, ""))}]: `
: "";
return (di: DiContainerForInjection): LogFunction => {
const winstonLogger = di.inject(winstonLoggerInjectable);
return (message, ...data) => {
winstonLogger[scenario](`${prefix}${message}`, ...data);
};
};
};
/** @deprecated Use specific injectionToken, eg. logErrorInjectionToken */
export const loggerInjectionToken = getInjectionToken<Logger>({
id: "logger-injection-token",
@@ -61,25 +80,6 @@ export const logSillyInjectionToken = getInjectionToken<LogFunction>({
id: "log-silly-injection-token",
});
const screamingKebabCase = (str: string) => pipeline(str, kebabCase, toUpper);
const getLogFunctionFor = (
scenario: keyof Logger,
namespace: string | undefined
) => {
const prefix = namespace
? `[${screamingKebabCase(namespace.replace(/-feature$/, ""))}]: `
: "";
return (di: DiContainerForInjection): LogFunction => {
const winstonLogger = di.inject(winstonLoggerInjectable);
return (message, ...data) => {
winstonLogger[scenario](`${prefix}${message}`, ...data);
};
};
};
export const logDebugInjectable = getInjectable({
id: "log-debug",
instantiate: (di) => getLogFunctionFor("debug", di.sourceNamespace)(di),