chore(cloudcmd) lint

This commit is contained in:
coderaiser 2019-02-18 18:47:02 +02:00
parent d6674aed3e
commit 3bac819760
14 changed files with 21 additions and 19 deletions

View file

@ -41,7 +41,7 @@ module.exports = window.CloudCmd = (config) => {
function getPrefix(prefix) {
if (!prefix)
return '';
if (!prefix.indexOf('/'))
return prefix;

View file

@ -83,7 +83,7 @@ function EventsProto() {
callback
);
});
break;
}
}

View file

@ -68,7 +68,7 @@ function getModule(name, callback) {
getSystemFile(path, callback);
}
}
function getPath(name, isHTML, isJSON) {

View file

@ -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);
};

View file

@ -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;

View file

@ -1,4 +1,5 @@
'use strict';
/* global DOM */
const fullstore = require('fullstore/legacy');

View file

@ -1,4 +1,5 @@
'use strict';
/* global CloudCmd, DOM */
const KEY = require('../key');

View file

@ -79,7 +79,7 @@ function initConfig(options = {}) {
module.exports.show = (options) => {
if (Loading)
return;
CloudCmd.View.show(Element, initConfig(options));
getEditor()

View file

@ -1,4 +1,4 @@
'use stric';
'use strict';
const test = require('supertape');
const mockRequire = require('mock-require');

View file

@ -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;
}

View file

@ -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!');

View file

@ -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,

View file

@ -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();

View file

@ -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();
});