From 7fadcda642b8670e6ced38c6cc86c0e30eece470 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 23 Nov 2020 13:38:29 -0500 Subject: [PATCH] resolve review comments Signed-off-by: Sebastian Malton --- .eslintrc.js | 4 +++- src/common/kube-helpers.ts | 9 +++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 7845b93739..913d959a97 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,7 +21,9 @@ module.exports = { sourceType: 'module', }, rules: { - "indent": ["error", 2], + "indent": ["error", 2, { + "SwitchCase": 1, + }], "no-unused-vars": "off", "semi": ["error", "always"], "object-shorthand": "error", diff --git a/src/common/kube-helpers.ts b/src/common/kube-helpers.ts index 1df9286d60..73c146fec5 100644 --- a/src/common/kube-helpers.ts +++ b/src/common/kube-helpers.ts @@ -28,7 +28,7 @@ export class AccessError extends LoadKubeError { } toString() { - return `Failed to loading the kube config. Permission denied.\n\n${this.pathname}`; + return `Failed loading the kube config. Permission denied.\n\n${this.pathname}`; } } @@ -40,18 +40,19 @@ export class ExistError extends LoadKubeError { } toString() { - return `Failed to loading the kube config. No such file.\n\n${this.pathname}`; + return `Failed loading the kube config. No such file.\n\n${this.pathname}`; } } export function loadConfig(pathOrContent: string): KubeConfig { const kc = new KubeConfig(); + const pathVersion = resolveTilde(pathOrContent); try { - kc.loadFromFile(pathOrContent); + kc.loadFromFile(pathVersion); } catch (err) { switch (err.code) { case "ENOENT": { // No such file or directory - const dir = path.dirname(pathOrContent); + const dir = path.dirname(pathVersion); const dirStat = fse.statSync(dir); if (dirStat.isDirectory()) { throw new ExistError(pathOrContent);