From c6dab62e9972a644f8dbd75ae444ea06fd80834f Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Mon, 1 Nov 2021 08:37:29 -0400 Subject: [PATCH] Lint: no-template-curly-in-string (error) (#4196) --- .eslintrc.js | 9 ++++++--- src/main/kubectl.ts | 22 +++++++++++----------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 1426f74e7f..e013a19bf8 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -85,7 +85,8 @@ module.exports = { { "blankLine": "always", "prev": "*", "next": "class" }, { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" }, { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}, - ] + ], + "no-template-curly-in-string": "error", } }, { @@ -146,7 +147,8 @@ module.exports = { { "blankLine": "always", "prev": "*", "next": "class" }, { "blankLine": "always", "prev": ["const", "let", "var"], "next": "*" }, { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}, - ] + ], + "no-template-curly-in-string": "error", }, }, { @@ -216,7 +218,8 @@ module.exports = { { "blankLine": "any", "prev": ["const", "let", "var"], "next": ["const", "let", "var"]}, ], "react-hooks/rules-of-hooks": "error", - "react-hooks/exhaustive-deps": "off" + "react-hooks/exhaustive-deps": "off", + "no-template-curly-in-string": "error", }, } ] diff --git a/src/main/kubectl.ts b/src/main/kubectl.ts index c68e00b2dd..9454ec33fd 100644 --- a/src/main/kubectl.ts +++ b/src/main/kubectl.ts @@ -346,10 +346,10 @@ export class Kubectl { bashScript += `export PATH="${helmPath}:${kubectlPath}:$PATH"\n`; bashScript += "export KUBECONFIG=\"$tempkubeconfig\"\n"; - bashScript += "NO_PROXY=\",${NO_PROXY:-localhost},\"\n"; - bashScript += "NO_PROXY=\"${NO_PROXY//,localhost,/,}\"\n"; - bashScript += "NO_PROXY=\"${NO_PROXY//,127.0.0.1,/,}\"\n"; - bashScript += "NO_PROXY=\"localhost,127.0.0.1${NO_PROXY%,}\"\n"; + bashScript += `NO_PROXY=\",\${NO_PROXY:-localhost},\"\n`; + bashScript += `NO_PROXY=\"\${NO_PROXY//,localhost,/,}\"\n`; + bashScript += `NO_PROXY=\"\${NO_PROXY//,127.0.0.1,/,}\"\n`; + bashScript += `NO_PROXY=\"localhost,127.0.0.1\${NO_PROXY%,}\"\n`; bashScript += "export NO_PROXY\n"; bashScript += "unset tempkubeconfig\n"; await fsPromises.writeFile(bashScriptPath, bashScript.toString(), { mode: 0o644 }); @@ -371,14 +371,14 @@ export class Kubectl { zshScript += `helmpath=\"${helmPath}"\n`; zshScript += "p=\":$kubectlpath:\"\n"; zshScript += "d=\":$PATH:\"\n"; - zshScript += "d=${d//$p/:}\n"; - zshScript += "d=${d/#:/}\n"; - zshScript += "export PATH=\"$helmpath:$kubectlpath:${d/%:/}\"\n"; + zshScript += `d=\${d//$p/:}\n`; + zshScript += `d=\${d/#:/}\n`; + zshScript += `export PATH=\"$helmpath:$kubectlpath:\${d/%:/}\"\n`; zshScript += "export KUBECONFIG=\"$tempkubeconfig\"\n"; - zshScript += "NO_PROXY=\",${NO_PROXY:-localhost},\"\n"; - zshScript += "NO_PROXY=\"${NO_PROXY//,localhost,/,}\"\n"; - zshScript += "NO_PROXY=\"${NO_PROXY//,127.0.0.1,/,}\"\n"; - zshScript += "NO_PROXY=\"localhost,127.0.0.1${NO_PROXY%,}\"\n"; + zshScript += `NO_PROXY=\",\${NO_PROXY:-localhost},\"\n`; + zshScript += `NO_PROXY=\"\${NO_PROXY//,localhost,/,}\"\n`; + zshScript += `NO_PROXY=\"\${NO_PROXY//,127.0.0.1,/,}\"\n`; + zshScript += `NO_PROXY=\"localhost,127.0.0.1\${NO_PROXY%,}\"\n`; zshScript += "export NO_PROXY\n"; zshScript += "unset tempkubeconfig\n"; zshScript += "unset OLD_ZDOTDIR\n";