From e839e8ebcc28ffa78ce303dd52d9bc1dbff77c49 Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Wed, 25 Apr 2018 17:36:53 +0200 Subject: [PATCH] fix: linting errors --- src/commands/base.ts | 2 +- src/logger/index.ts | 2 +- src/logger/util.ts | 2 +- src/plugins/kubernetes/actions.ts | 6 +++--- src/plugins/kubernetes/kubectl.ts | 3 ++- src/types/plugin.ts | 4 ++-- src/util.ts | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/commands/base.ts b/src/commands/base.ts index b0228908c2..dfd257629f 100644 --- a/src/commands/base.ts +++ b/src/commands/base.ts @@ -114,7 +114,7 @@ export class EnvironmentOption extends StringParameter { } export type Parameters = { [key: string]: Parameter } -export type ParameterValues = {[P in keyof T]: T["_valueType"]} +export type ParameterValues = { [P in keyof T]: T["_valueType"] } export abstract class Command { abstract name: string diff --git a/src/logger/index.ts b/src/logger/index.ts index 3ae4cabd8d..e4169c76f5 100644 --- a/src/logger/index.ts +++ b/src/logger/index.ts @@ -27,7 +27,7 @@ import { FancyConsoleWriter, Writer, BasicConsoleWriter } from "./writers" import { ParameterError } from "../exceptions" const ROOT_DEPTH = -1 -const DEFAULT_CONFIGS: {[key in LoggerType]: LoggerConfig} = { +const DEFAULT_CONFIGS: { [key in LoggerType]: LoggerConfig } = { [LoggerType.fancy]: { level: LogLevel.info, writers: [new FancyConsoleWriter()], diff --git a/src/logger/util.ts b/src/logger/util.ts index 38b1c0d119..b042eb9204 100644 --- a/src/logger/util.ts +++ b/src/logger/util.ts @@ -14,7 +14,7 @@ export interface Node { children: any[] } -export type LogOptsResolvers = {[K in keyof LogEntryOpts]?: Function} +export type LogOptsResolvers = { [K in keyof LogEntryOpts]?: Function } // TODO Tail call optimization? export function getNodeListFromTree(node: T): T[] { diff --git a/src/plugins/kubernetes/actions.ts b/src/plugins/kubernetes/actions.ts index 2c9f20a126..cf0af9847d 100644 --- a/src/plugins/kubernetes/actions.ts +++ b/src/plugins/kubernetes/actions.ts @@ -22,7 +22,7 @@ import { TreeVersion } from "../../vcs/base" import { ContainerModule, } from "../container" -import { values, every, map, extend } from "lodash" +import { values, every } from "lodash" import { deserializeKeys, serializeKeys, splitFirst } from "../../util" import { ServiceStatus } from "../../types/service" import { @@ -174,8 +174,8 @@ export async function testModule( // TODO: include a service context here const context = provider.config.context const baseEnv = {} - const envVars: {} = extend({}, baseEnv, testSpec.variables) - const envArgs = map(envVars, (v: string, k: string) => `--env=${k}=${v}`) + const envVars = { ...baseEnv, ...testSpec.variables } + const envArgs = Object.entries(envVars).map(([v, k]) => `--env=${k}=${v}`) // TODO: use the runModule() method const testCommandStr = testSpec.command.join(" ") diff --git a/src/plugins/kubernetes/kubectl.ts b/src/plugins/kubernetes/kubectl.ts index 8a92d6d8ab..d8a515b6ec 100644 --- a/src/plugins/kubernetes/kubectl.ts +++ b/src/plugins/kubernetes/kubectl.ts @@ -80,7 +80,8 @@ export class Kubectl { let _timeout const _reject = (msg: string) => { - const details = extend({ args, preparedArgs, msg, data: data.toString() }, out) + const dataStr = data ? data.toString() : null + const details = extend({ args, preparedArgs, msg, data: dataStr }, out) const err = new RuntimeError(`Failed running 'kubectl ${args.join(" ")}'`, details) reject(err) } diff --git a/src/types/plugin.ts b/src/types/plugin.ts index 481942dc21..054e470e0b 100644 --- a/src/types/plugin.ts +++ b/src/types/plugin.ts @@ -240,7 +240,7 @@ interface PluginActionDescription { description?: string } -const pluginActionDescriptions: {[P in PluginActionName]: PluginActionDescription } = { +const pluginActionDescriptions: { [P in PluginActionName]: PluginActionDescription } = { getEnvironmentStatus: {}, configureEnvironment: {}, destroyEnvironment: {}, @@ -250,7 +250,7 @@ const pluginActionDescriptions: {[P in PluginActionName]: PluginActionDescriptio deleteConfig: {}, } -const moduleActionDescriptions: {[P in ModuleActionName]: PluginActionDescription } = { +const moduleActionDescriptions: { [P in ModuleActionName]: PluginActionDescription } = { parseModule: {}, getModuleBuildStatus: {}, buildModule: {}, diff --git a/src/util.ts b/src/util.ts index 47a8e199c7..7ca77529a9 100644 --- a/src/util.ts +++ b/src/util.ts @@ -34,7 +34,7 @@ export type HookCallback = (callback?: () => void) => void const exitHooks: HookCallback[] = [] -export type Nullable = {[P in keyof T]: T[P] | null } +export type Nullable = { [P in keyof T]: T[P] | null } export function shutdown(code) { if (exitHooks.length > 1) {