chore(cloudcmd) lint: no-multi-spaces

This commit is contained in:
coderaiser 2019-02-08 15:47:05 +02:00
parent d3ecafe0ea
commit 62e2ca2a64
28 changed files with 78 additions and 72 deletions

View file

@ -18,10 +18,10 @@ main((error) => {
});
function main(callback) {
const history = 'Version history\n---------------\n';
const link = '//github.com/coderaiser/cloudcmd/releases/tag/';
const template = '- *{{ date }}*, ' +
'**[v{{ version }}]' +
const history = 'Version history\n---------------\n';
const link = '//github.com/coderaiser/cloudcmd/releases/tag/';
const template = '- *{{ date }}*, ' +
'**[v{{ version }}]' +
'(' + link + 'v{{ version }})**\n';
const {version} = Info;
@ -47,7 +47,7 @@ function replaceVersion(name, version, versionNew, callback) {
if (error)
return callback(error);
callback(null, 'done: ' + name);
callback(null, 'done: ' + name);
});
}

View file

@ -66,8 +66,8 @@ function CloudCmdProto(DOM) {
this.DIRCLIENT = '/dist/';
this.DIRCLIENT_MODULES = this.DIRCLIENT + 'modules/';
this.MIN_ONE_PANEL_WIDTH = 1155;
this.HOST = location.origin ||
this.MIN_ONE_PANEL_WIDTH = 1155;
this.HOST = location.origin ||
location.protocol + '//' + location.host;
const TITLE = 'Cloud Commander';
@ -392,7 +392,7 @@ function CloudCmdProto(DOM) {
};
if (!options)
options = {};
options = {};
CloudCmd.log('reading dir: "' + path + '";');

View file

@ -17,7 +17,7 @@ function BufferProto() {
const CUT = 'cut';
const TITLE = 'Buffer';
const Buffer = {
const Buffer = {
cut : callIfEnabled.bind(null, cut),
copy : callIfEnabled.bind(null, copy),
clear : callIfEnabled.bind(null, clear),

View file

@ -101,7 +101,7 @@ module.exports.getCurrentDirName = () => {
const href = DOM.getCurrentDirPath()
.replace(/\/$/, '');
const substr = href.substr(href, href.lastIndexOf('/'));
const substr = href.substr(href, href.lastIndexOf('/'));
const ret = href.replace(substr + '/', '') || '/';
return ret;

View file

@ -54,7 +54,7 @@ module.exports.getByClass = (className, element = document) => {
};
module.exports.getByDataName = (attribute, element = document) => {
const selector = '[' + 'data-name="' + attribute + '"]';
const selector = '[' + 'data-name="' + attribute + '"]';
return element.querySelector(selector);
};

View file

@ -47,8 +47,8 @@ function EventsProto() {
isFunc = itype.function(element);
if (isFunc) {
listener = element;
element = null;
listener = element;
element = null;
}
if (!element)
@ -122,8 +122,8 @@ function EventsProto() {
};
if (!listener) {
listener = element;
element = null;
listener = element;
element = null;
}
this.add(type, element, once);

View file

@ -80,11 +80,11 @@ function getPath(name, isHTML, isJSON) {
if (isRoot)
path = DIR_HTML + name.replace('-tmpl', '');
else
path = DIR_HTML_FS + name;
path = DIR_HTML_FS + name;
path += '.hbs';
} else if (isJSON) {
path = DIR_JSON + name + '.json';
path = DIR_JSON + name + '.json';
}
return path;

View file

@ -67,7 +67,7 @@ module.exports.error = () => {
};
module.exports.show = show;
module.exports.show.load = show;
module.exports.show.load = show;
module.exports.show.error = error;
/**
@ -135,7 +135,7 @@ module.exports.setProgress = (value, title) => {
return Images;
};
module.exports.clearProgress = () => {
module.exports.clearProgress = () => {
const DATA = 'data-progress';
const element = Images.get();

View file

@ -950,6 +950,8 @@ function CmdProto() {
const filesPassive = DOM.getFiles(panelPassive);
const name = DOM.getCurrentName(current);
/* eslint no-multi-spaces:0 */
info.dir = DOM.getCurrentDirName();
info.dirPath = DOM.getCurrentDirPath();
info.parentDirPath = DOM.getParentDirPath();

View file

@ -31,10 +31,10 @@ module.exports = (name, options, callback = options) => {
let local;
if (isArray) {
remoteTmpls = module.remote;
local = module.local;
local = module.local;
} else {
remoteTmpls = [module.remote];
local = [module.local];
remoteTmpls = [module.remote];
local = [module.local];
}
const localURL = local.map((url) => {

View file

@ -64,7 +64,7 @@ module.exports.ajax = (params) => {
xhr.onreadystatechange = (event) => {
const xhr = event.target;
const OK = 200;
const OK = 200;
if (xhr.readyState !== xhr.DONE)
return;
@ -72,7 +72,7 @@ module.exports.ajax = (params) => {
Images.clearProgress();
const TYPE_JSON = 'application/json';
const type = xhr.getResponseHeader('content-type');
const type = xhr.getResponseHeader('content-type');
if (xhr.status !== OK)
return exec(p.error, xhr);
@ -104,7 +104,7 @@ module.exports.put = (url, body) => {
return;
const percent = (event.loaded / event.total) * 100;
const count = Math.round(percent);
const count = Math.round(percent);
emitter.emit('progress', count);
};

View file

@ -55,8 +55,8 @@ function RESTful() {
const isFunc = itype.function(data);
if (!callback && isFunc) {
callback = data;
data = null;
callback = data;
data = null;
}
sendRequest({
@ -149,7 +149,7 @@ function RESTful() {
},
};
this.Markdown = {
this.Markdown = {
read(url, callback) {
sendRequest({
method : 'GET',

View file

@ -315,8 +315,8 @@ function onDragStart(event) {
}
event.dataTransfer.setData('DownloadURL',
'application/octet-stream' + ':' +
name + ':' +
'application/octet-stream' + ':' +
name + ':' +
link);
}

View file

@ -8,7 +8,7 @@ const Events = require('../dom/events');
const {Key} = CloudCmd;
const ConfigView = {
const ConfigView = {
bindKeys: false,
beforeClose: () => {
Events.rmKey(listener);

View file

@ -25,7 +25,7 @@ const TITLE = 'Edit';
let MSG_CHANGED;
const isLoading = fullstore();
const ConfigView = {
const ConfigView = {
beforeClose: () => {
exec.ifExist(Menu, 'hide');
isChanged();

View file

@ -7,7 +7,7 @@ CloudCmd.EditNamesVim = exports;
const Events = require('../dom/events');
const {Key} = CloudCmd;
const ConfigView = {
const ConfigView = {
bindKeys: false,
beforeClose: () => {
Events.rmKey(listener);

View file

@ -21,7 +21,7 @@ const rename = currify(_rename);
let Menu;
const EditNames = exec.bind();
const ConfigView = {
const ConfigView = {
beforeClose: () => {
exec.ifExist(Menu, 'hide');
DOM.Events.remove('keydown', keyListener);

View file

@ -39,8 +39,8 @@ module.exports.init = async () => {
function create() {
const element = createElement('div', {
style:
'width : 100%;' +
'height : 100%;' +
'width : 100%;' +
'height : 100%;' +
'font-family: "Droid Sans Mono";',
notAppend: true,
});

View file

@ -94,10 +94,10 @@ function getOptions(notFile) {
let func;
if (notFile) {
name = 'context';
func = Key.unsetBind;
name = 'context';
func = Key.unsetBind;
} else {
name = 'contextFile';
name = 'contextFile';
}
const options = {
@ -244,7 +244,7 @@ function uploadFromCloud() {
CloudCmd.execFromModule('Cloud', 'saveFile', (currentName, data) => {
const path = DOM.getCurrentDirPath() + currentName;
RESTful.write(path, data, (error) => {
RESTful.write(path, data, (error) => {
if (error)
return;

View file

@ -294,6 +294,8 @@ function _processFiles(options, data) {
let names = [];
/* eslint no-multi-spaces: 0 */
if (data) {
from = data.from;
to = data.to;

View file

@ -43,9 +43,9 @@ function show() {
createElement('style', {
dataName: 'upload-css',
innerText: '[data-name=js-upload-file-button] {' +
`font-family: ${fontFamily};` +
'font-size: 20px;' +
'width: 97%' +
`font-family: ${fontFamily};` +
'font-size: 20px;' +
'width: 97%' +
'}',
});
}

View file

@ -267,10 +267,10 @@ function getMediaElement(src, callback) {
return alert(error);
if (!TemplateAudio)
TemplateAudio = template;
TemplateAudio = template;
const is = isAudio(name);
const type = is ? 'audio' : 'video';
const type = is ? 'audio' : 'video';
const innerHTML = rendy(TemplateAudio, {
src,

View file

@ -253,7 +253,7 @@ function getSize(file) {
}
function _getHeaderField(sort, order, name) {
const arrow = order === 'asc' ? '↑' : '↓';
const arrow = order === 'asc' ? '↑' : '↓';
if (sort !== name)
return name;

View file

@ -58,9 +58,9 @@ const config = {
const connectionWraped = wraptile(connection);
module.exports = manage;
module.exports.save = save;
module.exports.middle = middle;
module.exports = manage;
module.exports.save = save;
module.exports.middle = middle;
module.exports.subscribe = (fn) => {
changeEmitter.on('change', fn);
};
@ -69,7 +69,7 @@ module.exports.unsubscribe = (fn) => {
changeEmitter.removeListener('change', fn);
};
module.exports.listen = (socket, auth) => {
module.exports.listen = (socket, auth) => {
check(socket, auth);
if (!manage('configDialog'))

View file

@ -42,7 +42,7 @@ module.exports = (request, response, next) => {
function rest(request, response) {
const name = ponse.getPathName(request);
const params = {
const params = {
request,
response,
name: name.replace(apiURL, '') || '/',
@ -194,8 +194,8 @@ function onPUT(name, body, callback) {
if (isRootAll([files.to, files.from]))
return callback(getWin32RootMsg());
files.from = root(files.from);
files.to = root(files.to);
files.from = root(files.from);
files.to = root(files.to);
copy(files.from, files.to, files.names, (error) => {
const msg = formatMsg('copy', files.names);
@ -262,8 +262,8 @@ function getPacker(operation) {
function operation(op, from, to, names, fn) {
if (!fn) {
fn = names;
names = [
fn = names;
names = [
path.basename(from),
];
}

View file

@ -34,11 +34,11 @@ const logger = tryRequire('morgan');
module.exports = async (options) => {
const prefix = config('prefix');
const port = process.env.PORT || /* c9 */
const port = process.env.PORT || /* c9 */
config('port');
const ip = process.env.IP || /* c9 */
config('ip') ||
const ip = process.env.IP || /* c9 */
config('ip') ||
'0.0.0.0';
const app = express();

View file

@ -21,7 +21,7 @@ const {reRequire} = require('mock-require');
const htmlLooksLike = require('html-looks-like');
const readFilesSync = require('@cloudcmd/read-files-sync');
const FS_DIR = TMPLDIR + 'fs/';
const FS_DIR = TMPLDIR + 'fs/';
const EXPECT_PATH = __dirname + '/cloudfunc.html';
const addHBS = (a) => `${a}.hbs`;
@ -51,19 +51,21 @@ const JSON_FILES = {
}],
};
/* eslint no-multi-space: 0 */
let Expect =
'<div data-name="js-path" class="reduce-text" title="/etc/X11/">' +
'<span data-name="js-copy-path" class="path-icon icon-copy-to-clipboard"' +
' title="copy path (Ctrl+P)">' +
'</span>' +
'<a data-name="js-refresh" href="/fs/etc/X11/" ' +
'class="path-icon icon-refresh" title="refresh (Ctrl+R)"></a>' +
'<span data-name="js-links" class=links>' +
'<a data-name="js-path-link" href="/fs/" title="/">/</a>' +
'<a data-name="js-path-link" href="/fs/etc/" title="/etc/">' +
'etc' +
'</a>/X11/' +
'</span>' +
'<div data-name="js-path" class="reduce-text" title="/etc/X11/">' +
'<span data-name="js-copy-path" class="path-icon icon-copy-to-clipboard"' +
' title="copy path (Ctrl+P)">' +
'</span>' +
'<a data-name="js-refresh" href="/fs/etc/X11/" ' +
'class="path-icon icon-refresh" title="refresh (Ctrl+R)"></a>' +
'<span data-name="js-links" class=links>' +
'<a data-name="js-path-link" href="/fs/" title="/">/</a>' +
'<a data-name="js-path-link" href="/fs/etc/" title="/etc/">' +
'etc' +
'</a>/X11/' +
'</span>' +
'</div>';
test('cloudfunc: render', (t) => {

View file

@ -8,7 +8,7 @@ const dir = join(__dirname, '..', '..');
const modulesPath = join(dir, 'json', 'modules.json');
const cloudcmdPath = dir;
const localModules = require(modulesPath);
const localModules = require(modulesPath);
const modulas = require(`${dir}/server/modulas`);
const cloudcmd = require(cloudcmdPath);