From fb1fe5c491a453fb9bd376f85682b06f02fadf50 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 30 Oct 2020 11:28:28 +0100 Subject: [PATCH] Make everything @typescript-eslint/no-unused-vars clean --- .eslintrc.js | 6 +++++ .../js/WoltLabSuite/Core/CallbackList.js | 2 +- .../files/js/WoltLabSuite/Core/I18n/Plural.js | 26 +++++++++---------- .../files/js/WoltLabSuite/Core/Template.js | 4 +-- .../js/WoltLabSuite/Core/Ui/Confirmation.js | 2 +- .../files/js/WoltLabSuite/Core/Ui/Dialog.js | 4 --- .../files/js/WoltLabSuite/Core/Ui/ItemList.js | 2 -- .../WoltLabSuite/Core/Ui/Page/Header/Fixed.js | 2 -- .../files/js/WoltLabSuite/Core/Ui/Screen.js | 9 ++----- .../ts/WoltLabSuite/Core/CallbackList.ts | 2 +- .../files/ts/WoltLabSuite/Core/I18n/Plural.ts | 26 +++++++++---------- .../files/ts/WoltLabSuite/Core/Template.ts | 4 +-- .../ts/WoltLabSuite/Core/Ui/Confirmation.ts | 2 +- .../files/ts/WoltLabSuite/Core/Ui/Dialog.ts | 6 ----- .../files/ts/WoltLabSuite/Core/Ui/ItemList.ts | 2 -- .../WoltLabSuite/Core/Ui/Page/Header/Fixed.ts | 2 -- .../files/ts/WoltLabSuite/Core/Ui/Screen.ts | 9 ++----- 17 files changed, 44 insertions(+), 66 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 65070d272f..04aec1c84f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -20,5 +20,11 @@ module.exports = { "@typescript-eslint/no-unsafe-call": 0, "@typescript-eslint/no-unsafe-member-access": 0, "@typescript-eslint/no-unsafe-return": 0, + "@typescript-eslint/no-unused-vars": [ + "error", + { + "argsIgnorePattern": "^_" + } + ] } }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/CallbackList.js b/wcfsetup/install/files/js/WoltLabSuite/Core/CallbackList.js index 865d610d1f..0d7795c8bf 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/CallbackList.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/CallbackList.js @@ -37,7 +37,7 @@ define(["require", "exports"], function (require, exports) { forEach(identifier, callback) { var _a; if (identifier === null) { - this._callbacks.forEach((callbacks, identifier) => { + this._callbacks.forEach((callbacks, _identifier) => { callbacks.forEach(callback); }); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/I18n/Plural.js b/wcfsetup/install/files/js/WoltLabSuite/Core/I18n/Plural.js index 82843bf9f3..f57471651e 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/I18n/Plural.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/I18n/Plural.js @@ -141,7 +141,7 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_ONE; }, // Tibetan - bo(n) { }, + bo(_n) { }, // Bosnian bs(n) { const v = Plural.getV(n); @@ -270,7 +270,7 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_ONE; }, // Indonesian - id(n) { }, + id(_n) { }, // Icelandic is(n) { const f = Plural.getF(n); @@ -278,9 +278,9 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_ONE; }, // Japanese - ja(n) { }, + ja(_n) { }, // Javanese - jv(n) { }, + jv(_n) { }, // Georgian ka(n) { if (n == 1) @@ -292,14 +292,14 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_ONE; }, // Khmer - km(n) { }, + km(_n) { }, // Kannada kn(n) { if (n >= 0 && n <= 1) return PLURAL_ONE; }, // Korean - ko(n) { }, + ko(_n) { }, // Kurdish ku(n) { if (n == 1) @@ -316,7 +316,7 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_ONE; }, // Lao - lo(n) { }, + lo(_n) { }, // Lithuanian lt(n) { const mod10 = n % 10; @@ -361,7 +361,7 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_ONE; }, // Malay - ms(n) { }, + ms(_n) { }, // Maltese mt(n) { const mod100 = n % 100; @@ -373,7 +373,7 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_MANY; }, // Burmese - my(n) { }, + my(_n) { }, // Norwegian no(n) { if (n == 1) @@ -486,9 +486,9 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_ONE; }, // Tajik - tg(n) { }, + tg(_n) { }, // Thai - th(n) { }, + th(_n) { }, // Turkmen tk(n) { if (n == 1) @@ -515,9 +515,9 @@ define(["require", "exports", "tslib", "../StringUtil"], function (require, expo return PLURAL_ONE; }, // Vietnamese - vi(n) { }, + vi(_n) { }, // Chinese - zh(n) { }, + zh(_n) { }, }; return Plural; }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Template.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Template.js index 16d68aa2c0..92f9572e8b 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Template.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Template.js @@ -55,7 +55,7 @@ define(["require", "exports", "tslib", "./Template.grammar", "./StringUtil", "./ * * @param {object} v Parameters to pass to the template. */ - fetch(v) { + fetch(_v) { // this will be replaced in the init function throw new Error("This Template is not initialized."); } @@ -66,7 +66,7 @@ define(["require", "exports", "tslib", "./Template.grammar", "./StringUtil", "./ get: function () { throw new Error("WCF.Template.callbacks is no longer supported"); }, - set: function (value) { + set: function (_value) { throw new Error("WCF.Template.callbacks is no longer supported"); }, }); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Confirmation.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Confirmation.js index 256677aacb..e5ffacd24b 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Confirmation.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Confirmation.js @@ -31,7 +31,7 @@ define(["require", "exports", "tslib", "../Core", "../Language", "./Dialog"], fu this.confirmButton = document.createElement("button"); this.confirmButton.classList.add("buttonPrimary"); this.confirmButton.textContent = Language.get("wcf.global.confirmation.confirm"); - this.confirmButton.addEventListener("click", (ev) => this._confirm()); + this.confirmButton.addEventListener("click", (_ev) => this._confirm()); formSubmit.appendChild(this.confirmButton); const cancelButton = document.createElement("button"); cancelButton.textContent = Language.get("wcf.global.confirmation.cancel"); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js index 7d3bee5ba3..b4b22c1dd9 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js @@ -24,7 +24,6 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Change/Listener", "./S let _dialogFullHeight = false; const _dialogObjects = new WeakMap(); const _dialogToObject = new Map(); - let _focusedBeforeDialog; let _keyupListener; const _validCallbacks = ["onBeforeClose", "onClose", "onShow"]; // list of supported `input[type]` values for dialog submit @@ -85,7 +84,6 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Change/Listener", "./S Listener_1.default.add("Ui/Dialog", () => { this._initStaticDialogs(); }); - UiScreen.setDialogContainer(_container); window.addEventListener("resize", () => { _dialogs.forEach((dialog) => { if (!Core.stringToBool(dialog.dialog.getAttribute("aria-hidden"))) { @@ -432,8 +430,6 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Change/Listener", "./S _container.setAttribute("aria-hidden", "false"); _container.setAttribute("close-on-click", data.backdropCloseOnClick ? "true" : "false"); _activeDialog = id; - // Keep a reference to the currently focused element to be able to restore it later. - _focusedBeforeDialog = document.activeElement; // Set the focus to the first focusable child of the dialog element. const closeButton = data.header.querySelector(".dialogCloseButton"); if (closeButton) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js index 7260b2c7d5..2cd0c4d941 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList.js @@ -16,7 +16,6 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Traverse", "../Languag Suggestion_1 = tslib_1.__importDefault(Suggestion_1); Simple_1 = tslib_1.__importDefault(Simple_1); Util_1 = tslib_1.__importDefault(Util_1); - let _activeId = ""; const _data = new Map(); /** * Creates the DOM structure for target element. If `element` is a `