diff --git a/.eslintrc.js b/.eslintrc.js index 9576e79c..ab62820d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,7 +2,7 @@ module.exports = { extends: [ - 'plugin:putout/safe', + 'plugin:putout/safe+align', ], plugins: [ 'putout', @@ -18,9 +18,6 @@ module.exports = { 'no-console': 'off', 'n/shebang': 'off', }, - extends: [ - 'plugin:n/recommended', - ], }, { files: ['client/dom/index.js'], rules: { @@ -31,9 +28,6 @@ module.exports = { rules: { 'no-console': 'off', }, - extends: [ - 'plugin:n/recommended', - ], }, { files: ['{client,common,static}/**/*.js'], env: { diff --git a/client/client.js b/client/client.js index 9038a758..58f4ae83 100644 --- a/client/client.js +++ b/client/client.js @@ -103,7 +103,7 @@ function CloudCmdProto(DOM) { currentName, }, panel); }; - + /** * Конструктор CloudClient, который * выполняет весь функционал по @@ -148,7 +148,7 @@ function CloudCmdProto(DOM) { await load.css(name); } - + this.route = (path) => { const query = path.split('/'); @@ -216,7 +216,7 @@ function CloudCmdProto(DOM) { async function saveCurrentName(currentName) { await Storage.set('current-name', currentName); } - + async function baseInit() { const files = DOM.getFiles(); @@ -253,7 +253,7 @@ function CloudCmdProto(DOM) { if (!data) await Storage.setJson(dirPath, getJsonFromFileTable()); } - + function getPanels() { const panels = ['left']; @@ -265,7 +265,7 @@ function CloudCmdProto(DOM) { 'right', ]; } - + this.execFromModule = async (moduleName, funcName, ...args) => { await CloudCmd[moduleName](); @@ -290,7 +290,7 @@ function CloudCmdProto(DOM) { currentName, }); }; - + /** * Функция загружает json-данные о Файловой Системе * через ajax-запрос. @@ -343,7 +343,7 @@ function CloudCmdProto(DOM) { Storage.setJson(path, newObj); } - + /** * Функция строит файловую таблицу * @param json - данные о файлах @@ -409,7 +409,7 @@ function CloudCmdProto(DOM) { CloudCmd.emit('active-dir', Info.dirPath); } } - + this.goToParentDir = async () => { const { dir, diff --git a/client/dom/buffer.js b/client/dom/buffer.js index 8c4be473..afa78dd7 100644 --- a/client/dom/buffer.js +++ b/client/dom/buffer.js @@ -23,13 +23,13 @@ function BufferProto() { function showMessage(msg) { DOM.Dialog.alert(msg); } - + function getNames() { const files = DOM.getActiveFiles(); return DOM.getFilenames(files); } - + function addCutClass() { const files = DOM.getActiveFiles(); @@ -37,7 +37,7 @@ function BufferProto() { element.classList.add(CLASS); } } - + function rmCutClass() { const files = DOM.getByClassAll(CLASS); @@ -45,7 +45,7 @@ function BufferProto() { element.classList.remove(CLASS); } } - + function callIfEnabled(callback) { const is = CloudCmd.config('buffer'); @@ -54,7 +54,7 @@ function BufferProto() { showMessage('Buffer disabled in config!'); } - + async function readBuffer() { const [e, cp, ct] = await tryToPromiseAll([ Storage.getJson(COPY), @@ -67,7 +67,7 @@ function BufferProto() { ct, ]; } - + async function copy() { const names = getNames(); const from = Info.dirPath; @@ -83,7 +83,7 @@ function BufferProto() { names, }); } - + async function cut() { const names = getNames(); const from = Info.dirPath; @@ -100,14 +100,14 @@ function BufferProto() { names, }); } - + async function clear() { await Storage.remove(COPY); await Storage.remove(CUT); rmCutClass(); } - + async function paste() { const [error, cp, ct] = await readBuffer(); @@ -130,6 +130,6 @@ function BufferProto() { await clear(); } - + return Buffer; } diff --git a/client/dom/current-file.js b/client/dom/current-file.js index 1785a4c8..ca7be146 100644 --- a/client/dom/current-file.js +++ b/client/dom/current-file.js @@ -196,7 +196,7 @@ module.exports.setCurrentFile = (currentFile, options) => { name, path, })); - + /* history could be present * but it should be false * to prevent default behavior diff --git a/client/dom/events/index.js b/client/dom/events/index.js index 551a9a93..a879fdc1 100644 --- a/client/dom/events/index.js +++ b/client/dom/events/index.js @@ -75,7 +75,7 @@ function EventsProto() { break; } } - + /** * safe add event listener * @@ -95,7 +95,7 @@ function EventsProto() { return Events; }; - + /** * safe add event listener * @@ -118,7 +118,7 @@ function EventsProto() { return Events; }; - + /** * safe remove event listener * @@ -135,7 +135,7 @@ function EventsProto() { return Events; }; - + /** * remove all added event listeners * @@ -149,7 +149,7 @@ function EventsProto() { EventStore.clear(); }; - + /** * safe add event keydown listener * @@ -164,7 +164,7 @@ function EventsProto() { return Events.add(...args); }; - + /** * safe remove event click listener * @@ -179,7 +179,7 @@ function EventsProto() { return Events.remove(...args); }; - + /** * safe add event click listener * @@ -194,7 +194,7 @@ function EventsProto() { return Events.add(...args); }; - + /** * safe remove event click listener * @@ -219,7 +219,7 @@ function EventsProto() { return Events.add(...args); }; - + /** * safe add event click listener * @@ -234,7 +234,7 @@ function EventsProto() { return Events.add(...args); }; - + /** * safe add load click listener * diff --git a/client/dom/load-remote.js b/client/dom/load-remote.js index dac84a62..0def5f00 100644 --- a/client/dom/load-remote.js +++ b/client/dom/load-remote.js @@ -22,13 +22,13 @@ module.exports = (name, options, callback = options) => { .then(async (modules) => { const online = config('online') && navigator.onLine; const module = findObjByNameInArr(modules.remote, name); - + const isArray = itype.array(module.local); const {version} = module; - + let remoteTmpls; let local; - + if (isArray) { remoteTmpls = module.remote; local = module.local; @@ -36,22 +36,22 @@ module.exports = (name, options, callback = options) => { remoteTmpls = [module.remote]; local = [module.local]; } - + const localURL = local.map((url) => prefix + url); - + const remoteURL = remoteTmpls.map((tmpl) => { return rendy(tmpl, { version, }); }); - + if (online) { const [e] = await tryToCatch(load.parallel, remoteURL); - + if (!e) return callback(); } - + const [e] = await tryToCatch(load.parallel, localURL); callback(e); }); diff --git a/client/dom/upload-files.js b/client/dom/upload-files.js index 61ccff5d..7ac460ea 100644 --- a/client/dom/upload-files.js +++ b/client/dom/upload-files.js @@ -61,7 +61,7 @@ function _loadFile(dir, n, file, callback) { .on('progress', (count) => { const max = step(n); const value = (i - 1) * max + percent(count, 100, max); - + Images.show.load('top'); Images.setProgress(Math.round(value)); }); diff --git a/common/cloudfunc.js b/common/cloudfunc.js index 5d61258e..39e422e7 100644 --- a/common/cloudfunc.js +++ b/common/cloudfunc.js @@ -165,7 +165,7 @@ module.exports.buildFromJSON = (params) => { Path(path); fileTable += `${header}