From 13278a5cf67de69678d8c4c5fb97e6eb00c94c11 Mon Sep 17 00:00:00 2001 From: James Maa Date: Thu, 9 May 2024 15:42:35 +0800 Subject: Update eslint unsafe rule (#887) * Enable @typescript-eslint/no-unsafe-assignment * Updates * Add missing import * Updates * Fix types? * Fix tests * Address comments * Move TextProcessorVariant to types * Update types/ext/translation-internal.d.ts Co-authored-by: StefanVukovic99 Signed-off-by: James Maa --------- Signed-off-by: James Maa Co-authored-by: toasted-nutbread Co-authored-by: StefanVukovic99 --- ext/js/input/hotkey-help-controller.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/js/input') diff --git a/ext/js/input/hotkey-help-controller.js b/ext/js/input/hotkey-help-controller.js index b495365d..f85735fc 100644 --- a/ext/js/input/hotkey-help-controller.js +++ b/ext/js/input/hotkey-help-controller.js @@ -67,9 +67,10 @@ export class HotkeyHelpController { const hotkey = (global ? this._globalActionHotkeys : this._localActionHotkeys).get(action); for (let i = 0, ii = attributes.length; i < ii; ++i) { const attribute = attributes[i]; + /** @type {unknown} */ let value; if (typeof hotkey !== 'undefined') { - value = /** @type {unknown} */ (multipleValues ? values[i] : values); + value = multipleValues ? values[i] : values; if (typeof value === 'string') { value = value.replace(replacementPattern, hotkey); } @@ -158,7 +159,8 @@ export class HotkeyHelpController { if (typeof hotkey !== 'string') { return null; } const data = /** @type {unknown} */ (parseJson(hotkey)); if (!Array.isArray(data)) { return null; } - const [action, attributes, values] = /** @type {unknown[]} */ (data); + const dataArray = /** @type {unknown[]} */ (data); + const [action, attributes, values] = dataArray; if (typeof action !== 'string') { return null; } /** @type {string[]} */ const attributesArray = []; -- cgit v1.2.3