Skip to content

Commit 13256dc

Browse files
committed
chore: lint
1 parent 802a546 commit 13256dc

File tree

19 files changed

+96
-43
lines changed

19 files changed

+96
-43
lines changed

.eslintrc.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"classPrivateMethods": true
1111
},
1212
"rules": {
13-
"node/no-unsupported-features/es-syntax": "off",
1413
"node/no-unsupported-features/node-builtins": "off"
1514
},
1615
"overrides": [{
@@ -20,12 +19,12 @@
2019
}
2120
}],
2221
"extends": [
23-
"plugin:node/recommended",
22+
"plugin:n/recommended",
2423
"plugin:putout/recommended"
2524
],
2625
"plugins": [
2726
"putout",
2827
"babel",
29-
"node"
28+
"n"
3029
]
3130
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ dist-dev
1111
server_
1212
*.swp
1313

14+
.idea

.madrun.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export default {
1313
'build:client': () => run('build-progress', '--mode production'),
1414
'build:client:dev': async () => `NODE_ENV=development ${await run('build-progress', '--mode development')}`,
1515
'watcher': () => 'nodemon -w client -w server -w test --exec',
16-
'watch:test': () => run('watcher', '\'npm test\''),
17-
'watch:coverage': () => run('watcher', '\'npm run coverage\''),
18-
'watch:lint': () => run('watcher', '\'npm run lint\''),
16+
'watch:test': async () => await run('watcher', `'npm test'`),
17+
'watch:coverage': async () => await run('watcher', `'npm run coverage'`),
18+
'watch:lint': async () => await run('watcher', `'npm run lint'`),
1919
'watch:client': () => run('build:client', '--watch'),
2020
'watch:client:dev': () => run('build:client:dev', '--watch'),
2121
'wisdom': () => run('build'),

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Fileop [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
1+
# Fileop [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
22

33
File operations emitter middleware.
44

@@ -97,8 +97,8 @@ app.use(fileop({
9797
}));
9898

9999
fileop.listen(socket, {
100-
prefix: '/fileop', /* default */
101-
root: '/', /* string or a function */
100+
prefix: '/fileop', /* default */
101+
root: '/', /* string or a function */
102102
auth: (accept, reject) => (username, password) => {
103103
if (username === 'root' && password === 'toor')
104104
accept();
@@ -121,10 +121,8 @@ MIT
121121
- [Salam](https://github.com/coderaiser/node-salam "Salam") - pack and extract zip archives middleware
122122

123123
[NPMIMGURL]: https://img.shields.io/npm/v/@cloudcmd/fileop.svg?style=flat
124-
[DependencyStatusIMGURL]: https://img.shields.io/david/cloudcmd/node-fileop.svg?style=flat
125124
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
126125
[BuildStatusIMGURL]: https://img.shields.io/travis/cloudcmd/node-fileop/master.svg?style=flat
127126
[NPMURL]: https://npmjs.org/package/@cloudcmd/fileop "npm"
128-
[DependencyStatusURL]: https://david-dm.org/cloudcmd/node-fileop "Dependency Status"
129127
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"
130128
[BuildStatusURL]: https://travis-ci.org/cloudcmd/node-fileop "Build Status"

client/operator.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ class FileOperator extends Emitify {
2525

2626
#onError = (error) => {
2727
this.emit('error', error);
28-
}
28+
};
2929

3030
#onFile = (name) => {
3131
this.emit('file', name);
32-
}
32+
};
3333

3434
#onProgress = (percent) => {
3535
this.emit('progress', percent);
36-
}
36+
};
3737

3838
#onEnd = () => {
3939
const {id, socket} = this;
@@ -44,7 +44,7 @@ class FileOperator extends Emitify {
4444
socket.off(`${id}#end`, this.#onEnd);
4545

4646
this.emit('end');
47-
}
47+
};
4848

4949
pause() {
5050
const {id, socket} = this;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"name": "@cloudcmd/fileop",
33
"version": "5.0.4",
4+
"type": "commonjs",
45
"description": "file operations emitter middleware",
56
"main": "server/index.js",
67
"commitType": "colon",

server/get-value.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
'use strict';
22

33
const isFn = (a) => typeof a === 'function';
4-
const getValue = (a) => isFn(a) ? a() : a;
54

6-
module.exports = getValue;
5+
module.exports = (a) => isFn(a) ? a() : a;
76

server/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use strict';
22

3-
const DIR_ROOT = __dirname + '/..';
43
const path = require('path');
5-
64
const currify = require('currify');
7-
const {Router} = require('express');
85

6+
const {Router} = require('express');
97
const listen = require('./listen');
108

9+
const DIR_ROOT = __dirname + '/..';
10+
1111
const fileopFn = currify(_fileopFn);
1212
const isDev = process.env.NODE_ENV === 'development';
1313

server/listen.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ const fullstore = require('fullstore');
66

77
const operate = require('./operate');
88
const extract = require('./extract');
9-
const pack = currify(require('./pack'));
109
const getValue = require('./get-value');
10+
const pack = currify(require('./pack'));
1111

1212
const connectionWraped = wraptile(connection);
1313
const wrongOperation = currify(_wrongOperation);

test/client/fileop.js

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ test('client: copy: error', async (t) => {
5656
after();
5757
destroy();
5858

59-
t.equal(e, 'ENOENT: /hello/abc', 'should equal');
59+
t.equal(e, 'ENOENT: /hello/abc');
6060
t.end();
6161
});
6262

@@ -83,7 +83,7 @@ test('client: move: error', async (t) => {
8383
after();
8484
destroy();
8585

86-
t.equal(e, 'ENOENT: /hello/abc', 'should equal');
86+
t.equal(e, 'ENOENT: /hello/abc');
8787
t.end();
8888
});
8989

@@ -104,10 +104,12 @@ test('client: remove: error', async (t) => {
104104
const op = await operator.remove(from, files);
105105
const destroy = getDestroy(op);
106106
const [e] = await once(op, 'error');
107+
107108
done();
108109
after();
109110
destroy();
110-
t.equal(e, 'ENOENT: /hello/abc', 'should equal');
111+
112+
t.equal(e, 'ENOENT: /hello/abc');
111113
t.end();
112114
});
113115

@@ -129,10 +131,12 @@ test('client: tar: error', async (t) => {
129131
const op = await operator.tar(from, to, files);
130132
const destroy = getDestroy(op);
131133
const [e] = await once(op, 'error');
134+
132135
done();
133136
after();
134137
destroy();
135-
t.equal(e, 'ENOENT: /hello/abc', 'should equal');
138+
139+
t.equal(e, 'ENOENT: /hello/abc');
136140
t.end();
137141
});
138142

@@ -154,10 +158,12 @@ test('client: zip: error', async (t) => {
154158
const op = await operator.zip(from, to, files);
155159
const destroy = getDestroy(op);
156160
const [e] = await once(op, 'error');
161+
157162
destroy();
158163
done();
159164
after();
160-
t.equal(e, 'ENOENT: /hello/abc', 'should equal');
165+
166+
t.equal(e, 'ENOENT: /hello/abc');
161167
t.end();
162168
});
163169

@@ -178,11 +184,13 @@ test('client: extract: error', async (t) => {
178184
const op = await operator.extract(from, to);
179185
const destroy = getDestroy(op);
180186
const [e] = await once(op, 'error');
187+
181188
done();
182189
after();
183190
destroy();
184191
const expected = 'Not supported archive type: ""';
185-
t.equal(e, expected, 'should equal');
192+
193+
t.equal(e, expected);
186194
t.end();
187195
});
188196

@@ -206,11 +214,13 @@ test('client: dynamic load socket.io', async (t) => {
206214
const op = await operator.extract(from, to);
207215
const destroy = getDestroy(op);
208216
const [e] = await once(op, 'error');
217+
209218
done();
210219
after();
211220
destroy();
212221
const expected = 'Not supported archive type: ""';
213-
t.equal(e, expected, 'should equal');
222+
223+
t.equal(e, expected);
214224
t.end();
215225
});
216226

@@ -231,11 +241,13 @@ test('client: get-host: no origin', async (t) => {
231241
const op = await operator.extract(from, to);
232242
const destroy = getDestroy(op);
233243
const [e] = await once(op, 'error');
244+
234245
done();
235246
after();
236247
destroy();
237248
const expected = 'Not supported archive type: ""';
238-
t.equal(e, expected, 'should equal');
249+
250+
t.equal(e, expected);
239251
t.end();
240252
});
241253

@@ -270,7 +282,7 @@ test('client: disconnect', async (t) => {
270282
after();
271283
done();
272284

273-
t.equal(e, 'ENOENT: /hello/abc', 'should equal');
285+
t.equal(e, 'ENOENT: /hello/abc');
274286
t.pass('should disconnect');
275287
t.end();
276288
});
@@ -291,11 +303,13 @@ test('client: auth: reject', async (t) => {
291303

292304
const operator = await fileop();
293305
const destroy = getDestroy(operator);
306+
294307
operator.emit('auth');
295308
await once(operator, 'reject');
296309
after();
297310
done();
298311
destroy();
312+
299313
t.pass('shoud reject');
300314
t.end();
301315
});
@@ -327,6 +341,7 @@ test('client: options', async (t) => {
327341
after();
328342
done();
329343
destroy();
344+
330345
t.pass('shoud accept');
331346
t.end();
332347
});

0 commit comments

Comments
 (0)