From 2da866f982930c76d2317a3be426410683ecf5a2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 19 Feb 2024 07:30:17 -0500 Subject: Update eslint rules (#710) --- ext/js/pages/action-popup-main.js | 18 +++++----- .../pages/common/extension-content-controller.js | 4 +-- ext/js/pages/info-main.js | 4 +-- ext/js/pages/permissions-main.js | 8 ++--- ext/js/pages/settings/anki-controller.js | 24 +++++++------- ext/js/pages/settings/anki-templates-controller.js | 4 +-- ext/js/pages/settings/audio-controller.js | 12 +++---- ext/js/pages/settings/backup-controller.js | 2 +- .../settings/collapsible-dictionary-controller.js | 4 +-- ext/js/pages/settings/dictionary-controller.js | 16 ++++----- .../pages/settings/dictionary-import-controller.js | 8 ++--- .../extension-keyboard-shortcuts-controller.js | 10 +++--- .../pages/settings/generic-setting-controller.js | 2 +- .../settings/keyboard-shortcuts-controller.js | 24 +++++++------- ext/js/pages/settings/mecab-controller.js | 2 +- ext/js/pages/settings/nested-popups-controller.js | 4 +-- .../settings/permissions-origin-controller.js | 6 ++-- .../settings/permissions-toggle-controller.js | 2 +- .../settings/persistent-storage-controller.js | 2 +- ext/js/pages/settings/popup-preview-controller.js | 2 +- ext/js/pages/settings/popup-preview-frame.js | 12 +++---- ext/js/pages/settings/popup-window-controller.js | 2 +- ext/js/pages/settings/profile-conditions-ui.js | 18 +++++----- ext/js/pages/settings/profile-controller.js | 24 +++++++------- .../settings/recommended-permissions-controller.js | 2 +- ext/js/pages/settings/scan-inputs-controller.js | 14 ++++---- .../settings/scan-inputs-simple-controller.js | 6 ++-- .../sentence-termination-characters-controller.js | 12 +++---- ext/js/pages/settings/settings-controller.js | 6 ++-- ext/js/pages/settings/settings-main.js | 38 +++++++++++----------- .../sort-frequency-dictionary-controller.js | 6 ++-- ext/js/pages/settings/storage-controller.js | 6 ++-- .../translation-text-replacements-controller.js | 4 +-- ext/js/pages/welcome-main.js | 27 ++++++++------- 34 files changed, 169 insertions(+), 166 deletions(-) (limited to 'ext/js/pages') diff --git a/ext/js/pages/action-popup-main.js b/ext/js/pages/action-popup-main.js index 0a14c669..8dca8934 100644 --- a/ext/js/pages/action-popup-main.js +++ b/ext/js/pages/action-popup-main.js @@ -37,14 +37,14 @@ class DisplayController { const manifest = chrome.runtime.getManifest(); this._showExtensionInfo(manifest); - this._setupEnvironment(); + void this._setupEnvironment(); this._setupButtonEvents('.action-open-search', 'openSearchPage', chrome.runtime.getURL('/search.html'), this._onSearchClick.bind(this)); this._setupButtonEvents('.action-open-info', 'openInfoPage', chrome.runtime.getURL('/info.html')); const optionsFull = await this._api.optionsGetFull(); this._optionsFull = optionsFull; - this._setupHotkeys(); + void this._setupHotkeys(); const optionsPageUrl = ( typeof manifest.options_ui === 'object' && @@ -114,7 +114,7 @@ class DisplayController { const result = customHandler(e); if (typeof result !== 'undefined') { return; } } - this._api.commandExec(command, {mode: e.ctrlKey ? 'newTab' : 'existingOrNewTab'}); + void this._api.commandExec(command, {mode: e.ctrlKey ? 'newTab' : 'existingOrNewTab'}); e.preventDefault(); }; /** @@ -122,7 +122,7 @@ class DisplayController { */ const onAuxClick = (e) => { if (e.button !== 1) { return; } - this._api.commandExec(command, {mode: 'newTab'}); + void this._api.commandExec(command, {mode: 'newTab'}); e.preventDefault(); }; node.addEventListener('click', onClick, false); @@ -191,8 +191,8 @@ class DisplayController { toggle.checked = extensionEnabled; toggle.addEventListener('change', onToggleChanged, false); } - this._updateDictionariesEnabledWarnings(options); - this._updatePermissionsWarnings(options); + void this._updateDictionariesEnabledWarnings(options); + void this._updatePermissionsWarnings(options); } /** */ @@ -240,7 +240,7 @@ class DisplayController { const node = /** @type {HTMLInputElement} */ (event.currentTarget); const value = Number.parseInt(node.value, 10); if (typeof value === 'number' && Number.isFinite(value) && value >= 0 && value <= /** @type {import('settings').Options} */ (this._optionsFull).profiles.length) { - this._setPrimaryProfileIndex(value); + void this._setPrimaryProfileIndex(value); } } @@ -307,8 +307,8 @@ class DisplayController { } await Application.main(true, async (application) => { - application.api.logIndicatorClear(); + void application.api.logIndicatorClear(); const displayController = new DisplayController(application.api); - displayController.prepare(); + await displayController.prepare(); }); diff --git a/ext/js/pages/common/extension-content-controller.js b/ext/js/pages/common/extension-content-controller.js index 5b968d0c..be79ae8b 100644 --- a/ext/js/pages/common/extension-content-controller.js +++ b/ext/js/pages/common/extension-content-controller.js @@ -23,7 +23,7 @@ export class ExtensionContentController { prepare() { this._prepareSpecialUrls(); this._prepareExtensionIdExamples(); - this._prepareEnvironmentInfo(); + void this._prepareEnvironmentInfo(); } // Private @@ -93,7 +93,7 @@ export class ExtensionContentController { const {specialUrl} = element.dataset; if (typeof specialUrl !== 'string') { return; } e.preventDefault(); - this._createTab(specialUrl, true); + void this._createTab(specialUrl, true); } break; } diff --git a/ext/js/pages/info-main.js b/ext/js/pages/info-main.js index dda1c4e2..c0e37261 100644 --- a/ext/js/pages/info-main.js +++ b/ext/js/pages/info-main.js @@ -148,8 +148,8 @@ await Application.main(true, async (application) => { languageElement.textContent = `${language}`; userAgentElement.textContent = userAgent; - showAnkiConnectInfo(application.api); - showDictionaryInfo(application.api); + void showAnkiConnectInfo(application.api); + void showDictionaryInfo(application.api); const settingsController = new SettingsController(application); await settingsController.prepare(); diff --git a/ext/js/pages/permissions-main.js b/ext/js/pages/permissions-main.js index 40dbceb2..39a79620 100644 --- a/ext/js/pages/permissions-main.js +++ b/ext/js/pages/permissions-main.js @@ -95,7 +95,7 @@ await Application.main(true, async (application) => { setupPermissionsToggles(); - setupEnvironmentInfo(application.api); + void setupEnvironmentInfo(application.api); /** @type {HTMLInputElement} */ const permissionCheckbox1 = querySelectorNotNull(document, '#permission-checkbox-allow-in-private-windows'); @@ -122,13 +122,13 @@ await Application.main(true, async (application) => { await settingsController.prepare(); const permissionsToggleController = new PermissionsToggleController(settingsController); - permissionsToggleController.prepare(); + void permissionsToggleController.prepare(); const permissionsOriginController = new PermissionsOriginController(settingsController); - permissionsOriginController.prepare(); + void permissionsOriginController.prepare(); const persistentStorageController = new PersistentStorageController(application); - persistentStorageController.prepare(); + void persistentStorageController.prepare(); await promiseTimeout(100); diff --git a/ext/js/pages/settings/anki-controller.js b/ext/js/pages/settings/anki-controller.js index ecee1788..edd40516 100644 --- a/ext/js/pages/settings/anki-controller.js +++ b/ext/js/pages/settings/anki-controller.js @@ -110,7 +110,7 @@ export class AnkiController { ankiApiKeyInput.addEventListener('focus', this._onApiKeyInputFocus.bind(this)); ankiApiKeyInput.addEventListener('blur', this._onApiKeyInputBlur.bind(this)); - const onAnkiSettingChanged = () => { this._updateOptions(); }; + const onAnkiSettingChanged = () => { void this._updateOptions(); }; const nodes = [ankiApiKeyInput, ...document.querySelectorAll('[data-setting="anki.enable"]')]; for (const node of nodes) { node.addEventListener('settingChanged', onAnkiSettingChanged); @@ -128,7 +128,7 @@ export class AnkiController { if (promise === null) { promise = this._getAnkiData(); this._getAnkiDataPromise = promise; - promise.finally(() => { this._getAnkiDataPromise = null; }); + void promise.finally(() => { this._getAnkiDataPromise = null; }); } return promise; } @@ -161,7 +161,7 @@ export class AnkiController { /** * @param {import('settings-controller').EventArgument<'optionsChanged'>} details */ - async _onOptionsChanged({options: {anki}}) { + _onOptionsChanged({options: {anki}}) { /** @type {?string} */ let apiKey = anki.apiKey; if (apiKey === '') { apiKey = null; } @@ -187,7 +187,7 @@ export class AnkiController { this._ankiConnect.enabled = typeof value === 'boolean' && value; for (const cardController of this._selectorObserver.datas()) { - cardController.updateAnkiState(); + void cardController.updateAnkiState(); } } @@ -219,7 +219,7 @@ export class AnkiController { const normalizedMode = this._normalizeAnkiNoteGuiMode(mode); if (normalizedMode === null) { return; } - this._testAnkiNoteViewerSafe(normalizedMode); + void this._testAnkiNoteViewerSafe(normalizedMode); } /** @@ -258,7 +258,7 @@ export class AnkiController { */ _createCardController(node) { const cardController = new AnkiCardController(this._settingsController, this, /** @type {HTMLElement} */ (node)); - cardController.prepare(); + void cardController.prepare(); return cardController; } @@ -588,7 +588,7 @@ class AnkiCardController { */ _onCardDeckChange(e) { const node = /** @type {HTMLSelectElement} */ (e.currentTarget); - this._setDeck(node.value); + void this._setDeck(node.value); } /** @@ -596,7 +596,7 @@ class AnkiCardController { */ _onCardModelChange(e) { const node = /** @type {HTMLSelectElement} */ (e.currentTarget); - this._setModel(node.value); + void this._setModel(node.value); } /** @@ -605,7 +605,7 @@ class AnkiCardController { */ _onFieldChange(index, e) { const node = /** @type {HTMLInputElement} */ (e.currentTarget); - this._validateFieldPermissions(node, index, true); + void this._validateFieldPermissions(node, index, true); this._validateField(node, index); } @@ -624,7 +624,7 @@ class AnkiCardController { */ _onFieldSettingChanged(index, e) { const node = /** @type {HTMLInputElement} */ (e.currentTarget); - this._validateFieldPermissions(node, index, false); + void this._validateFieldPermissions(node, index, false); } /** @@ -731,7 +731,7 @@ class AnkiCardController { const inputField = querySelectorNotNull(content, '.anki-card-field-value'); inputField.value = fieldValue; inputField.dataset.setting = ObjectPropertyAccessor.getPathString(['anki', this._optionsType, 'fields', fieldName]); - this._validateFieldPermissions(inputField, index, false); + void this._validateFieldPermissions(inputField, index, false); this._fieldEventListeners.addEventListener(inputField, 'change', this._onFieldChange.bind(this, index), false); this._fieldEventListeners.addEventListener(inputField, 'input', this._onFieldInput.bind(this, index), false); @@ -769,7 +769,7 @@ class AnkiCardController { container.appendChild(totalFragment); } - this._validateFields(); + void this._validateFields(); } /** */ diff --git a/ext/js/pages/settings/anki-templates-controller.js b/ext/js/pages/settings/anki-templates-controller.js index 332102cf..a0a6bd6c 100644 --- a/ext/js/pages/settings/anki-templates-controller.js +++ b/ext/js/pages/settings/anki-templates-controller.js @@ -156,7 +156,7 @@ export class AnkiTemplatesController { /** */ _onValidateCompile() { if (this._compileResultInfo === null) { return; } - this._validate(this._compileResultInfo, '{expression}', 'term-kanji', false, true); + void this._validate(this._compileResultInfo, '{expression}', 'term-kanji', false, true); } /** @@ -169,7 +169,7 @@ export class AnkiTemplatesController { const infoNode = /** @type {HTMLElement} */ (this._renderResult); infoNode.hidden = true; this._cachedDictionaryEntryText = null; - this._validate(infoNode, field, 'term-kanji', true, false); + void this._validate(infoNode, field, 'term-kanji', true, false); } /** diff --git a/ext/js/pages/settings/audio-controller.js b/ext/js/pages/settings/audio-controller.js index 5b597d33..ab7e377c 100644 --- a/ext/js/pages/settings/audio-controller.js +++ b/ext/js/pages/settings/audio-controller.js @@ -134,7 +134,7 @@ export class AudioController extends EventDispatcher { /** */ _onAddAudioSource() { - this._addAudioSource(); + void this._addAudioSource(); } /** */ @@ -145,7 +145,7 @@ export class AudioController extends EventDispatcher { const voiceUri = input.dataset.voice; const audio = this._audioSystem.createTextToSpeechAudio(text, typeof voiceUri === 'string' ? voiceUri : ''); audio.volume = 1; - audio.play(); + void audio.play(); } catch (e) { // NOP } @@ -352,7 +352,7 @@ class AudioSourceEntry { const element = /** @type {HTMLSelectElement} */ (e.currentTarget); const value = this._normalizeAudioSourceType(element.value); if (value === null) { return; } - this._setType(value); + void this._setType(value); } /** @@ -360,7 +360,7 @@ class AudioSourceEntry { */ _onUrlInputChange(e) { const element = /** @type {HTMLInputElement} */ (e.currentTarget); - this._setUrl(element.value); + void this._setUrl(element.value); } /** @@ -368,7 +368,7 @@ class AudioSourceEntry { */ _onVoiceSelectChange(e) { const element = /** @type {HTMLSelectElement} */ (e.currentTarget); - this._setVoice(element.value); + void this._setVoice(element.value); } /** @@ -403,7 +403,7 @@ class AudioSourceEntry { this._showHelp(this._type); break; case 'remove': - this._parent.removeSource(this); + void this._parent.removeSource(this); break; } } diff --git a/ext/js/pages/settings/backup-controller.js b/ext/js/pages/settings/backup-controller.js index 18991140..2a0706e4 100644 --- a/ext/js/pages/settings/backup-controller.js +++ b/ext/js/pages/settings/backup-controller.js @@ -642,7 +642,7 @@ export class BackupController { await Dexie.import(file, { progressCallback: this._databaseImportProgressCallback.bind(this) }); - this._settingsController.application.api.triggerDatabaseUpdated('dictionary', 'import'); + void this._settingsController.application.api.triggerDatabaseUpdated('dictionary', 'import'); this._settingsController.application.triggerStorageChanged(); } diff --git a/ext/js/pages/settings/collapsible-dictionary-controller.js b/ext/js/pages/settings/collapsible-dictionary-controller.js index 62f84b96..f2a03b5c 100644 --- a/ext/js/pages/settings/collapsible-dictionary-controller.js +++ b/ext/js/pages/settings/collapsible-dictionary-controller.js @@ -99,7 +99,7 @@ export class CollapsibleDictionaryController { /** */ _onDefinitionsCollapsibleChange() { - this._updateAllSelectFresh(); + void this._updateAllSelectFresh(); } /** @@ -109,7 +109,7 @@ export class CollapsibleDictionaryController { const {value} = /** @type {HTMLSelectElement} */ (e.currentTarget); const value2 = this._normalizeDictionaryDefinitionsCollapsible(value); if (value2 === null) { return; } - this._setDefinitionsCollapsibleAll(value2); + void this._setDefinitionsCollapsibleAll(value2); } /** */ diff --git a/ext/js/pages/settings/dictionary-controller.js b/ext/js/pages/settings/dictionary-controller.js index 66ff0923..a6760268 100644 --- a/ext/js/pages/settings/dictionary-controller.js +++ b/ext/js/pages/settings/dictionary-controller.js @@ -149,7 +149,7 @@ class DictionaryEntry { _onEnabledChanged(e) { const {detail: {value}} = e; this._titleContainer.dataset.enabled = `${value}`; - this._dictionaryController.updateDictionariesEnabled(); + void this._dictionaryController.updateDictionariesEnabled(); } /** */ @@ -255,7 +255,7 @@ class DictionaryEntry { * @param {number} offset */ _move(offset) { - this._dictionaryController.moveDictionaryOptions(this._index, this._index + offset); + void this._dictionaryController.moveDictionaryOptions(this._index, this._index + offset); } /** @@ -598,7 +598,7 @@ export class DictionaryController { _onOptionsChanged({options}) { this._updateDictionariesEnabledWarnings(options); if (this._dictionaries !== null) { - this._updateEntries(); + void this._updateEntries(); } } @@ -620,7 +620,7 @@ export class DictionaryController { const allCheckbox = /** @type {HTMLInputElement} */ (this._allCheckbox); const value = allCheckbox.checked; allCheckbox.checked = !value; - this._setAllDictionariesEnabled(value); + void this._setAllDictionariesEnabled(value); } /** */ @@ -718,7 +718,7 @@ export class DictionaryController { if (typeof title !== 'string') { return; } delete modal.node.dataset.dictionaryTitle; - this._deleteDictionary(title); + void this._deleteDictionary(title); } /** @@ -726,7 +726,7 @@ export class DictionaryController { */ _onCheckIntegrityButtonClick(e) { e.preventDefault(); - this._checkIntegrity(); + void this._checkIntegrity(); } /** */ @@ -743,7 +743,7 @@ export class DictionaryController { if (!Number.isFinite(target) || !Number.isFinite(indexNumber) || indexNumber === target) { return; } - this.moveDictionaryOptions(indexNumber, target); + void this.moveDictionaryOptions(indexNumber, target); } /** @@ -916,7 +916,7 @@ export class DictionaryController { */ async _deleteDictionaryInternal(dictionaryTitle, onProgress) { await new DictionaryWorker().deleteDictionary(dictionaryTitle, onProgress); - this._settingsController.application.api.triggerDatabaseUpdated('dictionary', 'delete'); + void this._settingsController.application.api.triggerDatabaseUpdated('dictionary', 'delete'); } /** diff --git a/ext/js/pages/settings/dictionary-import-controller.js b/ext/js/pages/settings/dictionary-import-controller.js index f44ef380..13766d80 100644 --- a/ext/js/pages/settings/dictionary-import-controller.js +++ b/ext/js/pages/settings/dictionary-import-controller.js @@ -64,7 +64,7 @@ export class DictionaryImportController { } /** */ - async prepare() { + prepare() { this._purgeConfirmModal = this._modalController.getModal('dictionary-confirm-delete-all'); this._purgeButton.addEventListener('click', this._onPurgeButtonClick.bind(this), false); @@ -94,7 +94,7 @@ export class DictionaryImportController { _onPurgeConfirmButtonClick(e) { e.preventDefault(); /** @type {import('./modal.js').Modal} */ (this._purgeConfirmModal).setVisible(false); - this._purgeDatabase(); + void this._purgeDatabase(); } /** @@ -106,7 +106,7 @@ export class DictionaryImportController { if (files === null) { return; } const files2 = [...files]; node.value = ''; - this._importDictionaries(files2); + void this._importDictionaries(files2); } /** */ @@ -235,7 +235,7 @@ export class DictionaryImportController { async _importDictionary(file, importDetails, onProgress) { const archiveContent = await this._readFile(file); const {result, errors} = await new DictionaryWorker().importDictionary(archiveContent, importDetails, onProgress); - this._settingsController.application.api.triggerDatabaseUpdated('dictionary', 'import'); + void this._settingsController.application.api.triggerDatabaseUpdated('dictionary', 'import'); const errors2 = await this._addDictionarySettings(result.sequenced, result.title); if (errors.length > 0) { diff --git a/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js b/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js index b9d107ae..1f55f391 100644 --- a/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js +++ b/ext/js/pages/settings/extension-keyboard-shortcuts-controller.js @@ -133,7 +133,7 @@ export class ExtensionKeyboardShortcutController { */ _onResetClick(e) { e.preventDefault(); - this._resetAllCommands(); + void this._resetAllCommands(); } /** @@ -141,7 +141,7 @@ export class ExtensionKeyboardShortcutController { */ _onClearClick(e) { e.preventDefault(); - this._clearAllCommands(); + void this._clearAllCommands(); } /** @@ -317,7 +317,7 @@ class ExtensionKeyboardShortcutHotkeyEntry { */ _onInputFieldChange(e) { const {key, modifiers} = e; - this._tryUpdateInput(key, modifiers, false); + void this._tryUpdateInput(key, modifiers, false); } /** */ @@ -331,10 +331,10 @@ class ExtensionKeyboardShortcutHotkeyEntry { _onMenuClose(e) { switch (e.detail.action) { case 'clearInput': - this._tryUpdateInput(null, [], true); + void this._tryUpdateInput(null, [], true); break; case 'resetInput': - this._resetInput(); + void this._resetInput(); break; } } diff --git a/ext/js/pages/settings/generic-setting-controller.js b/ext/js/pages/settings/generic-setting-controller.js index 7c082a96..54d87f8d 100644 --- a/ext/js/pages/settings/generic-setting-controller.js +++ b/ext/js/pages/settings/generic-setting-controller.js @@ -66,7 +66,7 @@ export class GenericSettingController { /** */ _onOptionsChanged() { - this._dataBinder.refresh(); + void this._dataBinder.refresh(); } /** diff --git a/ext/js/pages/settings/keyboard-shortcuts-controller.js b/ext/js/pages/settings/keyboard-shortcuts-controller.js index 0a01b836..b1ea6bb0 100644 --- a/ext/js/pages/settings/keyboard-shortcuts-controller.js +++ b/ext/js/pages/settings/keyboard-shortcuts-controller.js @@ -191,7 +191,7 @@ export class KeyboardShortcutController { */ _onAddClick(e) { e.preventDefault(); - this._addNewEntry(); + void this._addNewEntry(); } /** @@ -199,7 +199,7 @@ export class KeyboardShortcutController { */ _onResetClick(e) { e.preventDefault(); - this._reset(); + void this._reset(); } /** */ @@ -350,16 +350,16 @@ class KeyboardShortcutHotkeyEntry { _onMenuClose(e) { switch (e.detail.action) { case 'delete': - this._delete(); + void this._delete(); break; case 'clearInputs': /** @type {KeyboardMouseInputField} */ (this._inputField).clearInputs(); break; case 'resetInput': - this._resetInput(); + void this._resetInput(); break; case 'resetArgument': - this._resetArgument(); + void this._resetArgument(); break; } } @@ -404,7 +404,7 @@ class KeyboardShortcutHotkeyEntry { if (modifier2 === null) { continue; } modifiers2.push(modifier2); } - this._setKeyAndModifiers(key, modifiers2); + void this._setKeyAndModifiers(key, modifiers2); } /** @@ -414,7 +414,7 @@ class KeyboardShortcutHotkeyEntry { const node = /** @type {HTMLInputElement} */ (e.currentTarget); const scope = this._normalizeScope(node.dataset.scope); if (scope === null) { return; } - this._setScopeEnabled(scope, node.checked); + void this._setScopeEnabled(scope, node.checked); } /** @@ -423,7 +423,7 @@ class KeyboardShortcutHotkeyEntry { _onActionSelectChange(e) { const node = /** @type {HTMLSelectElement} */ (e.currentTarget); const value = node.value; - this._setAction(value); + void this._setAction(value); } /** @@ -438,12 +438,12 @@ class KeyboardShortcutHotkeyEntry { value = `${convertElementValueToNumber(value, node)}`; break; } - this._setArgument(value); + void this._setArgument(value); } /** */ async _delete() { - this._parent.deleteEntry(this._index); + void this._parent.deleteEntry(this._index); } /** @@ -607,7 +607,7 @@ class KeyboardShortcutHotkeyEntry { this._setArgumentInputValue(node, value); } - this._updateArgumentInputValidity(); + void this._updateArgumentInputValidity(); await this._modifyProfileSettings([{ action: 'set', @@ -702,7 +702,7 @@ class KeyboardShortcutHotkeyEntry { if (inputNode !== null) { this._setArgumentInputValue(inputNode, argument); this._argumentInput = inputNode; - this._updateArgumentInputValidity(); + void this._updateArgumentInputValidity(); this._argumentEventListeners.addEventListener(inputNode, 'change', this._onArgumentValueChange.bind(this, template), false); } if (this._argumentContainer !== null) { diff --git a/ext/js/pages/settings/mecab-controller.js b/ext/js/pages/settings/mecab-controller.js index ba2f6166..34c4045f 100644 --- a/ext/js/pages/settings/mecab-controller.js +++ b/ext/js/pages/settings/mecab-controller.js @@ -46,7 +46,7 @@ export class MecabController { */ _onTestButtonClick(e) { e.preventDefault(); - this._testMecab(); + void this._testMecab(); } /** */ diff --git a/ext/js/pages/settings/nested-popups-controller.js b/ext/js/pages/settings/nested-popups-controller.js index 077b1a66..fe0696d6 100644 --- a/ext/js/pages/settings/nested-popups-controller.js +++ b/ext/js/pages/settings/nested-popups-controller.js @@ -63,7 +63,7 @@ export class NestedPopupsController { const node = /** @type {HTMLInputElement} */ (e.currentTarget); const value = node.checked; if (value && this._popupNestingMaxDepth > 0) { return; } - this._setPopupNestingMaxDepth(value ? 1 : 0); + void this._setPopupNestingMaxDepth(value ? 1 : 0); } /** @@ -72,7 +72,7 @@ export class NestedPopupsController { _onNestedPopupsCountChange(e) { const node = /** @type {HTMLInputElement} */ (e.currentTarget); const value = Math.max(1, convertElementValueToNumber(node.value, node)); - this._setPopupNestingMaxDepth(value); + void this._setPopupNestingMaxDepth(value); } /** diff --git a/ext/js/pages/settings/permissions-origin-controller.js b/ext/js/pages/settings/permissions-origin-controller.js index 9447e3cc..ec04e81e 100644 --- a/ext/js/pages/settings/permissions-origin-controller.js +++ b/ext/js/pages/settings/permissions-origin-controller.js @@ -114,19 +114,19 @@ export class PermissionsOriginController { const {origin} = node.dataset; if (typeof origin !== 'string') { return; } - this._setOriginPermissionEnabled(origin, value); + void this._setOriginPermissionEnabled(origin, value); } /** * @param {string} origin */ _onOriginMenuClose(origin) { - this._setOriginPermissionEnabled(origin, false); + void this._setOriginPermissionEnabled(origin, false); } /** */ _onAddButtonClick() { - this._addOrigin(); + void this._addOrigin(); } /** */ diff --git a/ext/js/pages/settings/permissions-toggle-controller.js b/ext/js/pages/settings/permissions-toggle-controller.js index 25204dce..e094092c 100644 --- a/ext/js/pages/settings/permissions-toggle-controller.js +++ b/ext/js/pages/settings/permissions-toggle-controller.js @@ -69,7 +69,7 @@ export class PermissionsToggleController { } toggle.checked = !!value; } - this._updateValidity(); + void this._updateValidity(); } /** diff --git a/ext/js/pages/settings/persistent-storage-controller.js b/ext/js/pages/settings/persistent-storage-controller.js index 8b7726dd..e0ff75ee 100644 --- a/ext/js/pages/settings/persistent-storage-controller.js +++ b/ext/js/pages/settings/persistent-storage-controller.js @@ -70,7 +70,7 @@ export class PersistentStorageController { const node = /** @type {HTMLInputElement} */ (e.currentTarget); if (node.checked) { node.checked = false; - this._attemptPersistStorage(); + void this._attemptPersistStorage(); } else { node.checked = true; } diff --git a/ext/js/pages/settings/popup-preview-controller.js b/ext/js/pages/settings/popup-preview-controller.js index bd335460..8361809d 100644 --- a/ext/js/pages/settings/popup-preview-controller.js +++ b/ext/js/pages/settings/popup-preview-controller.js @@ -38,7 +38,7 @@ export class PopupPreviewController { } /** */ - async prepare() { + prepare() { if (new URLSearchParams(location.search).get('popup-preview') === 'false') { return; } this._customCss.addEventListener('input', this._onCustomCssChange.bind(this), false); diff --git a/ext/js/pages/settings/popup-preview-frame.js b/ext/js/pages/settings/popup-preview-frame.js index d3e21641..8d881cc6 100644 --- a/ext/js/pages/settings/popup-preview-frame.js +++ b/ext/js/pages/settings/popup-preview-frame.js @@ -89,7 +89,7 @@ export class PopupPreviewFrame { this._languageSummaries = await this._application.api.getLanguageSummaries(); const options = await this._application.api.optionsGet({current: true}); - this._onOptionsChanged({options, optionsContext: {current: true}}); + void this._onOptionsChanged({options, optionsContext: {current: true}}); // Overwrite frontend this._frontend = new Frontend({ @@ -115,7 +115,7 @@ export class PopupPreviewFrame { } // Update search - this._updateSearch(); + void this._updateSearch(); } // Private @@ -181,7 +181,7 @@ export class PopupPreviewFrame { this._themeChangeTimeout = null; const popup = /** @type {Frontend} */ (this._frontend).popup; if (popup === null) { return; } - popup.updateTheme(); + void popup.updateTheme(); }, 300); } @@ -229,7 +229,7 @@ export class PopupPreviewFrame { this._exampleText.textContent = text; if (this._frontend === null) { return; } - this._updateSearch(); + void this._updateSearch(); } /** @@ -249,7 +249,7 @@ export class PopupPreviewFrame { if (this._frontend === null) { return; } const popup = this._frontend.popup; if (popup === null) { return; } - popup.setCustomCss(css); + void popup.setCustomCss(css); } /** @@ -259,7 +259,7 @@ export class PopupPreviewFrame { if (this._frontend === null) { return; } const popup = this._frontend.popup; if (popup === null) { return; } - popup.setCustomOuterCss(css, false); + void popup.setCustomOuterCss(css, false); } /** diff --git a/ext/js/pages/settings/popup-window-controller.js b/ext/js/pages/settings/popup-window-controller.js index 62879f3b..ddf2eef6 100644 --- a/ext/js/pages/settings/popup-window-controller.js +++ b/ext/js/pages/settings/popup-window-controller.js @@ -41,7 +41,7 @@ export class PopupWindowController { */ _onTestWindowOpenLinkClick(e) { e.preventDefault(); - this._testWindowOpen(); + void this._testWindowOpen(); } /** */ diff --git a/ext/js/pages/settings/profile-conditions-ui.js b/ext/js/pages/settings/profile-conditions-ui.js index d2bf03bf..8f53232a 100644 --- a/ext/js/pages/settings/profile-conditions-ui.js +++ b/ext/js/pages/settings/profile-conditions-ui.js @@ -266,7 +266,7 @@ export class ProfileConditionsUI extends EventDispatcher { this._children[i].index = i; } - this.settingsController.modifyGlobalSettings([{ + void this.settingsController.modifyGlobalSettings([{ action: 'splice', path: this.getPath('conditionGroups'), start: index, @@ -333,7 +333,7 @@ export class ProfileConditionsUI extends EventDispatcher { this._addConditionGroup(conditionGroup, index); - this.settingsController.modifyGlobalSettings([{ + void this.settingsController.modifyGlobalSettings([{ action: 'splice', path: this.getPath('conditionGroups'), start: index, @@ -543,7 +543,7 @@ class ProfileConditionGroupUI { this._children[i].index = i; } - this.settingsController.modifyGlobalSettings([{ + void this.settingsController.modifyGlobalSettings([{ action: 'splice', path: this.getPath('conditions'), start: index, @@ -581,7 +581,7 @@ class ProfileConditionGroupUI { this._addCondition(condition, index); - this.settingsController.modifyGlobalSettings([{ + void this.settingsController.modifyGlobalSettings([{ action: 'splice', path: this.getPath('conditions'), start: index, @@ -714,7 +714,7 @@ class ProfileConditionUI { const element = /** @type {HTMLSelectElement} */ (e.currentTarget); const type = ProfileConditionsUI.normalizeProfileConditionType(element.value); if (type === null) { return; } - this._setType(type); + void this._setType(type); } /** @@ -725,7 +725,7 @@ class ProfileConditionUI { const type = ProfileConditionsUI.normalizeProfileConditionType(this._typeInput.value); if (type === null) { return; } const operator = element.value; - this._setOperator(type, operator); + void this._setOperator(type, operator); } /** @@ -740,7 +740,7 @@ class ProfileConditionUI { if (okay) { const normalizedValue = this._normalizeValue(value, normalize); node.value = normalizedValue; - this.settingsController.setGlobalSetting(this.getPath('value'), normalizedValue); + void this.settingsController.setGlobalSetting(this.getPath('value'), normalizedValue); } } @@ -754,7 +754,7 @@ class ProfileConditionUI { this._value = modifiers; if (okay) { const normalizedValue = this._normalizeValue(modifiers, normalize); - this.settingsController.setGlobalSetting(this.getPath('value'), normalizedValue); + void this.settingsController.setGlobalSetting(this.getPath('value'), normalizedValue); } } @@ -782,7 +782,7 @@ class ProfileConditionUI { this._parent.removeSelf(); break; case 'resetValue': - this._resetValue(); + void this._resetValue(); break; } } diff --git a/ext/js/pages/settings/profile-controller.js b/ext/js/pages/settings/profile-controller.js index a82a4b4e..9d4ed33b 100644 --- a/ext/js/pages/settings/profile-controller.js +++ b/ext/js/pages/settings/profile-controller.js @@ -98,7 +98,7 @@ export class ProfileController { this._profileConditionsUI.on('conditionGroupCountChanged', this._onConditionGroupCountChanged.bind(this)); this._settingsController.on('optionsChanged', this._onOptionsChanged.bind(this)); - this._onOptionsChanged(); + void this._onOptionsChanged(); } /** @@ -376,7 +376,7 @@ export class ProfileController { this._profileConditionsUI.cleanup(); this._profileConditionsIndex = profileIndex; - this._profileConditionsUI.prepare(profileIndex); + void this._profileConditionsUI.prepare(profileIndex); if (this._profileConditionsProfileName !== null) { this._profileConditionsProfileName.textContent = profile.name; } @@ -403,7 +403,7 @@ export class ProfileController { this._profileConditionsUI.cleanup(); const conditionsProfile = this._getProfile(this._profileConditionsIndex !== null ? this._profileConditionsIndex : settingsProfileIndex); if (conditionsProfile !== null) { - this._profileConditionsUI.prepare(settingsProfileIndex); + void this._profileConditionsUI.prepare(settingsProfileIndex); } // Udpate profile entries @@ -425,7 +425,7 @@ export class ProfileController { const element = /** @type {HTMLSelectElement} */ (e.currentTarget); const value = this._tryGetValidProfileIndex(element.value); if (value === null) { return; } - this.setDefaultProfile(value); + void this.setDefaultProfile(value); } /** @@ -440,7 +440,7 @@ export class ProfileController { /** */ _onAdd() { - this.duplicateProfile(this._settingsController.profileIndex); + void this.duplicateProfile(this._settingsController.profileIndex); } /** */ @@ -454,7 +454,7 @@ export class ProfileController { const validProfileIndex = this._tryGetValidProfileIndex(profileIndex); if (validProfileIndex === null) { return; } - this.deleteProfile(validProfileIndex); + void this.deleteProfile(validProfileIndex); } /** */ @@ -471,7 +471,7 @@ export class ProfileController { const sourceProfileIndex = this._tryGetValidProfileIndex(/** @type {HTMLSelectElement} */ (this._profileCopySourceSelect).value); if (sourceProfileIndex === null) { return; } - this.copyProfile(sourceProfileIndex, validDestinationProfileIndex); + void this.copyProfile(sourceProfileIndex, validDestinationProfileIndex); } /** @@ -738,7 +738,7 @@ class ProfileEntry { _onIsDefaultRadioChange(e) { const element = /** @type {HTMLInputElement} */ (e.currentTarget); if (!element.checked) { return; } - this._profileController.setDefaultProfile(this._index); + void this._profileController.setDefaultProfile(this._index); } /** @@ -747,7 +747,7 @@ class ProfileEntry { _onNameInputInput(e) { const element = /** @type {HTMLInputElement} */ (e.currentTarget); const name = element.value; - this._profileController.setProfileName(this._index, name); + void this._profileController.setProfileName(this._index, name); } /** */ @@ -773,10 +773,10 @@ class ProfileEntry { _onMenuClose(e) { switch (e.detail.action) { case 'moveUp': - this._profileController.moveProfile(this._index, -1); + void this._profileController.moveProfile(this._index, -1); break; case 'moveDown': - this._profileController.moveProfile(this._index, 1); + void this._profileController.moveProfile(this._index, 1); break; case 'copyFrom': this._profileController.openCopyProfileModal(this._index); @@ -785,7 +785,7 @@ class ProfileEntry { this._profileController.openProfileConditionsModal(this._index); break; case 'duplicate': - this._profileController.duplicateProfile(this._index); + void this._profileController.duplicateProfile(this._index); break; case 'delete': this._profileController.openDeleteProfileModal(this._index); diff --git a/ext/js/pages/settings/recommended-permissions-controller.js b/ext/js/pages/settings/recommended-permissions-controller.js index b7bb1ea8..8aff51c4 100644 --- a/ext/js/pages/settings/recommended-permissions-controller.js +++ b/ext/js/pages/settings/recommended-permissions-controller.js @@ -73,7 +73,7 @@ export class RecommendedPermissionsController { const {origin} = node.dataset; if (typeof origin !== 'string') { return; } - this._setOriginPermissionEnabled(origin, value); + void this._setOriginPermissionEnabled(origin, value); } /** */ diff --git a/ext/js/pages/settings/scan-inputs-controller.js b/ext/js/pages/settings/scan-inputs-controller.js index 144eae9f..fcaad589 100644 --- a/ext/js/pages/settings/scan-inputs-controller.js +++ b/ext/js/pages/settings/scan-inputs-controller.js @@ -51,7 +51,7 @@ export class ScanInputsController { this._settingsController.on('scanInputsChanged', this._onScanInputsChanged.bind(this)); this._settingsController.on('optionsChanged', this._onOptionsChanged.bind(this)); - this.refresh(); + await this.refresh(); } /** @@ -67,7 +67,7 @@ export class ScanInputsController { this._entries[i].index = i; } this._updateCounts(); - this._modifyProfileSettings([{ + void this._modifyProfileSettings([{ action: 'splice', path: 'scanning.inputs', start: index, @@ -113,7 +113,7 @@ export class ScanInputsController { */ _onScanInputsChanged({source}) { if (source === this) { return; } - this.refresh(); + void this.refresh(); } /** @@ -144,7 +144,7 @@ export class ScanInputsController { const scanningInput = ScanInputsController.createDefaultMouseInput('', ''); this._addOption(index, scanningInput); this._updateCounts(); - this._modifyProfileSettings([{ + void this._modifyProfileSettings([{ action: 'splice', path: 'scanning.inputs', start: index, @@ -315,7 +315,7 @@ class ScanInputField { */ _onIncludeValueChange({modifiers}) { const modifiers2 = this._joinModifiers(modifiers); - this._parent.setProperty(this._index, 'include', modifiers2, true); + void this._parent.setProperty(this._index, 'include', modifiers2, true); } /** @@ -323,7 +323,7 @@ class ScanInputField { */ _onExcludeValueChange({modifiers}) { const modifiers2 = this._joinModifiers(modifiers); - this._parent.setProperty(this._index, 'exclude', modifiers2, true); + void this._parent.setProperty(this._index, 'exclude', modifiers2, true); } /** @@ -406,7 +406,7 @@ class ScanInputField { if (this._node !== null) { this._node.dataset.showAdvanced = `${showAdvanced}`; } - this._parent.setProperty(this._index, 'options.showAdvanced', showAdvanced, false); + void this._parent.setProperty(this._index, 'options.showAdvanced', showAdvanced, false); } /** diff --git a/ext/js/pages/settings/scan-inputs-simple-controller.js b/ext/js/pages/settings/scan-inputs-simple-controller.js index b09a3a76..53a52922 100644 --- a/ext/js/pages/settings/scan-inputs-simple-controller.js +++ b/ext/js/pages/settings/scan-inputs-simple-controller.js @@ -70,7 +70,7 @@ export class ScanInputsSimpleController { */ _onScanInputsChanged({source}) { if (source === this) { return; } - this.refresh(); + void this.refresh(); } /** @@ -112,7 +112,7 @@ export class ScanInputsSimpleController { onMiddleMouseButtonScanChange(e) { const element = /** @type {HTMLInputElement} */ (e.currentTarget); const middleMouseSupported = element.checked; - this._setMiddleMouseSuppported(middleMouseSupported); + void this._setMiddleMouseSuppported(middleMouseSupported); } /** @@ -123,7 +123,7 @@ export class ScanInputsSimpleController { const mainScanKey = element.value; if (mainScanKey === 'other') { return; } const mainScanInputs = (mainScanKey === 'none' ? [] : [mainScanKey]); - this._setMainScanInputs(mainScanInputs); + void this._setMainScanInputs(mainScanInputs); } /** diff --git a/ext/js/pages/settings/sentence-termination-characters-controller.js b/ext/js/pages/settings/sentence-termination-characters-controller.js index 4ceed22b..7eee3d3e 100644 --- a/ext/js/pages/settings/sentence-termination-characters-controller.js +++ b/ext/js/pages/settings/sentence-termination-characters-controller.js @@ -135,7 +135,7 @@ export class SentenceTerminationCharactersController { */ _onAddClick(e) { e.preventDefault(); - this._addNewEntry(); + void this._addNewEntry(); } /** @@ -143,7 +143,7 @@ export class SentenceTerminationCharactersController { */ _onResetClick(e) { e.preventDefault(); - this._reset(); + void this._reset(); } /** */ @@ -258,7 +258,7 @@ class SentenceTerminationCharacterEntry { */ _onTypeSelectChange(e) { const element = /** @type {HTMLSelectElement} */ (e.currentTarget); - this._setHasCharacter2(element.value === 'quote'); + void this._setHasCharacter2(element.value === 'quote'); } /** @@ -272,7 +272,7 @@ class SentenceTerminationCharacterEntry { } const value = node.value.substring(0, 1); - this._setCharacterValue(node, characterNumber, value); + void this._setCharacterValue(node, characterNumber, value); } /** @@ -281,14 +281,14 @@ class SentenceTerminationCharacterEntry { _onMenuClose(e) { switch (e.detail.action) { case 'delete': - this._delete(); + void this._delete(); break; } } /** */ async _delete() { - this._parent.deleteEntry(this._index); + void this._parent.deleteEntry(this._index); } /** diff --git a/ext/js/pages/settings/settings-controller.js b/ext/js/pages/settings/settings-controller.js index d0cfd838..282479de 100644 --- a/ext/js/pages/settings/settings-controller.js +++ b/ext/js/pages/settings/settings-controller.js @@ -239,7 +239,7 @@ export class SettingsController extends EventDispatcher { _setProfileIndex(value, canUpdateProfileIndex) { this._profileIndex = value; this.trigger('optionsContextChanged', {}); - this._onOptionsUpdatedInternal(canUpdateProfileIndex); + void this._onOptionsUpdatedInternal(canUpdateProfileIndex); } /** @@ -247,7 +247,7 @@ export class SettingsController extends EventDispatcher { */ _onOptionsUpdated({source}) { if (source === this._source) { return; } - this._onOptionsUpdatedInternal(true); + void this._onOptionsUpdatedInternal(true); } /** @@ -332,7 +332,7 @@ export class SettingsController extends EventDispatcher { /** */ _onPermissionsChanged() { - this._triggerPermissionsChanged(); + void this._triggerPermissionsChanged(); } /** */ diff --git a/ext/js/pages/settings/settings-main.js b/ext/js/pages/settings/settings-main.js index 82fc91a5..df43df9b 100644 --- a/ext/js/pages/settings/settings-main.js +++ b/ext/js/pages/settings/settings-main.js @@ -91,13 +91,13 @@ await Application.main(true, async (application) => { await settingsController.prepare(); const persistentStorageController = new PersistentStorageController(application); - persistentStorageController.prepare(); + preparePromises.push(persistentStorageController.prepare()); const storageController = new StorageController(persistentStorageController); storageController.prepare(); const dictionaryController = new DictionaryController(settingsController, modalController, statusFooter); - dictionaryController.prepare(); + preparePromises.push(dictionaryController.prepare()); const dictionaryImportController = new DictionaryImportController(settingsController, modalController, statusFooter); dictionaryImportController.prepare(); @@ -106,52 +106,52 @@ await Application.main(true, async (application) => { preparePromises.push(setupGenericSettingController(genericSettingController)); const audioController = new AudioController(settingsController, modalController); - audioController.prepare(); + preparePromises.push(audioController.prepare()); const profileController = new ProfileController(settingsController, modalController); - profileController.prepare(); + preparePromises.push(profileController.prepare()); const settingsBackup = new BackupController(settingsController, modalController); - settingsBackup.prepare(); + preparePromises.push(settingsBackup.prepare()); const ankiController = new AnkiController(settingsController); - ankiController.prepare(); + preparePromises.push(ankiController.prepare()); const ankiTemplatesController = new AnkiTemplatesController(settingsController, modalController, ankiController); - ankiTemplatesController.prepare(); + preparePromises.push(ankiTemplatesController.prepare()); const popupPreviewController = new PopupPreviewController(settingsController); popupPreviewController.prepare(); const scanInputsController = new ScanInputsController(settingsController); - scanInputsController.prepare(); + preparePromises.push(scanInputsController.prepare()); const simpleScanningInputController = new ScanInputsSimpleController(settingsController); - simpleScanningInputController.prepare(); + preparePromises.push(simpleScanningInputController.prepare()); const nestedPopupsController = new NestedPopupsController(settingsController); - nestedPopupsController.prepare(); + preparePromises.push(nestedPopupsController.prepare()); const permissionsToggleController = new PermissionsToggleController(settingsController); - permissionsToggleController.prepare(); + preparePromises.push(permissionsToggleController.prepare()); const secondarySearchDictionaryController = new SecondarySearchDictionaryController(settingsController); - secondarySearchDictionaryController.prepare(); + preparePromises.push(secondarySearchDictionaryController.prepare()); const languagesController = new LanguagesController(settingsController); - languagesController.prepare(); + preparePromises.push(languagesController.prepare()); const translationTextReplacementsController = new TranslationTextReplacementsController(settingsController); - translationTextReplacementsController.prepare(); + preparePromises.push(translationTextReplacementsController.prepare()); const sentenceTerminationCharactersController = new SentenceTerminationCharactersController(settingsController); - sentenceTerminationCharactersController.prepare(); + preparePromises.push(sentenceTerminationCharactersController.prepare()); const keyboardShortcutController = new KeyboardShortcutController(settingsController); - keyboardShortcutController.prepare(); + preparePromises.push(keyboardShortcutController.prepare()); const extensionKeyboardShortcutController = new ExtensionKeyboardShortcutController(settingsController); - extensionKeyboardShortcutController.prepare(); + preparePromises.push(extensionKeyboardShortcutController.prepare()); const popupWindowController = new PopupWindowController(application.api); popupWindowController.prepare(); @@ -160,10 +160,10 @@ await Application.main(true, async (application) => { mecabController.prepare(); const collapsibleDictionaryController = new CollapsibleDictionaryController(settingsController); - collapsibleDictionaryController.prepare(); + preparePromises.push(collapsibleDictionaryController.prepare()); const sortFrequencyDictionaryController = new SortFrequencyDictionaryController(settingsController); - sortFrequencyDictionaryController.prepare(); + preparePromises.push(sortFrequencyDictionaryController.prepare()); await Promise.all(preparePromises); diff --git a/ext/js/pages/settings/sort-frequency-dictionary-controller.js b/ext/js/pages/settings/sort-frequency-dictionary-controller.js index c8e9918b..a88a2d47 100644 --- a/ext/js/pages/settings/sort-frequency-dictionary-controller.js +++ b/ext/js/pages/settings/sort-frequency-dictionary-controller.js @@ -79,7 +79,7 @@ export class SortFrequencyDictionaryController { /** */ _onSortFrequencyDictionarySelectChange() { const {value} = /** @type {HTMLSelectElement} */ (this._sortFrequencyDictionarySelect); - this._setSortFrequencyDictionaryValue(value !== '' ? value : null); + void this._setSortFrequencyDictionaryValue(value !== '' ? value : null); } /** */ @@ -87,14 +87,14 @@ export class SortFrequencyDictionaryController { const {value} = /** @type {HTMLSelectElement} */ (this._sortFrequencyDictionaryOrderSelect); const value2 = this._normalizeSortFrequencyDictionaryOrder(value); if (value2 === null) { return; } - this._setSortFrequencyDictionaryOrderValue(value2); + void this._setSortFrequencyDictionaryOrderValue(value2); } /** */ _onSortFrequencyDictionaryOrderAutoButtonClick() { const {value} = /** @type {HTMLSelectElement} */ (this._sortFrequencyDictionarySelect); if (value === '') { return; } - this._autoUpdateOrder(value); + void this._autoUpdateOrder(value); } /** diff --git a/ext/js/pages/settings/storage-controller.js b/ext/js/pages/settings/storage-controller.js index 9a3aa23a..31331d90 100644 --- a/ext/js/pages/settings/storage-controller.js +++ b/ext/js/pages/settings/storage-controller.js @@ -62,19 +62,19 @@ export class StorageController { storageRefreshButton.addEventListener('click', this._onStorageRefreshButtonClick.bind(this), false); this._persistentStorageController.application.on('storageChanged', this._onStorageChanged.bind(this)); - this._updateStats(); + void this._updateStats(); } // Private /** */ _onStorageRefreshButtonClick() { - this._updateStats(); + void this._updateStats(); } /** */ _onStorageChanged() { - this._updateStats(); + void this._updateStats(); } /** */ diff --git a/ext/js/pages/settings/translation-text-replacements-controller.js b/ext/js/pages/settings/translation-text-replacements-controller.js index 98a16026..f2255ae0 100644 --- a/ext/js/pages/settings/translation-text-replacements-controller.js +++ b/ext/js/pages/settings/translation-text-replacements-controller.js @@ -133,7 +133,7 @@ export class TranslationTextReplacementsController { /** */ _onAdd() { - this.addGroup(); + void this.addGroup(); } /** */ @@ -242,7 +242,7 @@ class TranslationTextReplacementsEntry { _onMenuClose(e) { switch (e.detail.action) { case 'remove': - this._parent.deleteGroup(this._index); + void this._parent.deleteGroup(this._index); break; case 'showTest': this._setTestVisible(true); diff --git a/ext/js/pages/welcome-main.js b/ext/js/pages/welcome-main.js index d1d1a6b2..23511dd6 100644 --- a/ext/js/pages/welcome-main.js +++ b/ext/js/pages/welcome-main.js @@ -49,6 +49,15 @@ async function setupGenericSettingsController(genericSettingController) { await genericSettingController.refresh(); } +/** */ +async function checkNeedsCustomTemplatesWarning() { + const key = 'needsCustomTemplatesWarning'; + const result = await chrome.storage.session.get({[key]: false}); + if (!result[key]) { return; } + document.documentElement.dataset.warnCustomTemplates = 'true'; + await chrome.storage.session.remove([key]); +} + await Application.main(true, async (application) => { const documentFocusController = new DocumentFocusController(); documentFocusController.prepare(); @@ -61,14 +70,8 @@ await Application.main(true, async (application) => { const statusFooter = new StatusFooter(statusFooterElement); statusFooter.prepare(); - setupEnvironmentInfo(application.api); - - chrome.storage.session.get({needsCustomTemplatesWarning: false}).then((result) => { - if (result.needsCustomTemplatesWarning) { - document.documentElement.dataset.warnCustomTemplates = 'true'; - chrome.storage.session.remove(['needsCustomTemplatesWarning']); - } - }); + void setupEnvironmentInfo(application.api); + void checkNeedsCustomTemplatesWarning(); const preparePromises = []; @@ -79,19 +82,19 @@ await Application.main(true, async (application) => { await settingsController.prepare(); const dictionaryController = new DictionaryController(settingsController, modalController, statusFooter); - dictionaryController.prepare(); + preparePromises.push(dictionaryController.prepare()); const dictionaryImportController = new DictionaryImportController(settingsController, modalController, statusFooter); - dictionaryImportController.prepare(); + preparePromises.push(dictionaryImportController.prepare()); const genericSettingController = new GenericSettingController(settingsController); preparePromises.push(setupGenericSettingsController(genericSettingController)); const simpleScanningInputController = new ScanInputsSimpleController(settingsController); - simpleScanningInputController.prepare(); + preparePromises.push(simpleScanningInputController.prepare()); const recommendedPermissionsController = new RecommendedPermissionsController(settingsController); - recommendedPermissionsController.prepare(); + preparePromises.push(recommendedPermissionsController.prepare()); await Promise.all(preparePromises); -- cgit v1.2.3