chore(eslint) add indent, semi

This commit is contained in:
coderaiser 2016-12-28 11:07:24 +02:00
parent a8b4ef9230
commit d638ecd111
24 changed files with 102 additions and 95 deletions

View file

@ -7,5 +7,9 @@
"ecmaVersion": 5,
"sourceType": "module"
},
"rules": {
"indent": ["error", 4],
"semi": "error"
},
"extends": ["eslint:recommended"]
}

View file

@ -8,7 +8,8 @@
"sourceType": "module"
},
"rules": {
"indent": ["error", 4]
"indent": ["error", 4],
"semi": "error"
},
"extends": ["eslint:recommended"]
}

View file

@ -21,7 +21,7 @@ function fillFile(name) {
return {
name: setDir(name),
data: `module.exports = require(\'../../server_/${name}\');`
}
};
}
function writeFile({name, data}) {

View file

@ -68,7 +68,7 @@
}
function callIfEnabled(callback) {
isEnabled(function(is) {
isEnabled(function(is) {
if (is)
callback();
else
@ -110,7 +110,7 @@
}
function clear() {
Storage.remove(COPY)
Storage.remove(COPY)
.remove(CUT);
rmCutClass();

View file

@ -166,9 +166,9 @@ var Util, DOM, CloudFunc, join;
funcBefore = function(callback) {
var src = prefix + '/join:' + [
CloudCmd.LIBDIRCLIENT + 'polyfill.js',
'/modules/domtokenlist-shim/dist/domtokenlist.min.js',
].join(':');
CloudCmd.LIBDIRCLIENT + 'polyfill.js',
'/modules/domtokenlist-shim/dist/domtokenlist.min.js',
].join(':');
DOM.loadJquery(function() {
DOM.load.js(src, callback);

View file

@ -17,13 +17,13 @@
var log = CloudCmd.log;
filepicker.store(data, {
mimetype: '',
filename: name
},
mimetype: '',
filename: name
},
function(fpFile) {
log(fpFile);
filepicker.exportFile(fpFile, log, log);
});
});
};
this.saveFile = function(callback) {
@ -49,13 +49,13 @@
picker = Util.findObjByNameInArr(storage, 'FilePicker'),
key = picker && picker.key;
filepicker.setKey(key);
filepicker.setKey(key);
DOM.Images.hide();
Util.timeEnd('filepicker loaded');
Util.exec(callback);
});
DOM.Images.hide();
Util.timeEnd('filepicker loaded');
Util.exec(callback);
});
});
}
init(callback);

View file

@ -39,7 +39,7 @@ var CloudCmd;
].filter(function(name) {
return name;
}).map(function(name) {
return modules + name;
return modules + name;
});
var allFiles = moduleFiles

View file

