chore(cloudcmd) lint

This commit is contained in:
coderaiser 2019-09-28 16:42:30 +03:00
parent d473a7e187
commit 794caced01
15 changed files with 42 additions and 35 deletions

View file

@ -352,7 +352,7 @@ function CloudCmdProto(DOM) {
const {noCurrent} = options;
if (!isRefresh && json)
return createFileTable(json, panel, options, callback);
return await createFileTable(json, panel, options, callback);
const position = DOM.getPanelPosition(panel);
const sort = CloudCmd.sort[position];
@ -403,7 +403,7 @@ function CloudCmdProto(DOM) {
* @param history
* @param callback
*/
async function createFileTable(json, panelParam, options) {
async function createFileTable(data, panelParam, options) {
const {
history,
noCurrent,
@ -413,7 +413,7 @@ function CloudCmdProto(DOM) {
const [
error,
[templFile, templPath, templLink, templPathLink],
[file, path, link, pathLink],
] = await tryToCatch(Files.get, names);
if (error)
@ -436,14 +436,14 @@ function CloudCmdProto(DOM) {
panel.innerHTML = buildFromJSON({
sort : options.sort,
order : options.order,
data : json,
data,
id : panel.id,
prefix,
template : {
file : templFile,
path : templPath,
pathLink : templPathLink,
link : templLink,
file,
path,
pathLink,
link,
},
});

View file

@ -42,7 +42,7 @@ function BufferProto() {
function rmCutClass() {
const files = DOM.getByClassAll(CLASS);
for (const element of [...files]) {
for (const element of files) {
element.classList.remove(CLASS);
}
}

View file

@ -16,7 +16,7 @@ module.exports = (items) => {
if (items.length)
Images.show('top');
const entries = [...items].map((item) => {
const entries = Array.from(items).map((item) => {
return item.webkitGetAsEntry();
});

View file

@ -28,7 +28,7 @@ async function getFile(name) {
check(name);
if (type === 'string')
return getModule(name);
return await getModule(name);
if (type === 'array')
return Promise.all(unaryMap(name, get));

View file

@ -173,7 +173,7 @@ function CmdProto() {
const panel = DOM.getPanel();
const selected = DOM.getByClassAll(SELECTED_FILE, panel);
return [...selected];
return Array.from(selected);
};
/*
@ -182,7 +182,7 @@ function CmdProto() {
this.unselectFiles = (files) => {
files = files || DOM.getSelectedFiles();
[...files].forEach(DOM.toggleSelectedFile);
Array.from(files).forEach(DOM.toggleSelectedFile);
};
/**
@ -412,7 +412,7 @@ function CmdProto() {
const from = (a) => a === '..' ? 1 : 0;
const i = from(name);
return [...files].slice(i);
return Array.from(files).slice(i);
};
/**
@ -496,7 +496,7 @@ function CmdProto() {
const first = files[0] || DOM.getCurrentFile();
const name = DOM.getCurrentName(first);
const allFiles = [...files];
const allFiles = Array.from(files);
if (name === '..')
allFiles.shift();
@ -852,13 +852,13 @@ function CmdProto() {
panelPassive,
} = Info;
const dirPath = DOM.getCurrentDirPath();
const path = DOM.getCurrentDirPath();
const dirPathPassive = DOM.getNotCurrentDirPath();
let currentIndex = files.indexOf(element);
CloudCmd.loadDir({
path: dirPath,
path,
panel: panelPassive,
noCurrent: true,
});
@ -901,8 +901,8 @@ function CmdProto() {
info.parentDirPath = DOM.getParentDirPath();
info.element = current;
info.ext = Util.getExt(name);
info.files = [...files.children];
info.filesPassive = [...filesPassive];
info.files = Array.from(files.children);
info.filesPassive = Array.from(filesPassive);
info.first = files.firstChild;
info.getData = DOM.getCurrentData;
info.last = files.lastChild;

View file

@ -27,7 +27,7 @@ module.exports = (dir, files) => {
if (!n)
return;
const array = [...files];
const array = Array.from(files);
const {name} = files[0];
eachSeries(array, loadFile(dir, n), onEnd(name));

View file

@ -1,7 +1,7 @@
'use strict';
module.exports.getDOM = () => {
const resolve = Promise.resolve.bind(Promise);
const prompt = Promise.resolve.bind(Promise);
const CurrentInfo = {
element: {},
files: [],
@ -14,7 +14,7 @@ module.exports.getDOM = () => {
};
const Dialog = {
prompt: resolve,
prompt,
};
return {

View file

@ -424,7 +424,7 @@ function dragndrop() {
return uploadFiles(files);
const isFile = (item) => item.kind === 'file';
const dirFiles = [...items].filter(isFile);
const dirFiles = Array.from(items).filter(isFile);
if (dirFiles.length)
return DOM.uploadDirectory(dirFiles);

View file

@ -173,7 +173,7 @@ async function fillTemplate() {
const getTarget = ({target}) => target;
const handleChange = squad(onChange, getTarget);
[...inputs]
Array.from(inputs)
.map(addKey(onKey))
.map(addChange(handleChange));