Lint
authorRaphaël Jakse <raphael.trivabble@jakse.fr>
Thu, 8 May 2025 13:43:20 +0000 (15:43 +0200)
committerRaphaël Jakse <raphael.trivabble@jakse.fr>
Thu, 8 May 2025 13:44:02 +0000 (15:44 +0200)
.eslintrc.json
public/trivabble.js

index 7950b8d52d9376cf121a206e20169ee2728a800e..e53f64962427caeee27d683c3163a3dd9d586fd4 100644 (file)
         "require-atomic-updates": "error",
         "require-await": "error",
         "require-jsdoc": "off",
-        "require-unicode-regexp": "error",
+        "require-unicode-regexp": "off",
         "rest-spread-spacing": "error",
         "semi": [
             "error",
index dbb4d43a3668642f4d93412a52aa9a238c67d75b..7abc925c8640f9227d4637495110e328899060cd 100644 (file)
                     try {
                         const dictionary = file.responseText.split("\n");
                         downloadedDictionaries[code] = dictionary;
-                        callback(dictionary);
-                        return;
+                        return callback(dictionary);
                     } catch (e) {
                         delete downloadedDictionaries[code];
                         myAlert(_("Incorrect dictionary file."));
                 setSetting("BoardLang", value);
                 checkDictionaryExistance(value);
                 break;
-            case "boardLabel":
+            case "boardLabel": {
                 document.getElementById("board-label").value = value;
                 setSetting("BoardLabel", value);
                 const boardArray =
                 boardDef.rackLength = boardArray[2];
                 initBoard();
                 break;
+            }
             case "checkFirstWord":
                 setSetting("CheckFirstWord", value);
                 break;
             sourceLink.href = source;
             sourceLink.textContent = source;
             sourceLink.target = "_blank";
-            const translated = _("Info & source code at {0}").split("\{0\}");
+            const translated = _("Info & source code at {0}").split("\\{0\\}");
             const pinfo = document.createElement("p");
             pinfo.textContent = translated[0];
             pinfo.appendChild(sourceLink);
         const content = document.getElementById("content");
         const panel = document.getElementById("panel");
         const menu = document.getElementById("menu");
-        const screenWidth  = window.innerWidth || document.documentElement.clientWidth ||
-        document.body.clientWidth;
-        const screenHeight = window.innerHeight|| document.documentElement.clientHeight||
-        document.body.clientHeight;
+        const screenWidth  = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
+        const screenHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
         const menuAndPanelWidth  = panel.offsetWidth + menu.offsetWidth;
         const availableWidth = screenWidth - menuAndPanelWidth;
         const candidateScaleW = availableWidth / board.offsetWidth;
         // It is an arbitrary value guessed from observation. It's not very
         // pretty and I don't know why scrollbars appear without it.
         const candidateScaleH = (screenHeight - 5) / content.offsetHeight;
-        const candidateScale = Math.min(candidateScaleW, candidateScaleH)
+        let candidateScale = Math.min(candidateScaleW, candidateScaleH);
         if (candidateScale < 1) {
             candidateScale = 1;
         }
             const oldTileCount = document.getElementById("tile-count");
             newTileCount.textContent = oldTileCount.textContent;
             const b = document.getElementById("bag");
-            b.textContent = '';
+            b.textContent = "";
             b.appendChild(svg);
             tileCount = newTileCount;
         };