chore: cloudcmd: actions: lint ☘️

This commit is contained in:
coderaiser 2025-03-29 17:32:46 +00:00
parent 9f52ed795d
commit 84c6935ae4
7 changed files with 73 additions and 72 deletions

View file

@ -19,7 +19,8 @@ await main();
async function main() {
const history = '## Version history\n\n';
const link = '//github.com/coderaiser/cloudcmd/releases/tag/';
const template = '- *{{ date }}*, ' +
const template =
'- *{{ date }}*, ' +
'**[v{{ version }}]' +
'(' + link +
'v{{ version }})**\n';

View file

@ -173,7 +173,6 @@ module.exports.buildFromJSON = (params) => {
Path(path);
fileTable += `${header}<ul data-name="js-files" class="files">`;
/* Если мы не в корне */
if (path !== '/') {
const dotDot = getDotDot(path);
@ -204,43 +203,43 @@ module.exports.buildFromJSON = (params) => {
fileTable += files
.filter(filterOutDotFiles({
showDotFiles,
}))
showDotFiles,
}))
.map(updateField)
.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,
className: '',
type,
name: linkResult,
size,
date,
owner,
mode,
});
})
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,
className: '',
type,
name: linkResult,
size,
date,
owner,
mode,
});
})
.join('');
fileTable += '</ul>';

View file

@ -6,22 +6,22 @@ const repl = require('node:repl');
module.exports = net
.createServer((socket) => {
const {pid} = process;
const addr = socket.remoteAddress;
const port = socket.remotePort;
const r = repl.start({
prompt: `[${pid} ${addr}:${port}>`,
input: socket,
output: socket,
terminal: true,
useGlobal: false,
});
r.on('exit', () => {
socket.end();
});
r.context.socket = socket;
})
const {pid} = process;
const addr = socket.remoteAddress;
const port = socket.remotePort;
const r = repl.start({
prompt: `[${pid} ${addr}:${port}>`,
input: socket,
output: socket,
terminal: true,
useGlobal: false,
});
r.on('exit', () => {
socket.end();
});
r.context.socket = socket;
})
.listen(1337);

View file

@ -11,9 +11,9 @@ module.exports = (config) => {
const data = Object
.keys(config)
.map((name) => [
name,
config[name],
]);
name,
config[name],
]);
if (!data.length)
return '';

View file

@ -80,10 +80,10 @@ async function onGET({req, res, menuName, readFile}) {
function getError(error, source) {
return montag`
const e = Error(\`<pre>${codeframe({
error,
source,
highlightCode: false,
})}</pre>\`);
error,
source,
highlightCode: false,
})}</pre>\`);
e.code = 'frame';

View file

@ -44,7 +44,8 @@ const data = {
}],
};
let Expect = '<div data-name="js-path" class="reduce-text" title="/etc/X11/">' +
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>' +
@ -74,13 +75,13 @@ test('cloudfunc: render', (t) => {
const isNotOk = Expect
.split('')
.some((item, number) => {
const ret = result[number] !== item;
if (ret)
i = number;
return ret;
});
const ret = result[number] !== item;
if (ret)
i = number;
return ret;
});
timeEnd('CloudFunc.buildFromJSON');

View file

@ -170,7 +170,7 @@ test('cloudcmd: rest: pack: zip: put: file', async (t) => {
config,
};
const name = String(Math.random()) + '.zip';
const name = `${Math.random()}.zip`;
await request.put(`/api/v1/pack`, {
options,
@ -192,7 +192,7 @@ test('cloudcmd: rest: pack: zip: put: response', async (t) => {
config,
};
const name = String(Math.random()) + '.zip';
const name = `${Math.random()}.zip`;
const {body} = await request.put(`/api/v1/pack`, {
options,