diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-14 22:26:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-15 03:26:29 +0000 |
commit | 6bf7b0055765c4f2011c9614753d6714dc09be65 (patch) | |
tree | 0e782ae66556eaa61a34d9f32d77c831b2443ce5 /ext/js/display/display.js | |
parent | 7a4096240ce4faf70a785d047945388baa0daab3 (diff) |
Eslint rule updates (#673)
* Install unicorn
* Add rules
* Fix issues
* Install sonarjs
* Set up rules
* Fix issues
* Install eslint-plugin-import and fix import extensions
* Simplify permitted error names
Diffstat (limited to 'ext/js/display/display.js')
-rw-r--r-- | ext/js/display/display.js | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js index a5dad2d1..d30ed8a0 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -619,7 +619,7 @@ export class Display extends EventDispatcher { if (node === null) { return -1; } const {index} = node.dataset; if (typeof index !== 'string') { return -1; } - const indexNumber = parseInt(index, 10); + const indexNumber = Number.parseInt(index, 10); return Number.isFinite(indexNumber) ? indexNumber : -1; } @@ -1020,7 +1020,7 @@ export class Display extends EventDispatcher { const node = /** @type {HTMLElement} */ (e.currentTarget); const {index} = node.dataset; if (typeof index !== 'string') { return; } - const indexNumber = parseInt(index, 10); + const indexNumber = Number.parseInt(index, 10); if (!Number.isFinite(indexNumber)) { return; } this._entrySetCurrent(indexNumber); } @@ -1146,8 +1146,7 @@ export class Display extends EventDispatcher { */ async _findDictionaryEntries(isKanji, source, wildcardsEnabled, optionsContext) { if (isKanji) { - const dictionaryEntries = await this._application.api.kanjiFind(source, optionsContext); - return dictionaryEntries; + return await this._application.api.kanjiFind(source, optionsContext); } else { /** @type {import('api').FindTermsDetails} */ const findDetails = {}; @@ -1555,11 +1554,11 @@ export class Display extends EventDispatcher { * @returns {boolean} */ _relativeTermView(next) { - if (next) { - return this._history.hasNext() && this._history.forward(); - } else { - return this._history.hasPrevious() && this._history.back(); - } + return ( + next ? + this._history.hasNext() && this._history.forward() : + this._history.hasPrevious() && this._history.back() + ); } /** |