Skip to content

Commit

Permalink
chore: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
coderaiser committed Mar 21, 2024
1 parent fcce26d commit 1bef0d4
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 61 deletions.
8 changes: 1 addition & 7 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

module.exports = {
extends: [
'plugin:putout/safe',
'plugin:putout/safe+align',
],
plugins: [
'putout',
Expand All @@ -18,9 +18,6 @@ module.exports = {
'no-console': 'off',
'n/shebang': 'off',
},
extends: [
'plugin:n/recommended',
],
}, {
files: ['client/dom/index.js'],
rules: {
Expand All @@ -31,9 +28,6 @@ module.exports = {
rules: {
'no-console': 'off',
},
extends: [
'plugin:n/recommended',
],
}, {
files: ['{client,common,static}/**/*.js'],
env: {
Expand Down
16 changes: 8 additions & 8 deletions client/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function CloudCmdProto(DOM) {
currentName,
}, panel);
};

/**
* Конструктор CloudClient, который
* выполняет весь функционал по
Expand Down Expand Up @@ -148,7 +148,7 @@ function CloudCmdProto(DOM) {

await load.css(name);
}

this.route = (path) => {
const query = path.split('/');

Expand Down Expand Up @@ -216,7 +216,7 @@ function CloudCmdProto(DOM) {
async function saveCurrentName(currentName) {
await Storage.set('current-name', currentName);
}

async function baseInit() {
const files = DOM.getFiles();

Expand Down Expand Up @@ -253,7 +253,7 @@ function CloudCmdProto(DOM) {
if (!data)
await Storage.setJson(dirPath, getJsonFromFileTable());
}

function getPanels() {
const panels = ['left'];

Expand All @@ -265,7 +265,7 @@ function CloudCmdProto(DOM) {
'right',
];
}

this.execFromModule = async (moduleName, funcName, ...args) => {
await CloudCmd[moduleName]();

Expand All @@ -290,7 +290,7 @@ function CloudCmdProto(DOM) {
currentName,
});
};

/**
* Функция загружает json-данные о Файловой Системе
* через ajax-запрос.
Expand Down Expand Up @@ -343,7 +343,7 @@ function CloudCmdProto(DOM) {

Storage.setJson(path, newObj);
}

/**
* Функция строит файловую таблицу
* @param json - данные о файлах
Expand Down Expand Up @@ -409,7 +409,7 @@ function CloudCmdProto(DOM) {
CloudCmd.emit('active-dir', Info.dirPath);
}
}

this.goToParentDir = async () => {
const {
dir,
Expand Down
20 changes: 10 additions & 10 deletions client/dom/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,29 @@ function BufferProto() {
function showMessage(msg) {
DOM.Dialog.alert(msg);
}

function getNames() {
const files = DOM.getActiveFiles();

return DOM.getFilenames(files);
}

function addCutClass() {
const files = DOM.getActiveFiles();

for (const element of files) {
element.classList.add(CLASS);
}
}

function rmCutClass() {
const files = DOM.getByClassAll(CLASS);

for (const element of files) {
element.classList.remove(CLASS);
}
}

function callIfEnabled(callback) {
const is = CloudCmd.config('buffer');

Expand All @@ -54,7 +54,7 @@ function BufferProto() {

showMessage('Buffer disabled in config!');
}

async function readBuffer() {
const [e, cp, ct] = await tryToPromiseAll([
Storage.getJson(COPY),
Expand All @@ -67,7 +67,7 @@ function BufferProto() {
ct,
];
}

async function copy() {
const names = getNames();
const from = Info.dirPath;
Expand All @@ -83,7 +83,7 @@ function BufferProto() {
names,
});
}

async function cut() {
const names = getNames();
const from = Info.dirPath;
Expand All @@ -100,14 +100,14 @@ function BufferProto() {
names,
});
}

async function clear() {
await Storage.remove(COPY);
await Storage.remove(CUT);

rmCutClass();
}

async function paste() {
const [error, cp, ct] = await readBuffer();

Expand All @@ -130,6 +130,6 @@ function BufferProto() {

await clear();
}

return Buffer;
}
2 changes: 1 addition & 1 deletion client/dom/current-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ module.exports.setCurrentFile = (currentFile, options) => {
name,
path,
}));

/* history could be present
* but it should be false
* to prevent default behavior
Expand Down
20 changes: 10 additions & 10 deletions client/dom/events/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function EventsProto() {
break;
}
}

/**
* safe add event listener
*
Expand All @@ -95,7 +95,7 @@ function EventsProto() {

return Events;
};

/**
* safe add event listener
*
Expand All @@ -118,7 +118,7 @@ function EventsProto() {

return Events;
};

/**
* safe remove event listener
*
Expand All @@ -135,7 +135,7 @@ function EventsProto() {

return Events;
};

/**
* remove all added event listeners
*
Expand All @@ -149,7 +149,7 @@ function EventsProto() {

EventStore.clear();
};

/**
* safe add event keydown listener
*
Expand All @@ -164,7 +164,7 @@ function EventsProto() {

return Events.add(...args);
};

/**
* safe remove event click listener
*
Expand All @@ -179,7 +179,7 @@ function EventsProto() {

return Events.remove(...args);
};

/**
* safe add event click listener
*
Expand All @@ -194,7 +194,7 @@ function EventsProto() {

return Events.add(...args);
};

/**
* safe remove event click listener
*
Expand All @@ -219,7 +219,7 @@ function EventsProto() {

return Events.add(...args);
};

/**
* safe add event click listener
*
Expand All @@ -234,7 +234,7 @@ function EventsProto() {

return Events.add(...args);
};

/**
* safe add load click listener
*
Expand Down
16 changes: 8 additions & 8 deletions client/dom/load-remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,36 @@ module.exports = (name, options, callback = options) => {
.then(async (modules) => {
const online = config('online') && navigator.onLine;
const module = findObjByNameInArr(modules.remote, name);

const isArray = itype.array(module.local);
const {version} = module;

let remoteTmpls;
let local;

if (isArray) {
remoteTmpls = module.remote;
local = module.local;
} else {
remoteTmpls = [module.remote];
local = [module.local];
}

const localURL = local.map((url) => prefix + url);

const remoteURL = remoteTmpls.map((tmpl) => {
return rendy(tmpl, {
version,
});
});

if (online) {
const [e] = await tryToCatch(load.parallel, remoteURL);

if (!e)
return callback();
}

const [e] = await tryToCatch(load.parallel, localURL);
callback(e);
});
Expand Down
2 changes: 1 addition & 1 deletion client/dom/upload-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function _loadFile(dir, n, file, callback) {
.on('progress', (count) => {
const max = step(n);
const value = (i - 1) * max + percent(count, 100, max);

Images.show.load('top');
Images.setProgress(Math.round(value));
});
Expand Down
10 changes: 5 additions & 5 deletions common/cloudfunc.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ module.exports.buildFromJSON = (params) => {
Path(path);

fileTable += `${header}<ul data-name="js-files" class="files">`;

/* Если мы не в корне */
if (path !== '/') {
const dotDot = getDotDot(path);
Expand Down Expand Up @@ -199,25 +199,25 @@ module.exports.buildFromJSON = (params) => {
.map((file) => {
const name = encode(file.name);
const link = prefix + FS + path + name;

const {
type,
mode,
date,
owner,
size,
} = file;

const linkResult = rendy(templateLink, {
link,
title: name,
name,
attribute: getAttribute(file.type),
});

const dataName = getDataName(file.name);
const attribute = `draggable="true" ${dataName}`;

return rendy(templateFile, {
tag: 'li',
attribute,
Expand Down
Loading

0 comments on commit 1bef0d4

Please sign in to comment.