Skip to content

Commit ddd1722

Browse files
committed
chore: lint
1 parent 907afc6 commit ddd1722

File tree

7 files changed

+24
-31
lines changed

7 files changed

+24
-31
lines changed

bin/cloudcmd.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ process.on('unhandledRejection', exit);
1717
const require = createRequire(import.meta.url);
1818

1919
const Info = require('../package.json');
20-
20+
const isUndefined = (a) => typeof a === 'undefined';
2121
const simport = createSimport(import.meta.url);
2222

2323
const choose = (a, b) => {
24-
if (a === undefined)
24+
if (isUndefined(a))
2525
return b;
2626

2727
return a;

common/cloudfunc.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -248,14 +248,12 @@ module.exports.buildFromJSON = (params) => {
248248
return fileTable;
249249
};
250250

251-
function updateField(file) {
252-
return {
253-
...file,
254-
date: file.date || '--.--.----',
255-
owner: file.owner || 'root',
256-
size: getSize(file),
257-
};
258-
}
251+
const updateField = (file) => ({
252+
...file,
253+
date: file.date || '--.--.----',
254+
owner: file.owner || 'root',
255+
size: getSize(file),
256+
});
259257

260258
function getAttribute(type) {
261259
if (type === 'directory')

css/supports.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@supports (overflow: overlay) {
22
.files {
3-
overflow-y: overlay;
3+
overflow-y: auto;
44
}
55

66
.fm-header {

server/config.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const criton = require('criton');
2222
const exit = require(`${DIR_SERVER}exit`);
2323

2424
const CloudFunc = require(`${DIR_COMMON}cloudfunc`);
25-
25+
const isUndefined = (a) => typeof a === 'undefined';
2626
const DIR = `${DIR_SERVER}../`;
2727
const HOME = homedir();
2828

@@ -31,7 +31,9 @@ const formatMsg = currify((a, b) => CloudFunc.formatMsg(a, b));
3131

3232
const {apiURL} = CloudFunc;
3333

34-
const key = (a) => Object.keys(a).pop();
34+
const key = (a) => Object
35+
.keys(a)
36+
.pop();
3537

3638
const ConfigPath = path.join(DIR, 'json/config.json');
3739
const ConfigHome = path.join(HOME, '.cloudcmd.json');
@@ -90,7 +92,7 @@ function createConfig({configPath} = {}) {
9092
if (key === '*')
9193
return config;
9294

93-
if (value === undefined)
95+
if (isUndefined(value))
9496
return config[key];
9597

9698
config[key] = value;

server/rest/index.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const root = require(`../root`);
2121
const CloudFunc = require(`../../common/cloudfunc`);
2222
const markdown = require(`../markdown/index.js`);
2323
const info = require('./info');
24-
24+
const isUndefined = (a) => typeof a === 'undefined';
25+
const isRootAll = (root, names) => names.some(isRootWin32(root));
2526
const isString = (a) => typeof a === 'string';
2627
const isFn = (a) => typeof a === 'function';
2728
const swap = wraptile((fn, a, b) => fn(b, a));
@@ -66,7 +67,7 @@ function rest({fs, config, moveFiles}, request, response) {
6667
if (options.name)
6768
params.name = options.name;
6869

69-
if (options.gzip !== undefined)
70+
if (!isUndefined(options.gzip))
7071
params.gzip = options.gzip;
7172

7273
if (options.query)
@@ -370,10 +371,6 @@ const isRootWin32 = currify((root, path) => {
370371
module.exports._isRootWin32 = isRootWin32;
371372
module.exports._isRootAll = isRootAll;
372373

373-
function isRootAll(root, names) {
374-
return names.some(isRootWin32(root));
375-
}
376-
377374
module.exports._getWin32RootMsg = getWin32RootMsg;
378375

379376
function getWin32RootMsg() {

server/terminal.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ const noop = (req, res, next) => {
88

99
noop.listen = noop;
1010

11-
function _getModule(a) {
12-
return require(a);
13-
}
11+
const _getModule = (a) => require(a);
1412

1513
module.exports = (config, arg, overrides = {}) => {
1614
const {

static/user-menu.spec.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,11 +337,9 @@ function getDOM() {
337337
};
338338
}
339339

340-
function getCloudCmd() {
341-
return {
342-
refresh: stub(),
343-
EditFile: {
344-
show: stub(),
345-
},
346-
};
347-
}
340+
const getCloudCmd = () => ({
341+
refresh: stub(),
342+
EditFile: {
343+
show: stub(),
344+
},
345+
});

0 commit comments

Comments
 (0)