From 610ba8827f9f1a2bf1761df3f90af9fe93b45d63 Mon Sep 17 00:00:00 2001 From: coderaiser Date: Mon, 6 May 2024 14:48:47 +0300 Subject: [PATCH] chore: lint --- .github/workflows/docker.yml | 6 ++---- client/client.js | 15 ++++++++------- client/dom/current-file.spec.js | 20 +++++++++++--------- server/terminal.js | 6 +++++- server/validate.mjs | 19 ++++++++++++++++--- 5 files changed, 42 insertions(+), 24 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d0f8c6eb23..f26b37556b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,11 +27,9 @@ jobs: run: redrun lint - name: Build id: build - run: > + run: | redrun build - - echo "::set-output name=version::$(grep '"version":' package.json -m1 - | cut -d\" -f4)" + echo "::set-output name=version::$(grep '"version":' package.json -m1 | cut -d\" -f4)" - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx diff --git a/client/client.js b/client/client.js index 58f4ae8355..d1bdbcffff 100644 --- a/client/client.js +++ b/client/client.js @@ -74,13 +74,14 @@ function CloudCmdProto(DOM) { right: 'asc', }; - this.changeDir = async (path, { - isRefresh, - panel, - history = true, - noCurrent, - currentName, - } = {}) => { + this.changeDir = async (path, overrides = {}) => { + const { + isRefresh, + panel, + history = true, + noCurrent, + currentName, + } = overrides; const refresh = isRefresh; let panelChanged; diff --git a/client/dom/current-file.spec.js b/client/dom/current-file.spec.js index 3c907fcded..3d822206f7 100644 --- a/client/dom/current-file.spec.js +++ b/client/dom/current-file.spec.js @@ -285,15 +285,17 @@ test('current-file: parseHrefAttribute', (t) => { t.end(); }); -function getDOM({ - link = {}, - getCurrentDirPath = stub(), - getCurrentDirName = stub(), - getByDataName = stub(), - isContainClass = stub(), - getCurrentType = stub(), - getCurrentPath = stub(), -} = {}) { +function getDOM(overrides = {}) { + const { + link = {}, + getCurrentDirPath = stub(), + getCurrentDirName = stub(), + getByDataName = stub(), + isContainClass = stub(), + getCurrentType = stub(), + getCurrentPath = stub(), + } = overrides; + return { getCurrentDirPath, getCurrentDirName, diff --git a/server/terminal.js b/server/terminal.js index 7a291b31f8..d10cdc8b03 100644 --- a/server/terminal.js +++ b/server/terminal.js @@ -12,7 +12,11 @@ function _getModule(a) { return require(a); } -module.exports = (config, arg, {getModule = _getModule} = {}) => { +module.exports = (config, arg, overrides = {}) => { + const { + getModule = _getModule, + } = overrides; + if (!config('terminal')) return noop; diff --git a/server/validate.mjs b/server/validate.mjs index bf825e8540..6b928e7bea 100644 --- a/server/validate.mjs +++ b/server/validate.mjs @@ -6,7 +6,12 @@ import {getThemes as _getThemes} from './theme.mjs'; const isString = (a) => typeof a === 'string'; -export const root = (dir, config, {exit = _exit, statSync = _statSync} = {}) => { +export const root = (dir, config, overrides = {}) => { + const { + exit = _exit, + statSync = _statSync, + } = overrides; + if (!isString(dir)) throw Error('dir should be a string'); @@ -36,7 +41,11 @@ export const packer = (name, {exit = _exit} = {}) => { exit('cloudcmd --packer: could be "tar" or "zip" only'); }; -export const columns = (type, {exit = _exit, getColumns = _getColumns} = {}) => { +export const columns = (type, overrides = {}) => { + const { + exit = _exit, + getColumns = _getColumns, + } = overrides; const addQuotes = (a) => `"${a}"`; const all = Object .keys(getColumns()) @@ -51,7 +60,11 @@ export const columns = (type, {exit = _exit, getColumns = _getColumns} = {}) => exit(`cloudcmd --columns: can be only one of: ${names}`); }; -export const theme = (type, {exit = _exit, getThemes = _getThemes} = {}) => { +export const theme = (type, overrides = {}) => { + const { + exit = _exit, + getThemes = _getThemes, + } = overrides; const addQuotes = (a) => `"${a}"`; const all = Object .keys(getThemes())