From ae53eea99a3bb93e71b027abdf19cb035c468892 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 1 Nov 2024 17:26:09 +0100 Subject: [PATCH] Fix various linting issues --- ts/WoltLabSuite/Core/Ajax/Backend.ts | 2 +- ts/WoltLabSuite/Core/Ajax/DboAction.ts | 2 +- ts/WoltLabSuite/Core/Ajax/Error.ts | 2 +- ts/WoltLabSuite/Core/Ajax/Request.ts | 4 ++-- ts/WoltLabSuite/Core/Bbcode/Code.ts | 2 +- ts/WoltLabSuite/Core/Component/Comment/List.ts | 4 ++-- ts/WoltLabSuite/Core/Controller/Popover.ts | 4 ++-- ts/WoltLabSuite/Core/Devtools.ts | 2 +- ts/WoltLabSuite/Core/Form/Builder/Field/Checkboxes.ts | 2 +- ts/WoltLabSuite/Core/Image/ExifUtil.ts | 6 +++++- ts/WoltLabSuite/Core/Image/Resizer.ts | 6 +++++- ts/WoltLabSuite/Core/Media/Manager/Base.ts | 2 +- ts/WoltLabSuite/Core/Media/Manager/Editor.ts | 2 +- ts/WoltLabSuite/Core/Notification/Handler.ts | 2 +- ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts | 2 +- ts/WoltLabSuite/Core/Ui/FlexibleMenu.ts | 6 +++--- ts/WoltLabSuite/Core/Ui/Page/Action.ts | 4 ++-- ts/WoltLabSuite/Core/Ui/Page/JumpTo.ts | 2 +- ts/WoltLabSuite/Core/Ui/Reaction/CountButtons.ts | 2 +- ts/WoltLabSuite/Core/Ui/Search/Page.ts | 2 +- ts/WoltLabSuite/Core/Upload.ts | 4 ++-- ts/WoltLabSuite/WebComponent/Language.ts | 2 +- .../install/files/js/WoltLabSuite/Core/Ajax/Backend.js | 2 +- .../install/files/js/WoltLabSuite/Core/Ajax/DboAction.js | 2 +- wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Error.js | 2 +- .../install/files/js/WoltLabSuite/Core/Ajax/Request.js | 4 ++-- .../files/js/WoltLabSuite/Core/Controller/Popover.js | 4 ++-- wcfsetup/install/files/js/WoltLabSuite/Core/Devtools.js | 2 +- .../install/files/js/WoltLabSuite/Core/Image/ExifUtil.js | 7 ++++++- .../install/files/js/WoltLabSuite/Core/Image/Resizer.js | 7 ++++++- .../files/js/WoltLabSuite/Core/Media/Manager/Base.js | 2 +- .../files/js/WoltLabSuite/Core/Notification/Handler.js | 2 +- .../files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js | 2 +- .../install/files/js/WoltLabSuite/Core/Ui/FlexibleMenu.js | 6 +++--- .../install/files/js/WoltLabSuite/Core/Ui/Page/Action.js | 4 ++-- .../install/files/js/WoltLabSuite/Core/Ui/Search/Page.js | 2 +- 36 files changed, 66 insertions(+), 48 deletions(-) diff --git a/ts/WoltLabSuite/Core/Ajax/Backend.ts b/ts/WoltLabSuite/Core/Ajax/Backend.ts index be1fcda4be..ab672f6b16 100644 --- a/ts/WoltLabSuite/Core/Ajax/Backend.ts +++ b/ts/WoltLabSuite/Core/Ajax/Backend.ts @@ -98,7 +98,7 @@ class BackendRequest { let json: unknown; try { json = await response.json(); - } catch (e) { + } catch { throw new InvalidJson(response); } diff --git a/ts/WoltLabSuite/Core/Ajax/DboAction.ts b/ts/WoltLabSuite/Core/Ajax/DboAction.ts index 0cfd2f86bf..004a27ac6d 100644 --- a/ts/WoltLabSuite/Core/Ajax/DboAction.ts +++ b/ts/WoltLabSuite/Core/Ajax/DboAction.ts @@ -217,7 +217,7 @@ async function tryParseAsJson(response: Response): Promise { let json: ResponseData; try { json = await response.json(); - } catch (e) { + } catch { throw new InvalidJson(response); } diff --git a/ts/WoltLabSuite/Core/Ajax/Error.ts b/ts/WoltLabSuite/Core/Ajax/Error.ts index 16b8352e29..1326b99ba7 100644 --- a/ts/WoltLabSuite/Core/Ajax/Error.ts +++ b/ts/WoltLabSuite/Core/Ajax/Error.ts @@ -60,7 +60,7 @@ async function getErrorHtml(error: ApiError): Promise { // The comment id is invalid or there is a mismatch, silently ignore it. - permaLinkComment!.remove(); + permaLinkComment.remove(); return true; }); @@ -195,7 +195,7 @@ class CommentList { } catch (error) { await handleValidationErrors(error, () => { // The response id is invalid or there is a mismatch, silently ignore it. - permalinkResponse!.remove(); + permalinkResponse.remove(); return true; }); diff --git a/ts/WoltLabSuite/Core/Controller/Popover.ts b/ts/WoltLabSuite/Core/Controller/Popover.ts index eea5fa0683..d4fb6dca46 100644 --- a/ts/WoltLabSuite/Core/Controller/Popover.ts +++ b/ts/WoltLabSuite/Core/Controller/Popover.ts @@ -325,8 +325,8 @@ class ControllerPopover implements AjaxCallbackObject { if (forceHide) { this.popover.classList.add("forceHide"); - // force layout - //noinspection BadExpressionStatementJS + // Query a layout related property to force a reflow, otherwise the transition is optimized away. + // eslint-disable-next-line @typescript-eslint/no-unused-expressions this.popover.offsetTop; this.clearContent(); diff --git a/ts/WoltLabSuite/Core/Devtools.ts b/ts/WoltLabSuite/Core/Devtools.ts index 1d6dd9b71c..92e22cb06d 100644 --- a/ts/WoltLabSuite/Core/Devtools.ts +++ b/ts/WoltLabSuite/Core/Devtools.ts @@ -87,7 +87,7 @@ const Devtools = { if (settings !== null) { _settings = JSON.parse(settings); } - } catch (e) { + } catch { // Ignore JSON parsing failure. } diff --git a/ts/WoltLabSuite/Core/Form/Builder/Field/Checkboxes.ts b/ts/WoltLabSuite/Core/Form/Builder/Field/Checkboxes.ts index 417ff880cf..46f856296e 100644 --- a/ts/WoltLabSuite/Core/Form/Builder/Field/Checkboxes.ts +++ b/ts/WoltLabSuite/Core/Form/Builder/Field/Checkboxes.ts @@ -29,7 +29,7 @@ class Checkboxes extends Field { return null; }) - .filter((v) => v !== null) as string[]; + .filter((v) => v !== null); return { [this._fieldId]: values, diff --git a/ts/WoltLabSuite/Core/Image/ExifUtil.ts b/ts/WoltLabSuite/Core/Image/ExifUtil.ts index 6d45a2ac19..4a6df6e762 100644 --- a/ts/WoltLabSuite/Core/Image/ExifUtil.ts +++ b/ts/WoltLabSuite/Core/Image/ExifUtil.ts @@ -55,7 +55,11 @@ async function blobToUint8(blob: Blob | File): Promise { reader.addEventListener("error", () => { reader.abort(); - reject(reader.error); + if (reader.error) { + reject(reader.error); + } else { + reject(); + } }); reader.addEventListener("load", () => { diff --git a/ts/WoltLabSuite/Core/Image/Resizer.ts b/ts/WoltLabSuite/Core/Image/Resizer.ts index 00dc13c2ca..2eb659a770 100644 --- a/ts/WoltLabSuite/Core/Image/Resizer.ts +++ b/ts/WoltLabSuite/Core/Image/Resizer.ts @@ -117,7 +117,11 @@ class ImageResizer { reader.addEventListener("error", () => { reader.abort(); - reject(reader.error); + if (reader.error) { + reject(reader.error); + } else { + reject(); + } }); image.addEventListener("error", reject); diff --git a/ts/WoltLabSuite/Core/Media/Manager/Base.ts b/ts/WoltLabSuite/Core/Media/Manager/Base.ts index 03357f96e1..fe4bad9914 100644 --- a/ts/WoltLabSuite/Core/Media/Manager/Base.ts +++ b/ts/WoltLabSuite/Core/Media/Manager/Base.ts @@ -444,7 +444,7 @@ abstract class MediaManager return null; }) - .filter((s) => s !== null) as string[]; + .filter((s) => s !== null); } /** diff --git a/ts/WoltLabSuite/Core/Notification/Handler.ts b/ts/WoltLabSuite/Core/Notification/Handler.ts index b571e45906..7f3d1b4660 100644 --- a/ts/WoltLabSuite/Core/Notification/Handler.ts +++ b/ts/WoltLabSuite/Core/Notification/Handler.ts @@ -157,7 +157,7 @@ class NotificationHandler { pollData = JSON.parse(pollData as string); keepAliveData = JSON.parse(keepAliveData as string); - } catch (e) { + } catch { abort = true; } diff --git a/ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts b/ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts index 1ce0d133c4..8d1ba020ee 100644 --- a/ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts +++ b/ts/WoltLabSuite/Core/Ui/Dropdown/Simple.ts @@ -620,7 +620,7 @@ const UiDropdownSimple = { UiDropdownSimple.close(containerId); _menus.get(containerId)?.remove(); - } catch (e) { + } catch { // the elements might not exist anymore thus ignore all errors while cleaning up } diff --git a/ts/WoltLabSuite/Core/Ui/FlexibleMenu.ts b/ts/WoltLabSuite/Core/Ui/FlexibleMenu.ts index 2c292b5765..e0475e3da3 100644 --- a/ts/WoltLabSuite/Core/Ui/FlexibleMenu.ts +++ b/ts/WoltLabSuite/Core/Ui/FlexibleMenu.ts @@ -42,7 +42,7 @@ export function setup(): void { export function register(containerId: string): void { const container = document.getElementById(containerId); if (container === null) { - throw "Expected a valid element id, '" + containerId + "' does not exist."; + throw new Error("Expected a valid element id, '" + containerId + "' does not exist."); } if (_containers.has(containerId)) { @@ -51,7 +51,7 @@ export function register(containerId: string): void { const list = DomTraverse.childByTag(container, "UL"); if (list === null) { - throw "Expected an
    element as child of container '" + containerId + "'."; + throw new Error("Expected an
      element as child of container '" + containerId + "'."); } _containers.set(containerId, container); @@ -90,7 +90,7 @@ export function rebuildAll(): void { export function rebuild(containerId: string): void { const container = _containers.get(containerId); if (container === undefined) { - throw "Expected a valid element id, '" + containerId + "' is unknown."; + throw new Error("Expected a valid element id, '" + containerId + "' is unknown."); } const styles = window.getComputedStyle(container); diff --git a/ts/WoltLabSuite/Core/Ui/Page/Action.ts b/ts/WoltLabSuite/Core/Ui/Page/Action.ts index 575cf81581..cf75907d5e 100644 --- a/ts/WoltLabSuite/Core/Ui/Page/Action.ts +++ b/ts/WoltLabSuite/Core/Ui/Page/Action.ts @@ -204,7 +204,7 @@ export function add(buttonName: string, button: HTMLElement, insertBeforeButton? _buttons.set(buttonName, button); // Query a layout related property to force a reflow, otherwise the transition is optimized away. - // noinspection BadExpressionStatementJS + // eslint-disable-next-line @typescript-eslint/no-unused-expressions wrapper.offsetParent; // Toggle the visibility to force the transition to be applied. @@ -242,7 +242,7 @@ export function remove(buttonName: string): void { } listItem.removeEventListener("transitionend", callback); - } catch (e) { + } catch { // ignore errors if the element has already been removed } }; diff --git a/ts/WoltLabSuite/Core/Ui/Page/JumpTo.ts b/ts/WoltLabSuite/Core/Ui/Page/JumpTo.ts index 4bf9103d31..2a03d68d56 100644 --- a/ts/WoltLabSuite/Core/Ui/Page/JumpTo.ts +++ b/ts/WoltLabSuite/Core/Ui/Page/JumpTo.ts @@ -39,7 +39,7 @@ class UiPageJumpTo implements DialogCallbackObject { if (!this.elements.has(element)) { element.querySelectorAll(".jumpTo").forEach((jumpTo: HTMLElement) => { jumpTo.addEventListener("click", (ev) => this.click(element, ev)); - this.elements.set(element, callback!); + this.elements.set(element, callback); }); } } diff --git a/ts/WoltLabSuite/Core/Ui/Reaction/CountButtons.ts b/ts/WoltLabSuite/Core/Ui/Reaction/CountButtons.ts index 1d42cd2bf6..173f1c0443 100644 --- a/ts/WoltLabSuite/Core/Ui/Reaction/CountButtons.ts +++ b/ts/WoltLabSuite/Core/Ui/Reaction/CountButtons.ts @@ -172,7 +172,7 @@ class CountButtons { countSpan.innerHTML = StringUtil.shortUnit(count); createdElement.appendChild(countSpan); - summaryList!.appendChild(createdElement); + summaryList.appendChild(createdElement); triggerChange = true; } diff --git a/ts/WoltLabSuite/Core/Ui/Search/Page.ts b/ts/WoltLabSuite/Core/Ui/Search/Page.ts index 712a48fdbb..4ba81f9011 100644 --- a/ts/WoltLabSuite/Core/Ui/Search/Page.ts +++ b/ts/WoltLabSuite/Core/Ui/Search/Page.ts @@ -27,7 +27,7 @@ function click(event: MouseEvent): void { parameters.set(key, data[key]); }); } - } catch (e) { + } catch { // Ignore JSON parsing failure. } diff --git a/ts/WoltLabSuite/Core/Upload.ts b/ts/WoltLabSuite/Core/Upload.ts index f61cb96a00..aa1334ea0b 100644 --- a/ts/WoltLabSuite/Core/Upload.ts +++ b/ts/WoltLabSuite/Core/Upload.ts @@ -360,10 +360,10 @@ abstract class Upload { Object.entries(parameters).forEach(([key, value]) => { if (typeof value === "object") { - const newPrefix = prefix!.length === 0 ? key : `${prefix!}[${key}]`; + const newPrefix = prefix.length === 0 ? key : `${prefix}[${key}]`; appendFormData(value, newPrefix); } else { - const dataName = prefix!.length === 0 ? key : `${prefix!}[${key}]`; + const dataName = prefix.length === 0 ? key : `${prefix}[${key}]`; formData.append(dataName, value); } }); diff --git a/ts/WoltLabSuite/WebComponent/Language.ts b/ts/WoltLabSuite/WebComponent/Language.ts index 7cf1fc0e36..89c96be816 100644 --- a/ts/WoltLabSuite/WebComponent/Language.ts +++ b/ts/WoltLabSuite/WebComponent/Language.ts @@ -44,7 +44,7 @@ function compile(value: string): Phrase { try { const template = new Template(value); return template.fetch.bind(template); - } catch (e) { + } catch { return function () { return value; }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Backend.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Backend.js index 2eb132f05a..a500e54ff2 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Backend.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Backend.js @@ -69,7 +69,7 @@ define(["require", "exports", "tslib", "./Status", "./Error", "../Core"], functi try { json = await response.json(); } - catch (e) { + catch { throw new Error_1.InvalidJson(response); } return json; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/DboAction.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/DboAction.js index 962465a579..1871af8656 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/DboAction.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/DboAction.js @@ -157,7 +157,7 @@ define(["require", "exports", "tslib", "./Error", "./Status", "../Core"], functi try { json = await response.json(); } - catch (e) { + catch { throw new Error_1.InvalidJson(response); } return json; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Error.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Error.js index fd3e5a0a28..330d19dd2d 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Error.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Error.js @@ -46,7 +46,7 @@ define(["require", "exports", "tslib", "../Component/Dialog", "../Core", "../Lan try { json = await error.response.clone().json(); } - catch (e) { + catch { message = await error.response.clone().text(); } if (json && Core.isPlainObject(json) && Object.keys(json).length > 0) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js index ce3db1bfb5..b25a726452 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ajax/Request.js @@ -202,7 +202,7 @@ define(["require", "exports", "tslib", "./Status", "../Core", "../Dom/Change/Lis try { data = JSON.parse(xhr.responseText); } - catch (e) { + catch { // invalid JSON this._failure(xhr, options); return; @@ -235,7 +235,7 @@ define(["require", "exports", "tslib", "./Status", "../Core", "../Dom/Change/Lis try { data = JSON.parse(xhr.responseText); } - catch (e) { + catch { // Ignore JSON parsing failure. } let showError = true; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Popover.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Popover.js index bfa6a967da..d55863bccd 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Popover.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Controller/Popover.js @@ -242,8 +242,8 @@ define(["require", "exports", "tslib", "../Ajax", "../Dom/Change/Listener", "../ } if (forceHide) { this.popover.classList.add("forceHide"); - // force layout - //noinspection BadExpressionStatementJS + // Query a layout related property to force a reflow, otherwise the transition is optimized away. + // eslint-disable-next-line @typescript-eslint/no-unused-expressions this.popover.offsetTop; this.clearContent(); this.popover.classList.remove("forceHide"); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Devtools.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Devtools.js index 661918fcb3..8d2eaf40db 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Devtools.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Devtools.js @@ -70,7 +70,7 @@ define(["require", "exports"], function (require, exports) { _settings = JSON.parse(settings); } } - catch (e) { + catch { // Ignore JSON parsing failure. } if (!_settings.editorAutosave) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Image/ExifUtil.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Image/ExifUtil.js index f56d528609..e09ff1091d 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Image/ExifUtil.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Image/ExifUtil.js @@ -53,7 +53,12 @@ define(["require", "exports"], function (require, exports) { const reader = new FileReader(); reader.addEventListener("error", () => { reader.abort(); - reject(reader.error); + if (reader.error) { + reject(reader.error); + } + else { + reject(); + } }); reader.addEventListener("load", () => { resolve(new Uint8Array(reader.result)); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Image/Resizer.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Image/Resizer.js index 41065b21c8..f36920c1e5 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Image/Resizer.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Image/Resizer.js @@ -92,7 +92,12 @@ define(["require", "exports", "tslib", "../FileUtil", "./ExifUtil", "pica"], fun }); reader.addEventListener("error", () => { reader.abort(); - reject(reader.error); + if (reader.error) { + reject(reader.error); + } + else { + reject(); + } }); image.addEventListener("error", reject); image.addEventListener("load", () => { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js index 2ceb6f575e..26af3bcdc2 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Media/Manager/Base.js @@ -365,7 +365,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../../Pe try { this._listItems.get(mediaId).remove(); } - catch (e) { + catch { // ignore errors if item has already been removed by other code } this._listItems.delete(mediaId); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js index fb8afeabd6..eb22c8bae0 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Notification/Handler.js @@ -117,7 +117,7 @@ define(["require", "exports", "tslib", "../Ajax", "../Core", "../Event/Handler"] pollData = JSON.parse(pollData); keepAliveData = JSON.parse(keepAliveData); } - catch (e) { + catch { abort = true; } if (!abort) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js index 36e0b07d01..0b3fdc65aa 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dropdown/Simple.js @@ -515,7 +515,7 @@ define(["require", "exports", "tslib", "../../CallbackList", "../../Core", "../. UiDropdownSimple.close(containerId); _menus.get(containerId)?.remove(); } - catch (e) { + catch { // the elements might not exist anymore thus ignore all errors while cleaning up } _menus.delete(containerId); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/FlexibleMenu.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/FlexibleMenu.js index 87dd38ce57..688e74f8fa 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/FlexibleMenu.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/FlexibleMenu.js @@ -44,14 +44,14 @@ define(["require", "exports", "tslib", "../Dom/Change/Listener", "../Dom/Util", function register(containerId) { const container = document.getElementById(containerId); if (container === null) { - throw "Expected a valid element id, '" + containerId + "' does not exist."; + throw new Error("Expected a valid element id, '" + containerId + "' does not exist."); } if (_containers.has(containerId)) { return; } const list = DomTraverse.childByTag(container, "UL"); if (list === null) { - throw "Expected an
        element as child of container '" + containerId + "'."; + throw new Error("Expected an
          element as child of container '" + containerId + "'."); } _containers.set(containerId, container); _itemLists.set(containerId, list); @@ -85,7 +85,7 @@ define(["require", "exports", "tslib", "../Dom/Change/Listener", "../Dom/Util", function rebuild(containerId) { const container = _containers.get(containerId); if (container === undefined) { - throw "Expected a valid element id, '" + containerId + "' is unknown."; + throw new Error("Expected a valid element id, '" + containerId + "' is unknown."); } const styles = window.getComputedStyle(container); const parent = container.parentNode; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js index 349faf9f21..cb7e6a7795 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Page/Action.js @@ -168,7 +168,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../../Ui _wrapper.classList.remove("scrolledDown"); _buttons.set(buttonName, button); // Query a layout related property to force a reflow, otherwise the transition is optimized away. - // noinspection BadExpressionStatementJS + // eslint-disable-next-line @typescript-eslint/no-unused-expressions wrapper.offsetParent; // Toggle the visibility to force the transition to be applied. wrapper.setAttribute("aria-hidden", "false"); @@ -201,7 +201,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Language", "../../Ui } listItem.removeEventListener("transitionend", callback); } - catch (e) { + catch { // ignore errors if the element has already been removed } }; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Page.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Page.js index 29f5da7925..eb0f99ee0f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Page.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search/Page.js @@ -26,7 +26,7 @@ define(["require", "exports", "tslib", "../../Core", "../../Dom/Util", "../Dropd }); } } - catch (e) { + catch { // Ignore JSON parsing failure. } if (objectType && objectType !== "everywhere") { -- 2.20.1