diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2023-12-16 20:04:56 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-17 01:04:56 +0000 |
commit | b249627434d3a94420ac4d98c3ce720767e57b43 (patch) | |
tree | ec46e2c020c5a63a5c2babf56376f53e288ed7f2 /ext/js/templates | |
parent | decbc60f7734e739c0e5c41da294f65f9eec92fe (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/templates')
-rw-r--r-- | ext/js/templates/sandbox/anki-template-renderer.js | 6 | ||||
-rw-r--r-- | ext/js/templates/sandbox/template-renderer-media-provider.js | 2 | ||||
-rw-r--r-- | ext/js/templates/template-renderer-proxy.js | 4 |
3 files changed, 7 insertions, 5 deletions
diff --git a/ext/js/templates/sandbox/anki-template-renderer.js b/ext/js/templates/sandbox/anki-template-renderer.js index dbf395e9..857922bf 100644 --- a/ext/js/templates/sandbox/anki-template-renderer.js +++ b/ext/js/templates/sandbox/anki-template-renderer.js @@ -74,6 +74,7 @@ export class AnkiTemplateRenderer { * Prepares the data that is necessary before the template renderer can be safely used. */ async prepare() { + /* eslint-disable no-multi-spaces */ this._templateRenderer.registerHelpers([ ['dumpObject', this._dumpObject.bind(this)], ['furigana', this._furigana.bind(this)], @@ -103,6 +104,7 @@ export class AnkiTemplateRenderer { ['hiragana', this._hiragana.bind(this)], ['katakana', this._katakana.bind(this)] ]); + /* eslint-enable no-multi-spaces */ this._templateRenderer.registerDataType('ankiNote', { modifier: ({marker, commonData}) => this._ankiNoteDataCreator.create(marker, commonData), composeData: ({marker}, commonData) => ({marker, commonData}) @@ -392,9 +394,9 @@ export class AnkiTemplateRenderer { case '!=': return operand1 != operand2; // eslint-disable-line eqeqeq case '===': return operand1 === operand2; case '!==': return operand1 !== operand2; - case '<': return operand1 < operand2; + case '<': return operand1 < operand2; case '<=': return operand1 <= operand2; - case '>': return operand1 > operand2; + case '>': return operand1 > operand2; case '>=': return operand1 >= operand2; case '<<': return operand1 << operand2; case '>>': return operand1 >> operand2; diff --git a/ext/js/templates/sandbox/template-renderer-media-provider.js b/ext/js/templates/sandbox/template-renderer-media-provider.js index d8a0a16d..0a7f5d9b 100644 --- a/ext/js/templates/sandbox/template-renderer-media-provider.js +++ b/ext/js/templates/sandbox/template-renderer-media-provider.js @@ -79,7 +79,7 @@ export class TemplateRendererMediaProvider { */ _getFormattedValue(data, namedArgs) { let {value} = data; - const {escape=true} = namedArgs; + const {escape = true} = namedArgs; if (escape) { value = Handlebars.Utils.escapeExpression(value); } diff --git a/ext/js/templates/template-renderer-proxy.js b/ext/js/templates/template-renderer-proxy.js index 642eea8b..7cbab3c8 100644 --- a/ext/js/templates/template-renderer-proxy.js +++ b/ext/js/templates/template-renderer-proxy.js @@ -99,7 +99,7 @@ export class TemplateRendererProxy { * @param {number} [timeout] * @returns {Promise<void>} */ - _loadFrame(frame, url, timeout=5000) { + _loadFrame(frame, url, timeout = 5000) { return new Promise((resolve, reject) => { let state = 0x0; // 0x1 = frame added; 0x2 = frame loaded; 0x4 = frame ready const cleanup = () => { @@ -165,7 +165,7 @@ export class TemplateRendererProxy { * @param {?number} [timeout] * @returns {Promise<unknown>} */ - _invoke(action, params, timeout=null) { + _invoke(action, params, timeout = null) { return new Promise((resolve, reject) => { const frameWindow = (this._frame !== null ? this._frame.contentWindow : null); if (frameWindow === null) { |