Lint
authorRaphaël Jakse <raphael.trivabble@jakse.fr>
Tue, 28 Apr 2020 17:29:36 +0000 (19:29 +0200)
committerRaphaël Jakse <raphael.trivabble@jakse.fr>
Tue, 28 Apr 2020 17:29:39 +0000 (19:29 +0200)
.eslintrc.json
trivabble-server.js
trivabble.js

index 0308c1d54336806dddaf565db0ed3658aef40269..efff6bd7f9072c99ab813be1fb56da7e1a3ea7e6 100644 (file)
         "indent-legacy": "off",
         "init-declarations": "off",
         "jsx-quotes": "error",
-        "key-spacing": "off",
+        "key-spacing": [
+            "error", {
+                "afterColon": true,
+                "mode": "minimum"
+             }
+        ],
         "keyword-spacing": [
             "error", {
                 "before": true,
         "max-lines": "off",
         "max-lines-per-function": "off",
         "max-nested-callbacks": "error",
-        "max-params": "error",
+        "max-params": ["error", {"max": 4}],
         "max-statements": "off",
         "max-statements-per-line": "error",
         "multiline-comment-style": "off",
         "prefer-rest-params": "error",
         "prefer-spread": "error",
         "prefer-template": "off",
-        "quote-props": "off",
+        "quote-props": [2, "as-needed"],
         "quotes": [
             "error",
             "double", {
index 2ffcaf4e45b6292049cb55abd89eccb60a88d956..8b6fda2bbf67ad7f594db392735e7a0e24b67373 100644 (file)
@@ -84,6 +84,8 @@ const frBag = [
     "Z"
 ];
 
+/* eslint-disable quote-props */
+
 const frValues = {
     " ": 0,
     "E": 1,
@@ -114,6 +116,7 @@ const frValues = {
     "Z": 10
 };
 
+/* eslint-enable quote-props */
 
 const games = {};
 
@@ -419,10 +422,10 @@ Game.prototype.getCell = function (index) {
 Game.prototype.setCell = function (index, letter, player) {
     this.board[index] = letter;
     this.pendingEvents.push({
-        player:player,
-        action:"setCell",
-        indexTo:index,
-        letter:letter
+        player: player,
+        action: "setCell",
+        indexTo: index,
+        letter: letter
     });
 };
 
index eecd0736f77d5461455d7bcd8f20c5f72fe6711f..45f5f92b270e7f5e3be1b12a072ae89542e451a3 100644 (file)
                                         res = parseInt(res);
                                         if (!isNaN(res)) {
                                             sendCmds([{
-                                                cmd:"score",
-                                                player:row.firstChild.textContent,
+                                                cmd: "score",
+                                                player: row.firstChild.textContent,
                                                 score: res
                                             }]);
                                         }
                 while (participants.rows[1]) {
                     participants.removeChild(participants.rows[1]);
                 }
-                sendCmds([{"cmd":"hello"}]);
+                sendCmds([{cmd: "hello"}]);
                 break;
 
             case "moveLetter":
     }
 
     const specialTypesText = {
-        "doubleLetter" : _("Double\nLetter"),
-        "doubleWord"   : _("Double\nWord"),
-        "tripleLetter" : _("Triple\nLetter"),
-        "tripleWord"   : _("Triple\nWord")
+        doubleLetter: _("Double\nLetter"),
+        doubleWord:   _("Double\nWord"),
+        tripleLetter: _("Triple\nLetter"),
+        tripleWord:   _("Triple\nWord")
     };
 
     function specialCell(type, cell) {
             myAlert(_("You cannot take another tile: your rack is full."));
         } else {
             sendCmds(
-                [{cmd:"moveLetter", from: "bag", to: "rack", indexTo: index}]
+                [{cmd: "moveLetter", from: "bag", to: "rack", indexTo: index}]
             );
         }
     }
         const letters = "ABCDEFGHIJKLMNO";
 
         const doubleLetter = {
-            "0,3" : true,
+            "0,3":  true,
             "0,11": true,
-            "2,6" : true,
-            "2,8" : true,
-            "3,0" : true,
-            "3,7" : true,
+            "2,6":  true,
+            "2,8":  true,
+            "3,0":  true,
+            "3,7":  true,
             "3,14": true,
-            "6,2" : true,
-            "6,6" : true,
-            "6,8" : true,
+            "6,2":  true,
+            "6,6":  true,
+            "6,8":  true,
             "6,12": true
         };