From: Raphaƫl Jakse Date: Tue, 28 Apr 2020 17:29:36 +0000 (+0200) Subject: Lint X-Git-Url: https://secure.softndesign.org/git/?a=commitdiff_plain;h=26df4d3414bb5cae978972fc23535543a2e6cef7;p=trivabble.git Lint --- diff --git a/.eslintrc.json b/.eslintrc.json index 0308c1d..efff6bd 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -93,7 +93,12 @@ "indent-legacy": "off", "init-declarations": "off", "jsx-quotes": "error", - "key-spacing": "off", + "key-spacing": [ + "error", { + "afterColon": true, + "mode": "minimum" + } + ], "keyword-spacing": [ "error", { "before": true, @@ -114,7 +119,7 @@ "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", @@ -258,7 +263,7 @@ "prefer-rest-params": "error", "prefer-spread": "error", "prefer-template": "off", - "quote-props": "off", + "quote-props": [2, "as-needed"], "quotes": [ "error", "double", { diff --git a/trivabble-server.js b/trivabble-server.js index 2ffcaf4..8b6fda2 100644 --- a/trivabble-server.js +++ b/trivabble-server.js @@ -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 }); }; diff --git a/trivabble.js b/trivabble.js index eecd073..45f5f92 100644 --- a/trivabble.js +++ b/trivabble.js @@ -763,8 +763,8 @@ res = parseInt(res); if (!isNaN(res)) { sendCmds([{ - cmd:"score", - player:row.firstChild.textContent, + cmd: "score", + player: row.firstChild.textContent, score: res }]); } @@ -856,7 +856,7 @@ while (participants.rows[1]) { participants.removeChild(participants.rows[1]); } - sendCmds([{"cmd":"hello"}]); + sendCmds([{cmd: "hello"}]); break; case "moveLetter": @@ -1192,10 +1192,10 @@ } 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) { @@ -1267,7 +1267,7 @@ 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}] ); } } @@ -1498,16 +1498,16 @@ 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 };