chore: lint

This commit is contained in:
coderiaser 2026-03-17 20:43:43 +02:00
parent b28a070a28
commit 5c19ddba61
14 changed files with 33 additions and 8 deletions

View file

@ -11,7 +11,7 @@ jobs:
node-version:
- 22.x
- 24.x
- 25.6.1
- 25.x
steps:
- uses: actions/checkout@v5
- uses: oven-sh/setup-bun@v2
@ -27,7 +27,7 @@ jobs:
run: bun i --no-save
- name: Lint
run: redrun fix:lint
- uses: actions/cache@v4
- uses: actions/cache@v5
with:
path: |
~/.cargo/bin/

View file

@ -19,10 +19,12 @@ await main();
async function main() {
const history = '## Version history\n\n';
const link = '//github.com/coderaiser/cloudcmd/releases/tag/';
const template = '- ' +
'*{{ date }}*, ' +
'**[v{{ version }}]' +
'(' + link +
'(' +
link +
'v{{ version }})**\n';
const {version} = Info;
@ -35,10 +37,11 @@ async function main() {
await replaceVersion('README.md', version, versionNew);
await replaceVersion('HELP.md', version, versionNew);
const historyNew = history + rendy(template, {
date: shortdate(),
version: versionNew,
});
const historyNew = history +
rendy(template, {
date: shortdate(),
version: versionNew,
});
await replaceVersion('HELP.md', history, historyNew);
}

View file

@ -63,7 +63,10 @@ async function keyListener(event) {
if (ctrlMeta && event.keyCode === Key.S) {
hide();
} else if (ctrlMeta && event.keyCode === Key.P) {
return;
}
if (ctrlMeta && event.keyCode === Key.P) {
const [, pattern] = await Dialog.prompt('Apply pattern:', '[n][e]');
pattern && applyPattern(pattern);
}

View file

@ -53,6 +53,7 @@ test('cloudfunc: buildFromJSON: ..', (t) => {
test('cloudfunc: getPathLink: /', (t) => {
const {pathLink} = template;
const result = getPathLink('/', '', pathLink);
const expected = montag`
<a data-name="js-path-link" href="/fs/" title="/">/</a>
`;
@ -64,6 +65,7 @@ test('cloudfunc: getPathLink: /', (t) => {
test('cloudfunc: getPathLink: /hello/world', (t) => {
const {pathLink} = template;
const result = getPathLink('/hello/world', '', pathLink);
const expected = montag`
<a data-name="js-path-link" href="/fs/" title="/">/</a>hello/
`;
@ -75,6 +77,7 @@ test('cloudfunc: getPathLink: /hello/world', (t) => {
test('cloudfunc: getPathLink: prefix', (t) => {
const {pathLink} = template;
const result = getPathLink('/hello/world', '/cloudcmd', pathLink);
const expected = montag`
<a data-name="js-path-link" href="/cloudcmd/fs/" title="/">/</a>hello/
`;
@ -86,6 +89,7 @@ test('cloudfunc: getPathLink: prefix', (t) => {
test('cloudfunc: getSize: dir', (t) => {
const type = 'directory';
const size = 0;
const result = _getSize({
type,
size,
@ -100,6 +104,7 @@ test('cloudfunc: getSize: dir', (t) => {
test('cloudfunc: getSize: link: dir', (t) => {
const type = 'directory-link';
const size = 0;
const result = _getSize({
type,
size,
@ -114,6 +119,7 @@ test('cloudfunc: getSize: link: dir', (t) => {
test('cloudfunc: getSize: link: file', (t) => {
const type = 'file-link';
const size = 0;
const result = _getSize({
type,
size,
@ -128,6 +134,7 @@ test('cloudfunc: getSize: link: file', (t) => {
test('cloudfunc: getSize: file', (t) => {
const type = 'file';
const size = '100.00kb';
const result = _getSize({
type,
size,

View file

@ -63,6 +63,7 @@ test('util: findObjByNameInArr: object', (t) => {
test('util: findObjByNameInArr: array', (t) => {
const name = 'hello';
const data = 'abc';
const item = {
name,
data,

View file

@ -51,6 +51,7 @@ export default cloudcmd;
export function cloudcmd(params) {
const p = params || {};
const options = p.config || {};
const config = p.configManager || createConfig({
configPath,
});

View file

@ -35,6 +35,7 @@ export const getColumns = ({isDev = _isDev()} = {}) => {
const readFilesSyncMemo = nanomemoize((isDev) => {
const dist = getDist(isDev);
const columnsDir = path.join(__dirname, '..', dist, 'columns');
const names = fs
.readdirSync(columnsDir)
.filter(not(isMap));

View file

@ -197,6 +197,7 @@ function get(manage, request, response) {
async function patch(manage, request, response) {
const name = 'config.json';
const cache = false;
const options = {
name,
request,

View file

@ -65,6 +65,7 @@ export const _getReadDir = getReadDir;
async function route({config, options, request, response}) {
const name = ponse.getPathName(request);
const gzip = true;
const p = {
request,
response,

View file

@ -243,6 +243,7 @@ test('cloudcmd: route: sendIndex: encode', async (t) => {
test('cloudcmd: route: sendIndex: encode: not encoded', async (t) => {
const name = '"><svg onload=alert(3);>';
const path = '/';
const files = [{
name,
}];
@ -276,6 +277,7 @@ test('cloudcmd: route: sendIndex: encode: not encoded', async (t) => {
test('cloudcmd: route: sendIndex: ddos: render', async (t) => {
const name = `$$$'&quot;`;
const path = '/';
const files = [{
name,
}];

View file

@ -24,6 +24,7 @@ export const getThemes = ({isDev = _isDev()} = {}) => {
const readFilesSyncMemo = nanomemoize((isDev) => {
const dist = getDist(isDev);
const themesDir = path.join(__dirname, '..', dist, 'themes');
const names = fs
.readdirSync(themesDir)
.filter(not(isMap));

View file

@ -55,6 +55,7 @@ export const columns = (type, overrides = {}) => {
} = overrides;
const addQuotes = (a) => `"${a}"`;
const all = Object
.keys(getColumns())
.concat('');
@ -75,6 +76,7 @@ export const theme = (type, overrides = {}) => {
} = overrides;
const addQuotes = (a) => `"${a}"`;
const all = Object
.keys(getThemes())
.concat('');

View file

@ -30,6 +30,7 @@ test('cloudcmd: static: user menu: Rename', async (t) => {
test('cloudcmd: static: user menu: R', (t) => {
const name = 'R - cd /';
const changeDir = stub();
const CloudCmd = {
changeDir,
};

View file

@ -83,6 +83,7 @@ test('cloudcmd: /cloudcmd.js: auth: access denied', async (t) => {
test('cloudcmd: /cloudcmd.js: auth: no password', async (t) => {
const name = 'cloudcmd.js';
const username = 'hello';
const config = {
auth: true,
username,