Linting
authorRaphaël Jakse <raphael.jakse@univ-grenoble-alpes.fr>
Sun, 5 Apr 2020 10:34:30 +0000 (12:34 +0200)
committerRaphaël Jakse <raphael.jakse@univ-grenoble-alpes.fr>
Sun, 5 Apr 2020 10:34:30 +0000 (12:34 +0200)
.eslintrc.json
trivabble-server.js

index ffc2794b431b5f049cad87efbc58a585d479b337..ebc72cf0fce9e484eac5baa154937f265f936087 100644 (file)
         "prefer-spread": "error",
         "prefer-template": "off",
         "quote-props": "off",
-        "quotes": "off",
+        "quotes": [
+            "error",
+            "double", {
+                "avoidEscape": true
+            }
+        ],
         "radix": [
             "error",
             "as-needed"
index 0345eb5476785b47ef5ee506af570ac78f9ad401..5765d86947b16afc794733f62eba0d1514b02c73 100644 (file)
@@ -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);
     });