From 5f0391fc44b0507bf533ce6b61abc3765ba3fb27 Mon Sep 17 00:00:00 2001 From: coderiaser Date: Wed, 2 Jul 2025 20:10:47 +0300 Subject: [PATCH] chore: lint --- .putout.json | 3 --- bin/cloudcmd.mjs | 5 +++-- client/key/vim/index.js | 3 ++- client/modules/operation/index.js | 24 ++++++++++++------------ common/base64.spec.js | 20 +++++++++++--------- server/markdown/index.js | 4 ++-- server/user-menu.mjs | 3 --- 7 files changed, 30 insertions(+), 32 deletions(-) diff --git a/.putout.json b/.putout.json index 08b4f06e..1afdcf8b 100644 --- a/.putout.json +++ b/.putout.json @@ -6,9 +6,6 @@ "app.json", "fontello.json" ], - "rules": { - "github/set-node-versions": "off" - }, "match": { "base64": { "types/convert-typeof-to-is-type": "off" diff --git a/bin/cloudcmd.mjs b/bin/cloudcmd.mjs index b82e887c..c8759719 100755 --- a/bin/cloudcmd.mjs +++ b/bin/cloudcmd.mjs @@ -318,9 +318,10 @@ async function readConfig(name) { async function help() { const {default: bin} = await import('../json/help.json', { with: { - type: 'json' - } + type: 'json', + }, }); + const forEachKey = await simport('for-each-key'); const currify = await simport('currify'); diff --git a/client/key/vim/index.js b/client/key/vim/index.js index e8b01558..6a209ea7 100644 --- a/client/key/vim/index.js +++ b/client/key/vim/index.js @@ -29,8 +29,9 @@ const getOperations = (event, deps) => { setCurrentFile, setCurrentByName, getCurrentName, + toggleSelectedFile, - Buffer = {}, + Buffer = {}, } = deps; return { diff --git a/client/modules/operation/index.js b/client/modules/operation/index.js index bf19bda8..8105e85f 100644 --- a/client/modules/operation/index.js +++ b/client/modules/operation/index.js @@ -59,19 +59,19 @@ module.exports.init = promisify((callback) => { exec.series([ DOM.loadSocket, async (callback) => { - if (config('dropbox')) - return callback(); - - const {prefix, prefixSocket} = CloudCmd; - - await loadAll(); - await initOperations(prefix, prefixSocket, callback); - }, + if (config('dropbox')) + return callback(); + + const {prefix, prefixSocket} = CloudCmd; + + await loadAll(); + await initOperations(prefix, prefixSocket, callback); + }, (callback) => { - Loaded = true; - Images.hide(); - callback(); - }, + Loaded = true; + Images.hide(); + callback(); + }, ], callback); }); diff --git a/common/base64.spec.js b/common/base64.spec.js index bc3ea2f5..cc096ee2 100644 --- a/common/base64.spec.js +++ b/common/base64.spec.js @@ -6,16 +6,16 @@ const {btoa, atob} = require('./base64'); test('btoa: browser', (t) => { const btoaOriginal = global.btoa; + const btoaStub = stub(); const str = 'hello'; - global.btoa = stub(); + global.btoa = btoaStub; btoa(str); - - t.calledWith(global.btoa, [str], 'should call global.btoa'); - t.end(); - global.btoa = btoaOriginal; + + t.calledWith(btoaStub, [str], 'should call global.btoa'); + t.end(); }); test('btoa: node', (t) => { @@ -30,16 +30,18 @@ test('btoa: node', (t) => { test('atob: browser', (t) => { const atobOriginal = global.atob; + const atobStub = stub(); + const str = 'hello'; - global.atob = stub(); + global.atob = atobStub; atob(str); - t.calledWith(global.atob, [str], 'should call global.btoa'); - t.end(); - global.atob = atobOriginal; + + t.calledWith(atobStub, [str], 'should call global.btoa'); + t.end(); }); test('atob: node', (t) => { diff --git a/server/markdown/index.js b/server/markdown/index.js index bf8fa455..639e219d 100644 --- a/server/markdown/index.js +++ b/server/markdown/index.js @@ -1,6 +1,5 @@ 'use strict'; -const {join} = require('node:path'); const {callbackify} = require('node:util'); const pullout = require('pullout'); @@ -8,8 +7,9 @@ const ponse = require('ponse'); const {read} = require('redzip'); const root = require('../root'); -const isString = (a) => typeof a === 'string'; + const parse = require('./worker'); +const isString = (a) => typeof a === 'string'; // warm up parse(''); diff --git a/server/user-menu.mjs b/server/user-menu.mjs index c7d85855..5ae51536 100644 --- a/server/user-menu.mjs +++ b/server/user-menu.mjs @@ -1,4 +1,3 @@ -import {createRequire} from 'node:module'; import {homedir} from 'node:os'; import {readFile as _readFile} from 'node:fs/promises'; import {join} from 'node:path'; @@ -7,8 +6,6 @@ import tryToCatch from 'try-to-catch'; import currify from 'currify'; import {putout, codeframe} from 'putout'; -const require = createRequire(import.meta.url); - // warm up worker cache transpile('');