summaryrefslogtreecommitdiff
path: root/ext/js/display
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2023-12-16 20:04:56 -0500
committerGitHub <noreply@github.com>2023-12-17 01:04:56 +0000
commitb249627434d3a94420ac4d98c3ce720767e57b43 (patch)
treeec46e2c020c5a63a5c2babf56376f53e288ed7f2 /ext/js/display
parentdecbc60f7734e739c0e5c41da294f65f9eec92fe (diff)
Update eslint spacing rules (#366)
* Add space-infix-ops rule * Add no-multi-spaces --------- Co-authored-by: Darius Jahandarie <djahandarie@gmail.com>
Diffstat (limited to 'ext/js/display')
-rw-r--r--ext/js/display/display-anki.js2
-rw-r--r--ext/js/display/display-audio.js4
-rw-r--r--ext/js/display/display-generator.js2
-rw-r--r--ext/js/display/display-history.js2
-rw-r--r--ext/js/display/display-notification.js2
-rw-r--r--ext/js/display/display.js6
-rw-r--r--ext/js/display/search-display-controller.js4
7 files changed, 15 insertions, 7 deletions
diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js
index 81791285..322237da 100644
--- a/ext/js/display/display-anki.js
+++ b/ext/js/display/display-anki.js
@@ -108,12 +108,14 @@ export class DisplayAnki {
/** */
prepare() {
this._noteContext = this._getNoteContext();
+ /* eslint-disable no-multi-spaces */
this._display.hotkeyHandler.registerActions([
['addNoteKanji', () => { this._tryAddAnkiNoteForSelectedEntry('kanji'); }],
['addNoteTermKanji', () => { this._tryAddAnkiNoteForSelectedEntry('term-kanji'); }],
['addNoteTermKana', () => { this._tryAddAnkiNoteForSelectedEntry('term-kana'); }],
['viewNote', this._viewNoteForSelectedEntry.bind(this)]
]);
+ /* eslint-enable no-multi-spaces */
this._display.on('optionsUpdated', this._onOptionsUpdated.bind(this));
this._display.on('contentClear', this._onContentClear.bind(this));
this._display.on('contentUpdateStart', this._onContentUpdateStart.bind(this));
diff --git a/ext/js/display/display-audio.js b/ext/js/display/display-audio.js
index 1f279030..8cd1ccc3 100644
--- a/ext/js/display/display-audio.js
+++ b/ext/js/display/display-audio.js
@@ -83,6 +83,7 @@ export class DisplayAudio {
/** */
prepare() {
this._audioSystem.prepare();
+ /* eslint-disable no-multi-spaces */
this._display.hotkeyHandler.registerActions([
['playAudio', this._onHotkeyActionPlayAudio.bind(this)],
['playAudioFromSource', this._onHotkeyActionPlayAudioFromSource.bind(this)]
@@ -90,6 +91,7 @@ export class DisplayAudio {
this._display.registerDirectMessageHandlers([
['Display.clearAutoPlayTimer', {async: false, handler: this._onMessageClearAutoPlayTimer.bind(this)}]
]);
+ /* eslint-enable no-multi-spaces */
this._display.on('optionsUpdated', this._onOptionsUpdated.bind(this));
this._display.on('contentClear', this._onContentClear.bind(this));
this._display.on('contentUpdateEntry', this._onContentUpdateEntry.bind(this));
@@ -120,7 +122,7 @@ export class DisplayAudio {
* @param {number} headwordIndex
* @param {?string} [sourceType]
*/
- async playAudio(dictionaryEntryIndex, headwordIndex, sourceType=null) {
+ async playAudio(dictionaryEntryIndex, headwordIndex, sourceType = null) {
let sources = this._audioSources;
if (sourceType !== null) {
sources = [];
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js
index eb464001..7bedfa12 100644
--- a/ext/js/display/display-generator.js
+++ b/ext/js/display/display-generator.js
@@ -28,7 +28,7 @@ export class DisplayGenerator {
/**
* @param {import('display').DisplayGeneratorConstructorDetails} details
*/
- constructor({japaneseUtil, contentManager, hotkeyHelpController=null}) {
+ constructor({japaneseUtil, contentManager, hotkeyHelpController = null}) {
/** @type {import('../language/sandbox/japanese-util.js').JapaneseUtil} */
this._japaneseUtil = japaneseUtil;
/** @type {import('./display-content-manager.js').DisplayContentManager} */
diff --git a/ext/js/display/display-history.js b/ext/js/display/display-history.js
index f9d2e35d..af6d734e 100644
--- a/ext/js/display/display-history.js
+++ b/ext/js/display/display-history.js
@@ -25,7 +25,7 @@ export class DisplayHistory extends EventDispatcher {
/**
* @param {{clearable?: boolean, useBrowserHistory?: boolean}} details
*/
- constructor({clearable=true, useBrowserHistory=false}) {
+ constructor({clearable = true, useBrowserHistory = false}) {
super();
/** @type {boolean} */
this._clearable = clearable;
diff --git a/ext/js/display/display-notification.js b/ext/js/display/display-notification.js
index a0e9e35c..df475adf 100644
--- a/ext/js/display/display-notification.js
+++ b/ext/js/display/display-notification.js
@@ -67,7 +67,7 @@ export class DisplayNotification {
/**
* @param {boolean} [animate]
*/
- close(animate=false) {
+ close(animate = false) {
if (this.isClosed()) { return; }
if (animate) {
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index b6a818ba..945ec0b9 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -196,6 +196,7 @@ export class Display extends EventDispatcher {
/** @type {ThemeController} */
this._themeController = new ThemeController(document.documentElement);
+ /* eslint-disable no-multi-spaces */
this._hotkeyHandler.registerActions([
['close', () => { this._onHotkeyClose(); }],
['nextEntry', this._onHotkeyActionMoveRelative.bind(this, 1)],
@@ -219,6 +220,7 @@ export class Display extends EventDispatcher {
this.registerWindowMessageHandlers([
['Display.extensionUnloaded', {async: false, handler: this._onMessageExtensionUnloaded.bind(this)}]
]);
+ /* eslint-enable no-multi-spaces */
}
/** @type {DisplayGenerator} */
@@ -586,7 +588,7 @@ export class Display extends EventDispatcher {
* @param {import('core').SerializableObject} [params]
* @returns {Promise<TReturn>}
*/
- async invokeContentOrigin(action, params={}) {
+ async invokeContentOrigin(action, params = {}) {
if (this._contentOriginTabId === this._tabId && this._contentOriginFrameId === this._frameId) {
throw new Error('Content origin is same page');
}
@@ -602,7 +604,7 @@ export class Display extends EventDispatcher {
* @param {import('core').SerializableObject} [params]
* @returns {Promise<TReturn>}
*/
- async invokeParentFrame(action, params={}) {
+ async invokeParentFrame(action, params = {}) {
if (this._parentFrameId === null || this._parentFrameId === this._frameId) {
throw new Error('Invalid parent frame');
}
diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js
index b512a16d..44850cbb 100644
--- a/ext/js/display/search-display-controller.js
+++ b/ext/js/display/search-display-controller.js
@@ -94,11 +94,13 @@ export class SearchDisplayController {
this._display.hotkeyHandler.registerActions([
['focusSearchBox', this._onActionFocusSearchBox.bind(this)]
]);
+ /* eslint-disable no-multi-spaces */
this._registerMessageHandlers([
['SearchDisplayController.getMode', {async: false, handler: this._onMessageGetMode.bind(this)}],
['SearchDisplayController.setMode', {async: false, handler: this._onMessageSetMode.bind(this)}],
['SearchDisplayController.updateSearchQuery', {async: false, handler: this._onExternalSearchUpdate.bind(this)}]
]);
+ /* eslint-enable no-multi-spaces */
this._updateClipboardMonitorEnabled();
@@ -285,7 +287,7 @@ export class SearchDisplayController {
/**
* @param {{text: string, animate?: boolean}} details
*/
- _onExternalSearchUpdate({text, animate=true}) {
+ _onExternalSearchUpdate({text, animate = true}) {
const options = this._display.getOptions();
if (options === null) { return; }
const {clipboard: {autoSearchContent, maximumSearchLength}} = options;