From ebab14cd5b7e77d5a7d5c02552a8601eeced07ec Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Tue, 2 Apr 2019 10:07:16 +0200 Subject: [PATCH] lint: fix errors and ignore indentation in template string vars --- .eslintrc.json | 2 +- src/client/app/ipc/callbacks.js | 2 +- src/client/app/managers/session.js | 2 +- src/client/app/ui/context-menu.js | 3 +-- src/client/app/ui/utils.js | 19 +++++++++---------- src/server/callbacks.js | 2 +- 6 files changed, 14 insertions(+), 16 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index faf7c80e..875c308d 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -40,7 +40,7 @@ "ObjectExpression": 1, "ArrayExpression": 1, "MemberExpression": "off", - "ignoredNodes": ["ConditionalExpression"] + "ignoredNodes": ["ConditionalExpression", "TemplateElement"] } ], "linebreak-style": [ diff --git a/src/client/app/ipc/callbacks.js b/src/client/app/ipc/callbacks.js index 501026cd..9bfb8795 100644 --- a/src/client/app/ipc/callbacks.js +++ b/src/client/app/ipc/callbacks.js @@ -125,7 +125,7 @@ module.exports = { // store session & state backup ipc.send('storeBackup', { backupId: id, - session: session.session || {}, + session: session.session || {}, sessionPath: session.sessionPath, state: state.get(), history: editor.history, diff --git a/src/client/app/managers/session.js b/src/client/app/managers/session.js index f6ffb9c3..2bce9806 100644 --- a/src/client/app/managers/session.js +++ b/src/client/app/managers/session.js @@ -241,7 +241,7 @@ var SessionManager = class SessionManager { }) } - setSessionPath(path) { + setSessionPath(path) { this.sessionPath = path if (path) { diff --git a/src/client/app/ui/context-menu.js b/src/client/app/ui/context-menu.js index 526050ff..e92ca0fb 100644 --- a/src/client/app/ui/context-menu.js +++ b/src/client/app/ui/context-menu.js @@ -1,6 +1,5 @@ var html = require('nanohtml'), - raw = require('nanohtml/raw'), - locales = require('../locales') + raw = require('nanohtml/raw') class ContextMenu { diff --git a/src/client/app/ui/utils.js b/src/client/app/ui/utils.js index 10ca1d01..c740d407 100644 --- a/src/client/app/ui/utils.js +++ b/src/client/app/ui/utils.js @@ -161,13 +161,12 @@ module.exports = { saveInput = html``, actions = html`
- ${ - save ? saveInput : '' - } + ${ save ? saveInput : '' }
${raw(module.exports.icon('times'))} Cancel
${ - save ? html`
${raw(module.exports.icon('save'))} Save
` : - html`
${raw(module.exports.icon('folder-open'))} Open
` + save ? + html`
${raw(module.exports.icon('save'))} Save
` : + html`
${raw(module.exports.icon('folder-open'))} Open
` }
` @@ -232,7 +231,7 @@ module.exports = { setTimeout(submit, 100) } else if (e.target === saveInput) { return - } else if (e.keyCode === 8) { + } else if (e.keyCode === 8) { list.childNodes[0].firstElementChild.checked = true submit() } else if (e.key.length === 1) { @@ -254,14 +253,14 @@ module.exports = { ariane.innerHTML = path = data.path - files = data.files.filter(x=>x.folder || x.name.match(extRe)) + files = data.files.filter(x=>x.folder || x.name.match(extRe)) function alphaSort(a, b){ // convert to strings and force lowercase - a = typeof a.name === 'string' ? a.name.toLowerCase() : a.name.toString(); - b = typeof b.name === 'string' ? b.name.toLowerCase() : b.name.toString(); - return a.localeCompare(b); + a = typeof a.name === 'string' ? a.name.toLowerCase() : a.name.toString() + b = typeof b.name === 'string' ? b.name.toLowerCase() : b.name.toString() + return a.localeCompare(b) } var fo = files.filter(x=>x.folder), diff --git a/src/server/callbacks.js b/src/server/callbacks.js index 6f532d33..4d7bae0d 100644 --- a/src/server/callbacks.js +++ b/src/server/callbacks.js @@ -374,7 +374,7 @@ module.exports = { listDir: function(data, clientId) { - var p = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']; + var p = process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'] if (data.path) p = path.resolve(...data.path)