mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-22 18:29:26 +00:00
chore: lint
This commit is contained in:
parent
13279299c4
commit
24dcf78be8
16 changed files with 25 additions and 26 deletions
2
.github/workflows/nodejs.yml
vendored
2
.github/workflows/nodejs.yml
vendored
|
|
@ -39,6 +39,7 @@ jobs:
|
|||
run: typos --write-changes
|
||||
- name: Commit fixes
|
||||
uses: EndBug/add-and-commit@v9
|
||||
continue-on-error: true
|
||||
with:
|
||||
message: "chore: ${{ env.NAME }}: actions: lint ☘️"
|
||||
- name: Build
|
||||
|
|
@ -49,5 +50,6 @@ jobs:
|
|||
run: redrun coverage coverage:report
|
||||
- name: Coveralls
|
||||
uses: coverallsapp/github-action@v2
|
||||
continue-on-error: true
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ const simport = createSimport(import.meta.url);
|
|||
const choose = (a, b) => {
|
||||
if (a === undefined)
|
||||
return b;
|
||||
|
||||
|
||||
return a;
|
||||
};
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ const DIR_SERVER = '../server/';
|
|||
const maybeRoot = (a) => {
|
||||
if (a === '.')
|
||||
return process.cwd();
|
||||
|
||||
|
||||
return a;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,6 @@ async function cl() {
|
|||
function getVersionNew(last, match) {
|
||||
if (match)
|
||||
return minor(match, Info.version);
|
||||
|
||||
|
||||
return last.substr(3);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
/* global CloudCmd */
|
||||
const Util = require('../../common/util');
|
||||
|
||||
|
|
@ -38,8 +37,9 @@ DOM.Events = require('./events');
|
|||
|
||||
const loadRemote = require('./load-remote');
|
||||
const selectByPattern = require('./select-by-pattern');
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const SELECTED_FILE = 'selected-file';
|
||||
|
||||
const TabPanel = {
|
||||
'js-left': null,
|
||||
'js-right': null,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const isFn = (a) => typeof a === 'function';
|
||||
const montag = require('montag');
|
||||
|
||||
const {promisify} = require('es6-promisify');
|
||||
|
|
@ -12,6 +11,7 @@ const load = require('load.js');
|
|||
const {MAX_FILE_SIZE: maxSize} = require('../../common/cloudfunc');
|
||||
|
||||
const {time, timeEnd} = require('../../common/util');
|
||||
const isFn = (a) => typeof a === 'function';
|
||||
const loadJS = load.js;
|
||||
|
||||
const Name = 'Edit';
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
require('../../../css/view.css');
|
||||
|
||||
const rendy = require('rendy');
|
||||
|
|
@ -28,7 +27,7 @@ const Events = require('../../dom/events');
|
|||
const Images = require('../../dom/images');
|
||||
|
||||
const {encode} = require('../../../common/entity');
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const {assign} = Object;
|
||||
const {isArray} = Array;
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
module.exports.btoa = (str) => {
|
||||
if (typeof btoa === 'function')
|
||||
return btoa(str);
|
||||
|
||||
|
||||
return Buffer
|
||||
.from(str)
|
||||
.toString('base64');
|
||||
|
|
@ -12,7 +12,7 @@ module.exports.btoa = (str) => {
|
|||
module.exports.atob = (str) => {
|
||||
if (typeof atob === 'function')
|
||||
return atob(str);
|
||||
|
||||
|
||||
return Buffer
|
||||
.from(str, 'base64')
|
||||
.toString('binary');
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ function updateField(file) {
|
|||
function getAttribute(type) {
|
||||
if (type === 'directory')
|
||||
return '';
|
||||
|
||||
|
||||
return 'target="_blank" ';
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ module.exports = (date) => {
|
|||
const addZero = (a) => {
|
||||
if (a > 9)
|
||||
return a;
|
||||
|
||||
|
||||
return `0${a}`;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
const exec = require('execon');
|
||||
const isString = (a) => typeof a === 'string';
|
||||
|
||||
module.exports.escapeRegExp = (str) => {
|
||||
const isStr = typeof str === 'string';
|
||||
const isStr = isString(str);
|
||||
|
||||
if (isStr)
|
||||
str = str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
|
||||
|
|
@ -33,7 +34,7 @@ module.exports.exec = exec;
|
|||
* @return ext
|
||||
*/
|
||||
module.exports.getExt = (name) => {
|
||||
const isStr = typeof name === 'string';
|
||||
const isStr = isString(name);
|
||||
|
||||
if (!isStr)
|
||||
return '';
|
||||
|
|
@ -58,7 +59,7 @@ module.exports.findObjByNameInArr = (array, name) => {
|
|||
if (!Array.isArray(array))
|
||||
throw Error('array should be array!');
|
||||
|
||||
if (typeof name !== 'string')
|
||||
if (!isString(name))
|
||||
throw Error('name should be string!');
|
||||
|
||||
array.some((item) => {
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ module.exports._getPrefix = getPrefix;
|
|||
function getPrefix(prefix) {
|
||||
if (isFn(prefix))
|
||||
return prefix() || '';
|
||||
|
||||
|
||||
return prefix || '';
|
||||
}
|
||||
|
||||
|
|
@ -258,7 +258,7 @@ module.exports._replaceDist = replaceDist;
|
|||
function replaceDist(url) {
|
||||
if (!isDev)
|
||||
return url;
|
||||
|
||||
|
||||
return url.replace(/^\/dist\//, '/dist-dev/');
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ const manageListen = currify((manage, socket, auth) => {
|
|||
function initWrite(filename, configManager) {
|
||||
if (filename)
|
||||
return write.bind(null, filename, configManager);
|
||||
|
||||
|
||||
return resolve;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const {join} = require('path');
|
||||
const {callbackify} = require('util');
|
||||
|
||||
|
|
@ -10,7 +9,7 @@ const threadIt = require('thread-it');
|
|||
const {read} = require('redzip');
|
||||
|
||||
const root = require('../root');
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const parse = threadIt(join(__dirname, 'worker'));
|
||||
|
||||
threadIt.init();
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
'use strict';
|
||||
|
||||
const isFn = (a) => typeof a === 'function';
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const DIR = '../';
|
||||
const DIR_COMMON = `${DIR}../common/`;
|
||||
|
||||
|
|
@ -24,7 +22,8 @@ const ponse = require('ponse');
|
|||
|
||||
const copymitter = require('copymitter');
|
||||
const moveFiles = require('@cloudcmd/move-files');
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const isFn = (a) => typeof a === 'function';
|
||||
const swap = wraptile((fn, a, b) => fn(b, a));
|
||||
const isWin32 = process.platform === 'win32';
|
||||
const {apiURL} = CloudFunc;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
'use strict';
|
||||
|
||||
const isString = (a) => typeof a === 'string';
|
||||
const tryCatch = require('try-catch');
|
||||
|
||||
const exit = require('./exit');
|
||||
const columns = require('./columns');
|
||||
const isString = (a) => typeof a === 'string';
|
||||
|
||||
module.exports.root = (dir, config) => {
|
||||
if (!isString(dir))
|
||||
|
|
|
|||
|
|
@ -131,9 +131,8 @@ async function createDefaultMenu({path, data, DOM, CloudCmd}) {
|
|||
|
||||
async function readDefaultMenu({prefix}) {
|
||||
const res = await fetch(`${prefix}/api/v1/user-menu/default`);
|
||||
const data = await res.text();
|
||||
|
||||
return data;
|
||||
return await res.text();
|
||||
}
|
||||
|
||||
module.exports._selectNames = selectNames;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue