From 3bac8197604bbd2314b6b998b1f81fc376c7a7bd Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 18 Feb 2019 18:47:02 +0200 Subject: [PATCH] chore(cloudcmd) lint --- client/cloudcmd.js | 2 +- client/dom/events/index.js | 2 +- client/dom/files.js | 2 +- client/dom/load.js | 2 +- client/dom/select-by-pattern.js | 4 ++-- client/key/vim/find.js | 1 + client/key/vim/index.js | 1 + client/modules/edit.js | 2 +- client/modules/polyfill.spec.js | 2 +- client/sw/sw.js | 4 ++-- common/util.js | 2 +- server/cloudcmd.js | 6 +++--- test/rest/config.js | 6 +++--- test/rest/pack.js | 4 ++-- 14 files changed, 21 insertions(+), 19 deletions(-) diff --git a/client/cloudcmd.js b/client/cloudcmd.js index 13d1d27e..32d54c4b 100644 --- a/client/cloudcmd.js +++ b/client/cloudcmd.js @@ -41,7 +41,7 @@ module.exports = window.CloudCmd = (config) => { function getPrefix(prefix) { if (!prefix) return ''; - + if (!prefix.indexOf('/')) return prefix; diff --git a/client/dom/events/index.js b/client/dom/events/index.js index aa78bcd6..c4617f9d 100644 --- a/client/dom/events/index.js +++ b/client/dom/events/index.js @@ -83,7 +83,7 @@ function EventsProto() { callback ); }); - + break; } } diff --git a/client/dom/files.js b/client/dom/files.js index 2d8695b8..9897df93 100644 --- a/client/dom/files.js +++ b/client/dom/files.js @@ -68,7 +68,7 @@ function getModule(name, callback) { getSystemFile(path, callback); } - + } function getPath(name, isHTML, isJSON) { diff --git a/client/dom/load.js b/client/dom/load.js index a091645d..0c0cf22a 100644 --- a/client/dom/load.js +++ b/client/dom/load.js @@ -83,7 +83,7 @@ module.exports.ajax = (params) => { let data = xhr.response; if (type && isContain && notText) data = jonny.parse(xhr.response) || xhr.response; - + exec(p.success, data, xhr.statusText, xhr); }; diff --git a/client/dom/select-by-pattern.js b/client/dom/select-by-pattern.js index 870d722f..74871fab 100644 --- a/client/dom/select-by-pattern.js +++ b/client/dom/select-by-pattern.js @@ -24,7 +24,7 @@ module.exports = (msg, files) => { files.forEach((current) => { const name = DOM.getCurrentName(current); - + if (name === '..') return; @@ -37,7 +37,7 @@ module.exports = (msg, files) => { let isSelected = DOM.isSelected(current); const shouldSel = msg === 'expand'; - + if (shouldSel) isSelected = !isSelected; diff --git a/client/key/vim/find.js b/client/key/vim/find.js index bbf1d380..29a2a85f 100644 --- a/client/key/vim/find.js +++ b/client/key/vim/find.js @@ -1,4 +1,5 @@ 'use strict'; + /* global DOM */ const fullstore = require('fullstore/legacy'); diff --git a/client/key/vim/index.js b/client/key/vim/index.js index 62df71ad..d8ad6629 100644 --- a/client/key/vim/index.js +++ b/client/key/vim/index.js @@ -1,4 +1,5 @@ 'use strict'; + /* global CloudCmd, DOM */ const KEY = require('../key'); diff --git a/client/modules/edit.js b/client/modules/edit.js index 9e37d1da..e3e75d81 100644 --- a/client/modules/edit.js +++ b/client/modules/edit.js @@ -79,7 +79,7 @@ function initConfig(options = {}) { module.exports.show = (options) => { if (Loading) return; - + CloudCmd.View.show(Element, initConfig(options)); getEditor() diff --git a/client/modules/polyfill.spec.js b/client/modules/polyfill.spec.js index d9bdf244..af2fbce6 100644 --- a/client/modules/polyfill.spec.js +++ b/client/modules/polyfill.spec.js @@ -1,4 +1,4 @@ -'use stric'; +'use strict'; const test = require('supertape'); const mockRequire = require('mock-require'); diff --git a/client/sw/sw.js b/client/sw/sw.js index eef1e63f..32503911 100644 --- a/client/sw/sw.js +++ b/client/sw/sw.js @@ -80,7 +80,7 @@ async function onFetch(event) { if (!isDev && response) return response; - + const [e, resp] = await tryToCatch(fetch, newRequest, { credentials: 'same-origin', }); @@ -89,7 +89,7 @@ async function onFetch(event) { return new Response(e.message); await addToCache(request, resp.clone()); - + return resp; } diff --git a/common/util.js b/common/util.js index 52f76827..09d64db5 100644 --- a/common/util.js +++ b/common/util.js @@ -58,7 +58,7 @@ module.exports.findObjByNameInArr = (array, name) => { if (!Array.isArray(array)) throw Error('array should be array!'); - + if (typeof name !== 'string') throw Error('name should be string!'); diff --git a/server/cloudcmd.js b/server/cloudcmd.js index 40b9c043..0f790aba 100644 --- a/server/cloudcmd.js +++ b/server/cloudcmd.js @@ -60,7 +60,7 @@ module.exports = (params) => { if (/root|editor|packer|columns/.test(name)) validate[name](value); - + if (/prefix/.test(name)) value = prefixer(value); @@ -168,7 +168,7 @@ function cloudcmd(prefix, plugins, modules) { const dropbox = config('dropbox'); const dropboxToken = config('dropboxToken'); - + const funcs = clean([ config('console') && konsole({ online, @@ -183,7 +183,7 @@ function cloudcmd(prefix, plugins, modules) { dropbox, dropboxToken, }), - + dword({ online, diff, diff --git a/test/rest/config.js b/test/rest/config.js index 4a799245..57ffb01f 100644 --- a/test/rest/config.js +++ b/test/rest/config.js @@ -64,7 +64,7 @@ test('cloudcmd: rest: config: patch: no configDialog', async (t) => { const body = { ip: null, }; - + const result = await request.patch(`/api/v1/config`, { body, options, @@ -91,7 +91,7 @@ test('cloudcmd: rest: config: patch: no configDialog: statusCode', async (t) => body, options, }); - + manageConfig('configDialog', true); t.equal(response.status, 404); @@ -110,7 +110,7 @@ test('cloudcmd: rest: config: patch: save config', async (t) => { }); const config = readjson.sync(pathConfig); - + t.equal(config.editor, 'dword', 'should change config file on patch'); t.end(); diff --git a/test/rest/pack.js b/test/rest/pack.js index 79b4e1a9..f90a1b60 100644 --- a/test/rest/pack.js +++ b/test/rest/pack.js @@ -54,7 +54,7 @@ test('cloudcmd: rest: pack: tar: get', async (t) => { const extract = tar.extract(); body.pipe(gunzip()).pipe(extract); - + const [, stream] = await once('entry', extract); const data = await pullout(stream); const file = fs.readFileSync(__dirname + '/../fixture/pack', 'utf8'); @@ -92,7 +92,7 @@ test('cloudcmd: rest: pack: tar: put: file', async (t) => { const result = fs.readFileSync(__dirname + '/../fixture/pack'); fs.unlinkSync(`${__dirname}/../${name}`); - + t.deepEqual(result, data, 'should create archive'); t.end(); });