@ -62,7 +62,7 @@ var CloudCmd, Util, DOM, CloudFunc;
return element;
};
};
};
Images = new ImageElementProto();
@ -138,7 +138,7 @@ var CloudCmd, Util, DOM, CloudFunc;
var DATA = 'data-progress',
element = Images.get();
if (element) {
if (element) {
element.setAttribute(DATA, '');
element.title = '';
}
@ -321,8 +321,8 @@ var CloudCmd, Util, DOM, CloudFunc;
remoteTmpls = module.remote;
local = module.local;
} else {
remoteTmpls = [module.remote];
local = [module.local];
remoteTmpls = [module.remote];
local = [module.local];
}
local = local.map(function(url) {
@ -405,18 +405,18 @@ var CloudCmd, Util, DOM, CloudFunc;
FS = CloudFunc.FS,
api = prefixURL + FS;
++i;
++i;
uploader = DOM.load.put(api + path, file);
uploader.on('progress', function(count) {
var max = step(n),
value = (i - 1) * max + percent(count, 100, max);
uploader = DOM.load.put(api + path, file);
uploader.on('progress', function(count) {
var max = step(n),
value = (i - 1) * max + percent(count, 100, max);
Images.show.load('top');
Images.setProgress(Math.round(value));
});
Images.show.load('top');
Images.setProgress(Math.round(value));
});
uploader.on('end', callback);
uploader.on('end', callback);
};
if (!files) {
@ -447,7 +447,7 @@ var CloudCmd, Util, DOM, CloudFunc;
* @type
*/
this.promptNewFile = function() {
promptNew('file');
promptNew('file');
};
function promptNew(typeName, type) {
@ -686,7 +686,7 @@ var CloudCmd, Util, DOM, CloudFunc;
var ret,
current = currentFile || this.getCurrentFile(),
lMode = this.getByDataName('js-mode', current);
ret = lMode.textContent;
ret = lMode.textContent;
return ret;
};
@ -710,7 +710,7 @@ var CloudCmd, Util, DOM, CloudFunc;
* @param callback
* @param currentFile
*/
this.getCurrentData = function(callback, currentFile) {
this.getCurrentData = function(callback, currentFile) {
var hash,
RESTful = DOM.RESTful,
Dialog = DOM.Dialog,
@ -721,7 +721,7 @@ var CloudCmd, Util, DOM, CloudFunc;
func = function(error, data) {
var length,
ONE_MEGABYTE = 1024 * 1024 * 1024;
ONE_MEGABYTE = 1024 * 1024 * 1024;
if (!error) {
if (Util.type.object(data))
@ -782,9 +782,9 @@ var CloudCmd, Util, DOM, CloudFunc;
};
this.setCurrentByName = function(name) {
var current = this.getCurrentByName(name)
var current = this.getCurrentByName(name);
return this.setCurrentFile(current);
}
};
/**
* unified way to set current file
@ -958,7 +958,7 @@ var CloudCmd, Util, DOM, CloudFunc;
var msg = 'shrink',
files = DOM.getSelectedFiles();
selectByPattern(msg, files);
selectByPattern(msg, files);
};
/**
@ -1460,7 +1460,7 @@ var CloudCmd, Util, DOM, CloudFunc;
/* scroll on one page*/
this.scrollByPages = function(element, pPages) {
var ret = element && element.scrollByPages && pPages;
var ret = element && element.scrollByPages && pPages;
if (ret)
element.scrollByPages(pPages);
@ -1514,7 +1514,7 @@ var CloudCmd, Util, DOM, CloudFunc;
return '.zip';
return '.tar.gz';
}
};
this.goToDirectory = function() {
var msg = 'Go to directory:',
@ -1554,7 +1554,7 @@ var CloudCmd, Util, DOM, CloudFunc;
dirPath = DOM.getCurrentDirPath(),
dirPathPassive = DOM.getNotCurrentDirPath();
CloudCmd.loadDir({
CloudCmd.loadDir({
path: dirPath,
panel: panelPassive,
noCurrent: true

View file

@ -37,7 +37,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format;
}
};
function init(callback) {
function init(callback) {
var element = createElement();
DOM.Events.addOnce('contextmenu', element, setMenu);

View file

@ -30,7 +30,7 @@ var Util, DOM;
eventName = arguments[ELEMENT];
element = arguments[EVENT_NAME];
parseArgs(
parseArgs(
eventName,
element,
listener,
@ -110,9 +110,9 @@ var Util, DOM;
*/
this.addOnce = function(type, element, listener) {
var once = function (event) {
Events.remove(type, element, once);
listener(event);
};
Events.remove(type, element, once);
listener(event);
};
if (!listener) {
listener = element;

View file

@ -520,7 +520,7 @@ var CloudCmd, Util, DOM;
case Key.V:
if (ctrlMeta)
Buffer.paste();
Buffer.paste();
break;
case Key.Z:

View file

@ -56,7 +56,7 @@
CURRENT_PATH: function() {
return DOM.CurrentInfo.path;
}
}
};
}
function create(callback) {

View file

@ -3,9 +3,9 @@ var Util, DOM, CloudFunc, CloudCmd;
(function (Util, DOM, CloudFunc, CloudCmd) {
'use strict';
CloudCmd.Listeners = new ListenersProto(Util, DOM, CloudFunc, CloudCmd);
CloudCmd.Listeners = new ListenersProto(Util, DOM, CloudFunc, CloudCmd);
function ListenersProto(Util, DOM, CloudFunc, CloudCmd) {
function ListenersProto(Util, DOM, CloudFunc, CloudCmd) {
var Info = DOM.CurrentInfo,
Storage = DOM.Storage,
Events = DOM.Events,
@ -286,7 +286,7 @@ var Util, DOM, CloudFunc, CloudCmd;
DOM.setCurrentFile(element);
toName = Info.name;
if (key.shift)
if (key.shift)
files = getFilesRange(fromName, toName);
else
files.push(Info.element);
@ -443,6 +443,6 @@ var Util, DOM, CloudFunc, CloudCmd;
});
}
}
}
})(Util, DOM, CloudFunc, CloudCmd);

View file

@ -34,10 +34,10 @@ var CloudCmd, Util, DOM;
Markdown.read(name, function(error, result) {
var div = DOM.load({
name : 'div',
className : 'help',
inner : result
});
name : 'div',
className : 'help',
inner : result
});
Images.hide();

View file

@ -141,8 +141,8 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
var menu = {
'Paste' : Buffer.paste,
'New' : {
'File' : DOM.promptNewFile,
'Directory' : DOM.promptNewDir
'File' : DOM.promptNewFile,
'Directory' : DOM.promptNewDir
},
'Upload' : function() {
CloudCmd.Upload.show();
@ -199,7 +199,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
Dialog.alert.noFiles(TITLE);
});
},
};
};
Util.copyObj(menu, menuData);
@ -340,10 +340,10 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
function getCurrentPosition() {
var current = Info.element,
rect = current.getBoundingClientRect();
position = {
x: rect.left + rect.width / 3,
y: rect.top
};
position = {
x: rect.left + rect.width / 3,
y: rect.top
};
return position;
}
@ -361,7 +361,7 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO;
event.preventDefault();
} else if (key === ESC) {
Menu.hide();
Menu.hide();
}
}

View file

@ -33,11 +33,11 @@ var Util, DOM;
granted = Notify.check();
if (notifications && granted && Show) {
notify = new Notification(msg, {
icon: '/img/favicon/favicon-notify.png'
});
notify = new Notification(msg, {
icon: '/img/favicon/favicon-notify.png'
});
Events.addClick(notify, focus);
Events.addClick(notify, focus);
}
});
};

