Enforce template strings in eslint (#1574)

Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
This commit is contained in:
Panu Horsmalahti authored and GitHub committed 2020-11-30 15:35:16 +02:00
1 parent 07e6df9fdc
commit 335778aeef
52 files changed
+94 -88

No files matched your search

+1 -1
View File
@@ -28,7 +28,7 @@ export class HelmCli extends LensBinary {
}
protected getOriginalBinaryPath() {
return path.join(this.dirname, this.platformName + "-" + this.arch, this.originalBinaryName);
return path.join(this.dirname, `${this.platformName}-${this.arch}`, this.originalBinaryName);
}
}
+1 -1
View File
@@ -81,7 +81,7 @@ export class KubeconfigManager {
return;
}
logger.info("Deleting temporary kubeconfig: " + this.tempFile);
logger.info(`Deleting temporary kubeconfig: ${this.tempFile}`);
await fs.unlink(this.tempFile);
this.tempFile = undefined;
}
+5 -5
View File
@@ -81,10 +81,10 @@ export class Kubectl {
if the version map includes that, use that version, if not, fallback to the exact x.y.z of kube version */
if (kubectlMap.has(minorVersion)) {
this.kubectlVersion = kubectlMap.get(minorVersion);
logger.debug("Set kubectl version " + this.kubectlVersion + " for cluster version " + clusterVersion + " using version map");
logger.debug(`Set kubectl version ${this.kubectlVersion} for cluster version ${clusterVersion} using version map`);
} else {
this.kubectlVersion = versionParts[1] + versionParts[2];
logger.debug("Set kubectl version " + this.kubectlVersion + " for cluster version " + clusterVersion + " using fallback");
logger.debug(`Set kubectl version ${this.kubectlVersion} for cluster version ${clusterVersion} using fallback`);
}
let arch = null;
@@ -197,7 +197,7 @@ export class Kubectl {
}
return true;
} catch (err) {
logger.error("Could not copy the bundled kubectl to app-data: " + err);
logger.error(`Could not copy the bundled kubectl to app-data: ${err}`);
return false;
}
} else {
@@ -280,7 +280,7 @@ export class Kubectl {
const fsPromises = fs.promises;
const bashScriptPath = path.join(this.dirname, ".bash_set_path");
let bashScript = "" + initScriptVersionString;
let bashScript = `${initScriptVersionString}`;
bashScript += "tempkubeconfig=\"$KUBECONFIG\"\n";
bashScript += "test -f \"/etc/profile\" && . \"/etc/profile\"\n";
bashScript += "if test -f \"$HOME/.bash_profile\"; then\n";
@@ -303,7 +303,7 @@ export class Kubectl {
const zshScriptPath = path.join(this.dirname, ".zlogin");
let zshScript = "" + initScriptVersionString;
let zshScript = `${initScriptVersionString}`;
zshScript += "tempkubeconfig=\"$KUBECONFIG\"\n";
// restore previous ZDOTDIR
+2 -2
View File
@@ -51,8 +51,8 @@ export class LensBinary {
this.platformName = isWindows ? "windows" : process.platform;
this.dirname = path.normalize(path.join(baseDir, this.binaryName));
if (isWindows) {
this.binaryName = this.binaryName + ".exe";
this.originalBinaryName = this.originalBinaryName + ".exe";
this.binaryName = `${this.binaryName}.exe`;
this.originalBinaryName = `${this.originalBinaryName}.exe`;
}
const tarName = this.getTarName();
if (tarName) {
+2 -2
View File
@@ -95,7 +95,7 @@ export class LensProxy {
socket.end();
});
proxySocket.on("error", function () {
socket.write("HTTP/" + req.httpVersion + " 500 Connection error\r\n\r\n");
socket.write(`HTTP/${req.httpVersion} 500 Connection error\r\n\r\n`);
socket.end();
});
socket.on("data", function (chunk) {
@@ -117,7 +117,7 @@ export class LensProxy {
return;
}
if (target) {
logger.debug("Failed proxy to target: " + JSON.stringify(target, null, 2));
logger.debug(`Failed proxy to target: ${JSON.stringify(target, null, 2)}`);
if (req.method === "GET" && (!res.statusCode || res.statusCode >= 500)) {
const reqId = this.getRequestId(req);
const retryCount = this.retryCounters.get(reqId) || 0;
+2 -2
View File
@@ -26,7 +26,7 @@ export class ResourceApplier {
const fileName = tempy.file({ name: "resource.yaml" });
fs.writeFileSync(fileName, content);
const cmd = `"${kubectlPath}" apply --kubeconfig "${this.cluster.getProxyKubeconfigPath()}" -o json -f "${fileName}"`;
logger.debug("shooting manifests with: " + cmd);
logger.debug(`shooting manifests with: ${cmd}`);
const execEnv: NodeJS.ProcessEnv = Object.assign({}, process.env);
const httpsProxy = this.cluster.preferences?.httpsProxy;
if (httpsProxy) {
@@ -58,7 +58,7 @@ export class ResourceApplier {
console.log("shooting manifests with:", cmd);
exec(cmd, (error, stdout, stderr) => {
if (error) {
reject("Error applying manifests:" + error);
reject(`Error applying manifests:${error}`);
}
if (stderr != "") {
reject(stderr);
+1 -1
View File
@@ -102,7 +102,7 @@ export class Router {
// redirect requests to [appName].js, [appName].html /sockjs-node/ to webpack-dev-server (for hot-reload support)
const toWebpackDevServer = filename.includes(appName) || filename.includes("hot-update") || req.url.includes("sockjs-node");
if (isDevelopment && toWebpackDevServer) {
const redirectLocation = `http://localhost:${webpackDevServerPort}` + req.url;
const redirectLocation = `http://localhost:${webpackDevServerPort}${req.url}`;
res.statusCode = 307;
res.setHeader("Location", redirectLocation);
res.end();
+4 -4
View File
@@ -37,7 +37,7 @@ class ApiWatcher {
if (this.processor) {
clearInterval(this.processor);
}
logger.debug("Stopping watcher for api: " + this.apiUrl);
logger.debug(`Stopping watcher for api: ${this.apiUrl}`);
try {
this.watchRequest.abort();
this.sendEvent({
@@ -47,7 +47,7 @@ class ApiWatcher {
});
logger.debug("watch aborted");
} catch (error) {
logger.error("Watch abort errored:" + error);
logger.error(`Watch abort errored:${error}`);
}
}
@@ -59,7 +59,7 @@ class ApiWatcher {
}
private doneHandler(error: Error) {
if (error) logger.warn("watch ended: " + error.toString());
if (error) logger.warn(`watch ended: ${error.toString()}`);
this.watchRequest.abort();
}
@@ -87,7 +87,7 @@ class WatchRoute extends LensApi {
response.setHeader("Content-Type", "text/event-stream");
response.setHeader("Cache-Control", "no-cache");
response.setHeader("Connection", "keep-alive");
logger.debug("watch using kubeconfig:" + JSON.stringify(cluster.getProxyKubeconfig(), null, 2));
logger.debug(`watch using kubeconfig:${JSON.stringify(cluster.getProxyKubeconfig(), null, 2)}`);
apis.forEach(apiUrl => {
const watcher = new ApiWatcher(apiUrl, cluster.getProxyKubeconfig(), response);
+1 -1
View File
@@ -203,6 +203,6 @@ export class ShellSession extends EventEmitter {
}
protected sendResponse(msg: string) {
this.websocket.send("1" + Buffer.from(msg).toString("base64"));
this.websocket.send(`1${Buffer.from(msg).toString("base64")}`);
}
}