chore(cloudcmd) lint

This commit is contained in:
coderaiser 2019-06-19 15:05:02 +03:00
parent 83a138f38c
commit ea8ec97f49
9 changed files with 27 additions and 49 deletions

View file

@ -7,7 +7,7 @@ const {
prompt,
confirm,
progress,
}= require('smalltalk');
} = require('smalltalk');
const title = 'Cloud Commander';

View file

@ -35,12 +35,10 @@ function EventsProto() {
if (!/element$/.test(type))
throw Error('unknown eventName: ' + type);
parseArgs(
args[EVENT_NAME],
parseArgs(args[EVENT_NAME],
args[ELEMENT],
listener,
callback
);
callback);
break;
case 'string':
@ -63,12 +61,10 @@ function EventsProto() {
case 'array':
eventName.forEach((eventName) => {
parseArgs(
eventName,
parseArgs(eventName,
element,
listener,
callback
);
callback);
});
break;
@ -76,12 +72,10 @@ function EventsProto() {
Object.keys(eventName).forEach((name) => {
const eventListener = eventName[name];
parseArgs(
name,
parseArgs(name,
element,
eventListener,
callback
);
callback);
});
break;

View file

@ -297,7 +297,7 @@ test('cloudcmd: client: key: set last file current', (t) => {
test('cloudcmd: client: key: set first file current', (t) => {
const first = 'first';
const previousSibling= {
const previousSibling = {
previousSibling: first,
};

View file

@ -193,7 +193,7 @@ test('cloudcmd: getIndexPath: development', (t) => {
});
test('cloudcmd: sw', async (t) => {
const {status}= await request.get('/sw.js');
const {status} = await request.get('/sw.js');
t.equal(status, 200, 'should return sw');
t.end();

View file

@ -1,7 +1,7 @@
'use strict';
const path = require('path');
const fs= require('fs');
const fs = require('fs');
const readFilesSync = require('@cloudcmd/read-files-sync');
const isMap = (a) => /\.map$/.test(a);
const not = (fn) => (a) => !fn(a);

View file

@ -46,10 +46,8 @@ module.exports = (config, socket) => {
const distributePrefix = `${prefix}/distribute`;
const isLog = config('log');
const onError = squad(
logWraped(isLog, exportStr),
getMessage,
);
const onError = squad(logWraped(isLog, exportStr),
getMessage,);
const onConnectError = squad(logWraped(isLog, exportStr), getDescription);

View file

@ -92,48 +92,36 @@ module.exports = (config, options, fn) => {
const statusStore = fullstore();
const statusStoreWraped = wraptile(statusStore);
const onConfig = squad(
close,
const onConfig = squad(close,
logWraped(isLog, importStr, `config received from ${colorUrl}`),
statusStoreWraped('received'),
forEachKey(config),
);
forEachKey(config),);
const onError = squad(
superFn('error'),
const onError = squad(superFn('error'),
logWraped(isLog, config, importStr),
addUrl(colorUrl),
getMessage,
);
getMessage,);
const onConnectError = squad(
superFn('connect_error'),
const onConnectError = squad(superFn('connect_error'),
logWraped(isLog, importStr),
addUrl(colorUrl),
getDescription,
);
getDescription,);
const onConnect = emitAuth(importUrl, config, socket);
const onAccept = logWraped(isLog, importStr,`${connectedStr} to ${colorUrl}`);
const onDisconnect = squad(
done(fn, statusStore),
const onDisconnect = squad(done(fn, statusStore),
logWraped(isLog, importStr, `${disconnectedStr} from ${colorUrl}`),
rmListeners(socket, {
onError,
onConnect,
onConfig,
}),
);
}),);
const onChange = squad(
logWraped(isLog, importStr),
config,
);
const onChange = squad(logWraped(isLog, importStr),
config,);
const onReject = squad(
superFn('reject'),
logWraped(isLog, importStr, tokenRejectedStr),
);
const onReject = squad(superFn('reject'),
logWraped(isLog, importStr, tokenRejectedStr),);
socket.on('connect', onConnect);
socket.on('accept', onAccept);

View file

@ -2,7 +2,7 @@
const getMessage = (a) => a && a.message || a;
module.exports= (...args) => {
module.exports = (...args) => {
const messages = args.map(getMessage);
console.error(...messages);

View file

@ -95,11 +95,9 @@ test('cloudfunc: render', (t) => {
timeEnd('CloudFunc.buildFromJSON');
if (isNotOk) {
console.log(
`Error in char number: ${i}\n`,
console.log(`Error in char number: ${i}\n`,
`Expect: ${Expect.substr(i)}\n`,
`Result: ${result.substr(i)}`
);
`Result: ${result.substr(i)}`);
console.log('buildFromJSON: Not OK');
}