View file

@ -195,7 +195,7 @@
error: function(error) {
if (options.noContinue) {
listeners.end(error);
Dialog.alert(TITLE, error)
Dialog.alert(TITLE, error);
} else {
Dialog.confirm(TITLE, error + '\n Continue?')
.then(function() {
@ -309,7 +309,7 @@
else
type = 'file';
type += ' ';
type += ' ';
name = DOM.getCurrentName(current);
msg = msgAsk + msgSel + type + name + '?';
@ -373,7 +373,7 @@
* @param operation
*/
function processFiles(data, operation, message) {
var name, selFiles, files,
var name, selFiles, files,
Info = DOM.CurrentInfo,
panel,
shouldAsk,
@ -466,7 +466,7 @@
if (type === 'zip')
return /\.zip$/;
return /\.tar\.gz$/
return /\.tar\.gz$/;
}
function twopack(operation, type) {
@ -552,9 +552,9 @@
'/remedy/remedy.js',
'/ishtar/ishtar.js',
'/salam/salam.js'
].map(function(name) {
return prefix + name;
});
].map(function(name) {
return prefix + name;
});
DOM.load.parallel(files, function(error) {
if (error) {

View file

@ -28,7 +28,7 @@ var Util, DOM, jQuery;
fBound.prototype = new NOP();
return fBound;
};
};
if (!Array.isArray)
Array.isArray = function(arr) {

View file

@ -85,7 +85,7 @@ var Util, DOM, CloudFunc, CloudCmd;
});
};
this.cp = function(data, callback) {
this.cp = function(data, callback) {
sendRequest({
method : 'PUT',
url : '/cp',
@ -168,7 +168,7 @@ var Util, DOM, CloudFunc, CloudCmd;
}
};
function sendRequest(params) {
function sendRequest(params) {
var p = params,
prefixUrl = CloudCmd.PREFIX_URL;

View file

@ -11,7 +11,7 @@
Storage: Storage
});
function StorageProto() {
function StorageProto() {
/* приватный переключатель возможности работы с кэшем */
var Allowed;

View file

@ -1,4 +1,4 @@
var CloudCmd, Util, DOM, CloudFunc, $;
var CloudCmd, Util, DOM, CloudFunc, $, exec;
(function(CloudCmd, Util, DOM, CloudFunc) {
'use strict';
@ -14,26 +14,26 @@ var CloudCmd, Util, DOM, CloudFunc, $;
Info = DOM.CurrentInfo,
Key = CloudCmd.Key,
Images = DOM.Images,
View = Util.exec.bind(Util),
View = exec.bind(Util),
Element, TemplateAudio, Overlay,
Config = {
beforeShow : function(callback) {
Images.hide();
Key.unsetBind();
showOverlay();
Util.exec(callback);
exec(callback);
},
beforeClose : function(callback) {
Key.setBind();
Util.exec(callback);
exec(callback);
hideOverlay();
},
afterShow : function(callback) {
Element.focus();
Util.exec(callback);
exec(callback);
},
afterClose : function(callback) {
Util.exec(callback);
exec(callback);
},
fitToView : true,
loop : false,
@ -59,16 +59,16 @@ var CloudCmd, Util, DOM, CloudFunc, $;
View.hide = hide;
function init() {
var func = CallBack || Util.exec.with(show, null);
var func = CallBack || exec.with(show, null);
Loading = true;
Util.exec.series([
exec.series([
DOM.loadJquery,
load,
function(callback) {
Loading = false;
Util.exec(callback);
exec(callback);
}
], func);
@ -127,9 +127,9 @@ var CloudCmd, Util, DOM, CloudFunc, $;
break;
case 'media':
getMediaElement(path, function(element) {
getMediaElement(path, function(element) {
var media = DOM.getByDataName('js-media', element);
var onKey = Util.exec.with(onMediaKey, media);
var onKey = exec.with(onMediaKey, media);
$.fancybox.open(element, {
parent : Overlay,
@ -334,9 +334,9 @@ var CloudCmd, Util, DOM, CloudFunc, $;
id : 'view-inlince-css',
inner : [
'.fancybox-title-float-wrap .child {',
'-webkit-border-radius: 0;',
'-moz-border-radius: 0;',
'border-radius: 0;',
'-webkit-border-radius: 0;',
'-moz-border-radius: 0;',
'border-radius: 0;',
'}'
].join('')
});

View file

@ -53,10 +53,12 @@
"lint:js": "redrun jshint jscs eslint:*",
"lint:js:es5": "redrun es5:*",
"eslint:bin": "eslint --rule 'no-console:0' bin test server",
"fix:eslint:bin": "redrun eslint:bin -- --fix",
"jshint": "jshint bin/release.js",
"jscs": "jscs --esnext $npm_package_config_dirs",
"es5:jshint": "jshint --config .es5/.jshintrc $npm_package_config_dirs_dirs_legacy --exclude bin/release.js",
"es5:eslint": "eslint -c .es5/.eslintrc --rule 'no-console:0' $npm_package_config_dirs_legacy --ignore-path bin/release.js",
"fix:es5:eslint": "redrun es5:eslint -- --fix",
"test": "tape 'test/**/*.js'",
"watch:test": "nodemon -w server -w test -x \"npm run test\"",
"spell": "yaspeller .",

View file

@ -41,7 +41,7 @@ const FS = CloudFunc.FS;
const CSS_URL = require(DIR_JSON + 'css.json')
.map((name) => {
return 'css/' + name + '.css'
return 'css/' + name + '.css';
}).join(':');
module.exports = (req, res, next) => {

View file

@ -7,7 +7,7 @@ const before = require('./before');
test('cloudcmd: console: enabled by default', (t) => {
before({}, (port, after) => {
const socket = io(`http://localhost:${port}/console`)
const socket = io(`http://localhost:${port}/console`);
socket.once('data', (data) => {
socket.close();
@ -22,7 +22,7 @@ test('cloudcmd: console: enabled', (t) => {
const config = {console: true};
before({config}, (port, after) => {
const socket = io(`http://localhost:${port}/console`)
const socket = io(`http://localhost:${port}/console`);
socket.once('data', (data) => {
socket.close();