From 0aba04316d355ba52d4fb2b2367716f79f13215f Mon Sep 17 00:00:00 2001 From: JFH <20402845+jfhenon@users.noreply.github.com> Date: Sun, 16 May 2021 18:00:28 +0200 Subject: [PATCH] fix lint issues --- src/editor/extensions/ext-imagelib/ext-imagelib.js | 5 +++-- .../extensions/ext-server_opensave/ext-server_opensave.js | 3 ++- src/editor/panels/LayersPanel.js | 2 +- src/svgcanvas/path.js | 6 ++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/editor/extensions/ext-imagelib/ext-imagelib.js b/src/editor/extensions/ext-imagelib/ext-imagelib.js index 47781afa..8a990c7e 100644 --- a/src/editor/extensions/ext-imagelib/ext-imagelib.js +++ b/src/editor/extensions/ext-imagelib/ext-imagelib.js @@ -112,7 +112,8 @@ export default { * @param {ImageLibMetaMessage|ImageLibMessage|string} cfg.data String is deprecated when parsed to JSON `ImageLibMessage` * @returns {void} */ - async function onMessage({ origin, data: response }) { + async function onMessage({ origin, data }) { + let response = data; if (!response || ![ 'string', 'object' ].includes(typeof response)) { // Do nothing return; @@ -129,7 +130,7 @@ export default { } if (!allowedImageLibOrigins.includes('*') && !allowedImageLibOrigins.includes(origin)) { // Todo: Surface this error to user? - console.log(`Origin ${origin} not whitelisted for posting to ${window.origin}`); + console.error(`Origin ${origin} not whitelisted for posting to ${window.origin}`); return; } const hasName = 'name' in response; diff --git a/src/editor/extensions/ext-server_opensave/ext-server_opensave.js b/src/editor/extensions/ext-server_opensave/ext-server_opensave.js index 45b891c6..a596098b 100644 --- a/src/editor/extensions/ext-server_opensave/ext-server_opensave.js +++ b/src/editor/extensions/ext-server_opensave/ext-server_opensave.js @@ -96,7 +96,8 @@ export default { svgEditor.setCustomHandlers({ save (win, data) { - const svg = '\n' + data, // Firefox doesn't seem to know it is UTF-8 (no matter whether we use or skip the clientDownload code) despite the Content-Disposition header containing UTF-8, but adding the encoding works + // Firefox doesn't seem to know it is UTF-8 (no matter whether we use or skip the clientDownload code) despite the Content-Disposition header containing UTF-8, but adding the encoding works + const svg = '\n' + data, filename = getFileNameFromTitle(); if (clientDownloadSupport(filename, '.svg', 'data:image/svg+xml;charset=UTF-8;base64,' + encode64(svg))) { diff --git a/src/editor/panels/LayersPanel.js b/src/editor/panels/LayersPanel.js index bf081ac8..0d8f2591 100644 --- a/src/editor/panels/LayersPanel.js +++ b/src/editor/panels/LayersPanel.js @@ -414,7 +414,7 @@ class LayersPanel { element.addEventListener('mouseup', (evt) => { self.toggleHighlightLayer(evt.currentTarget.textContent); }); - element.addEventListener('mouseout', (evt) => { + element.addEventListener('mouseout', (_evt) => { self.toggleHighlightLayer(); }); }); diff --git a/src/svgcanvas/path.js b/src/svgcanvas/path.js index 367b1bd2..3ad4db13 100644 --- a/src/svgcanvas/path.js +++ b/src/svgcanvas/path.js @@ -86,7 +86,8 @@ let editorContext_ = null; * Object with the following keys/values. * @typedef {PlainObject} module:path.SVGElementJSON * @property {string} element - Tag name of the SVG element to create -* @property {PlainObject} attr - Has key-value attributes to assign to the new element. An `id` should be set so that {@link module:utilities.EditorContext#addSVGElementFromJson} can later re-identify the element for modification or replacement. +* @property {PlainObject} attr - Has key-value attributes to assign to the new element. +* An `id` should be set so that {@link module:utilities.EditorContext#addSVGElementFromJson} can later re-identify the element for modification or replacement. * @property {boolean} [curStyles=false] - Indicates whether current style attributes should be applied first * @property {module:path.SVGElementJSON[]} [children] - Data objects to be added recursively as children * @property {string} [namespace="http://www.w3.org/2000/svg"] - Indicate a (non-SVG) namespace @@ -99,7 +100,8 @@ let editorContext_ = null; /** * @function module:path.EditorContext#call * @param {"selected"|"changed"} ev - String with the event name - * @param {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed} arg - Argument to pass through to the callback function. If the event is "changed", an array of `Element`s is passed; if "selected", a single-item array of `Element` is passed. + * @param {module:svgcanvas.SvgCanvas#event:selected|module:svgcanvas.SvgCanvas#event:changed} arg - Argument to pass through to the callback function. + * If the event is "changed", an array of `Element`s is passed; if "selected", a single-item array of `Element` is passed. * @returns {void} */ /**