From: Raphaƫl Jakse Date: Sun, 5 Apr 2020 10:34:30 +0000 (+0200) Subject: Linting X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=05eaebd697f2246eab96abe79ea0c6a2641cfd57;p=trivabble.git Linting --- diff --git a/.eslintrc.json b/.eslintrc.json index ffc2794..ebc72cf 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -255,7 +255,12 @@ "prefer-spread": "error", "prefer-template": "off", "quote-props": "off", - "quotes": "off", + "quotes": [ + "error", + "double", { + "avoidEscape": true + } + ], "radix": [ "error", "as-needed" diff --git a/trivabble-server.js b/trivabble-server.js index 0345eb5..5765d86 100644 --- a/trivabble-server.js +++ b/trivabble-server.js @@ -35,8 +35,8 @@ function envTrue(name) { return (process.env[name] || "").toLowerCase() === "true"; } -const DEV_ENABLE_SERVING_FILES = envTrue('DEV_ENABLE_SERVING_FILES'); -const DEBUG_LOG = DEV_ENABLE_SERVING_FILES || envTrue('DEBUG_LOG'); +const DEV_ENABLE_SERVING_FILES = envTrue("DEV_ENABLE_SERVING_FILES"); +const DEBUG_LOG = DEV_ENABLE_SERVING_FILES || envTrue("DEBUG_LOG"); if (DEV_ENABLE_SERVING_FILES) { console.log("DEV_ENABLE_SERVING_FILES: Serving files in the current directory. Please never do this on a production server, this is for development purposes only."); @@ -111,7 +111,7 @@ var frValues = { var games = {}; var dateNow = 0; -var saveTo = null; +var saveTimeout = null; function saveGames() { fs.writeFile("games.backup.json", JSON.stringify(games), function (err) { @@ -120,7 +120,7 @@ function saveGames() { } }); - saveTo = null; + saveTimeout = null; } function Game() { @@ -302,8 +302,8 @@ Game.prototype.commit = function () { } } - if (saveTo === null) { - saveTo = setTimeout(saveGames, SAVE_TIMEOUT); + if (saveTimeout === null) { + saveTimeout = setTimeout(saveGames, SAVE_TIMEOUT); } }; @@ -698,7 +698,7 @@ function handleRequest(request, response) { var post = ""; var responseAndIsES = [response, false]; - response.on("error", function (e) { + response.on("error", function connectionError(e) { console.error("An error occurred while trying to write on a socket", e); stopKeepAlive(responseAndIsES); });