diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-19 07:30:17 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-19 12:30:17 +0000 |
commit | 2da866f982930c76d2317a3be426410683ecf5a2 (patch) | |
tree | e77ce545177ba398068cb63037096a56dea04e2c /ext/js/background | |
parent | 65fa65fc7765bc9a6557d3ce6f8bdcef5b5e0cf7 (diff) |
Update eslint rules (#710)
Diffstat (limited to 'ext/js/background')
-rw-r--r-- | ext/js/background/backend.js | 35 | ||||
-rw-r--r-- | ext/js/background/background-main.js | 2 | ||||
-rw-r--r-- | ext/js/background/offscreen-proxy.js | 2 |
3 files changed, 20 insertions, 19 deletions
diff --git a/ext/js/background/backend.js b/ext/js/background/backend.js index c0410ab8..8b0853d2 100644 --- a/ext/js/background/backend.js +++ b/ext/js/background/backend.js @@ -216,7 +216,7 @@ export class Backend { this._prepareCompleteReject(error); } ); - promise.finally(() => this._updateBadge()); + void promise.finally(() => this._updateBadge()); this._preparePromise = promise; } return this._prepareCompletePromise; @@ -282,7 +282,7 @@ export class Backend { /** @type {import('language-transformer').LanguageTransformDescriptor} */ const descriptor = await fetchJson('/data/language/japanese-transforms.json'); - this._translator.prepare(descriptor); + void this._translator.prepare(descriptor); await this._optionsUtil.prepare(); this._defaultAnkiFieldTemplates = (await fetchText('/data/templates/default-anki-field-templates.handlebars')).trim(); @@ -292,7 +292,7 @@ export class Backend { const options = this._getProfileOptions({current: true}, false); if (options.general.showGuide) { - this._openWelcomeGuidePageOnce(); + void this._openWelcomeGuidePageOnce(); } this._clipboardMonitor.on('change', this._onClipboardTextChange.bind(this)); @@ -409,7 +409,7 @@ export class Backend { * @returns {void} */ _onPermissionsChanged() { - this._checkPermissions(); + void this._checkPermissions(); } /** @@ -417,7 +417,7 @@ export class Backend { */ _onInstalled({reason}) { if (reason !== 'install') { return; } - this._requestPersistentStorage(); + void this._requestPersistentStorage(); } // Message handlers @@ -1047,7 +1047,7 @@ export class Backend { if (this._searchPopupTabCreatePromise === null) { const promise = this._getOrCreateSearchPopup(); this._searchPopupTabCreatePromise = promise; - promise.then(() => { this._searchPopupTabCreatePromise = null; }); + void promise.then(() => { this._searchPopupTabCreatePromise = null; }); } return this._searchPopupTabCreatePromise; } @@ -1239,7 +1239,7 @@ export class Backend { this._clipboardMonitor.stop(); } - this._accessibilityController.update(this._getOptionsFull(false)); + void this._accessibilityController.update(this._getOptionsFull(false)); this._sendMessageAllTabsIgnoreResponse({action: 'applicationOptionsUpdated', params: {source}}); } @@ -1612,16 +1612,16 @@ export class Backend { } if (color !== null && typeof chrome.action.setBadgeBackgroundColor === 'function') { - chrome.action.setBadgeBackgroundColor({color}); + void chrome.action.setBadgeBackgroundColor({color}); } if (text !== null && typeof chrome.action.setBadgeText === 'function') { - chrome.action.setBadgeText({text}); + void chrome.action.setBadgeText({text}); } if (typeof chrome.action.setTitle === 'function') { if (status !== null) { title = `${title} - ${status}`; } - chrome.action.setTitle({title}); + void chrome.action.setTitle({title}); } } @@ -2339,7 +2339,7 @@ export class Backend { * @param {import('backend').DatabaseUpdateCause} cause */ _triggerDatabaseUpdated(type, cause) { - this._translator.clearDatabaseCaches(); + void this._translator.clearDatabaseCaches(); this._sendMessageAllTabsIgnoreResponse({action: 'applicationDatabaseUpdated', params: {type, cause}}); } @@ -2468,12 +2468,13 @@ export class Backend { * @returns {Promise<void>} */ async _openWelcomeGuidePageOnce() { - chrome.storage.session.get(['openedWelcomePage']).then((result) => { - if (!result.openedWelcomePage) { - this._openWelcomeGuidePage(); - chrome.storage.session.set({openedWelcomePage: true}); - } - }); + const result = await chrome.storage.session.get(['openedWelcomePage']); + if (!result.openedWelcomePage) { + await Promise.all([ + this._openWelcomeGuidePage(), + chrome.storage.session.set({openedWelcomePage: true}) + ]); + } } /** diff --git a/ext/js/background/background-main.js b/ext/js/background/background-main.js index b7e45cd1..6d94b714 100644 --- a/ext/js/background/background-main.js +++ b/ext/js/background/background-main.js @@ -29,4 +29,4 @@ async function main() { await backend.prepare(); } -main(); +void main(); diff --git a/ext/js/background/offscreen-proxy.js b/ext/js/background/offscreen-proxy.js index 5a79f41a..c888fe29 100644 --- a/ext/js/background/offscreen-proxy.js +++ b/ext/js/background/offscreen-proxy.js @@ -259,7 +259,7 @@ export class ClipboardReaderProxy { set browser(value) { if (this._browser === value) { return; } this._browser = value; - this._offscreen.sendMessagePromise({action: 'clipboardSetBrowserOffscreen', params: {value}}); + void this._offscreen.sendMessagePromise({action: 'clipboardSetBrowserOffscreen', params: {value}}); } /** |