Lint
authorRaphaël Jakse <raphael.trivabble@jakse.fr>
Mon, 27 Apr 2020 17:57:45 +0000 (19:57 +0200)
committerRaphaël Jakse <raphael.trivabble@jakse.fr>
Mon, 27 Apr 2020 17:57:45 +0000 (19:57 +0200)
.eslintrc.json
trivabble-server.js
trivabble.js

index e391e59dc1f33b65e0be62b18a0e945a93301541..0308c1d54336806dddaf565db0ed3658aef40269 100644 (file)
         ],
         "callback-return": "error",
         "camelcase": "error",
-        "capitalized-comments": [
-            "error",
-            "always"
-        ],
+        "capitalized-comments": "off",
         "class-methods-use-this": "error",
         "comma-dangle": "error",
         "comma-spacing": [
index 6a56e60f857521bf21d7eaed16bf8e28cd5fab7d..8157cc43b17374a09d0af7f0a0c320d136cc69ed 100644 (file)
@@ -555,7 +555,9 @@ function handleCommand(cmdNumber, message, response) {
                     }
 
                     letter = rack[cmd.indexFrom];
-                    operations.push(() => {rack[cmd.indexFrom] = "";});
+                    operations.push(() => {
+                        rack[cmd.indexFrom] = "";
+                    });
                     break;
 
                 case "board":
@@ -574,7 +576,9 @@ function handleCommand(cmdNumber, message, response) {
                         return false;
                     }
 
-                    operations.push(() => {letter = game.bagPopLetter(playerName);});
+                    operations.push(() => {
+                        letter = game.bagPopLetter(playerName);
+                    });
                     break;
 
                 default:
@@ -596,7 +600,9 @@ function handleCommand(cmdNumber, message, response) {
                         return false;
                     }
 
-                    operations.push(() => {rack[cmd.indexTo] = letter;});
+                    operations.push(() => {
+                        rack[cmd.indexTo] = letter;
+                    });
                     break;
 
                 case "board":
@@ -623,8 +629,8 @@ function handleCommand(cmdNumber, message, response) {
 
             response.write(
                 JSON.stringify({
-                    error:0,
-                    rack: (cmd.from === "bag" && cmd.to === "rack") ? rack : undefined,
+                    error: 0,
+                    rack: (cmd.from === "bag" && cmd.to === "rack") ? rack : undefined, // eslint-disable-line no-undefined
                     remainingLetters: game.bag.length
                 })
             );
index e832002ea5d15db2d56f3b5f44d32e4693d2496a..b5b502644e1a26b15c4c868d1e9dc2fcefa007c8 100644 (file)
@@ -43,7 +43,9 @@
     setConf("MAX_WEBSOCKET_ERRORS", 1);
     setConf("APP_PATH",             "");
 
-    const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {return s;};
+    const _ = (window.libD && libD.l10n) ? libD.l10n() : function (s) {
+        return s;
+    };
 
     const trivabble = window.trivabble = {l10n: _};
 
 
             if (moveCMD.to === moveCMD.from) {
                 if (moveCMD.indexTo !== moveCMD.indexFrom) {
-                   if (moveCMD.from === "rack") {
-                        sendCmds([moveRack]);
-                   } else {
-                        sendCmds([moveCMD]);
-                   }
+                    sendCmds([
+                        (moveCMD.from === "rack")
+                            ? moveRack
+                            : moveCMD
+                    ]);
                 }
             } else if (moveCMD.to === "rack") {
                 moveRack.rack[moveCMD.indexTo] = "";
                         type: "rack",
                         rack: letters.map(
                             function (tile) {
-                                return tile.querySelector(".tile-letter").textContent
+                                return tile.querySelector(".tile-letter").textContent;
                             }
                         )
                     }