Skip to content

Commit 207c06c

Browse files
lint++
1 parent d89e9f9 commit 207c06c

3 files changed

Lines changed: 51 additions & 51 deletions

File tree

extensions/cli-ext-insight-journal/ReadlineTransform.js

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,64 +10,64 @@ import { Transform } from 'stream';
1010
* @param {Boolean} opts.skipEmpty - if line is empty string, skip it (default: false)
1111
*/
1212
class ReadlineTransform extends Transform {
13-
constructor(options) {
14-
const opts = options || {};
15-
opts.objectMode = true;
16-
super(opts);
17-
this._brRe = opts.breakMatcher || /\r?\n/;
18-
this._ignoreEndOfBreak = 'ignoreEndOfBreak' in opts ? Boolean(opts.ignoreEndOfBreak) : true;
19-
this._skipEmpty = Boolean(opts.skipEmpty);
20-
this._buf = null;
21-
}
22-
23-
_transform(chunk, encoding, cb) {
24-
let str;
25-
if (Buffer.isBuffer(chunk) || encoding === 'buffer') {
26-
str = chunk.toString('utf8');
27-
} else {
28-
str = chunk;
13+
constructor(options) {
14+
const opts = options || {};
15+
opts.objectMode = true;
16+
super(opts);
17+
this._brRe = opts.breakMatcher || /\r?\n/;
18+
this._ignoreEndOfBreak = 'ignoreEndOfBreak' in opts ? Boolean(opts.ignoreEndOfBreak) : true;
19+
this._skipEmpty = Boolean(opts.skipEmpty);
20+
this._buf = null;
2921
}
3022

31-
try {
32-
if (this._buf !== null) {
33-
this._buf += str;
34-
} else {
35-
this._buf = str;
36-
}
23+
_transform(chunk, encoding, cb) {
24+
let str;
25+
if (Buffer.isBuffer(chunk) || encoding === 'buffer') {
26+
str = chunk.toString('utf8');
27+
} else {
28+
str = chunk;
29+
}
3730

38-
const lines = this._buf.split(this._brRe);
39-
const lastIndex = lines.length - 1;
40-
for (let i = 0; i < lastIndex; i++) {
41-
this._writeItem(lines[i]);
42-
}
31+
try {
32+
if (this._buf !== null) {
33+
this._buf += str;
34+
} else {
35+
this._buf = str;
36+
}
4337

44-
const lastLine = lines[lastIndex];
45-
if (lastLine.length) {
46-
this._buf = lastLine;
47-
} else if (!this._ignoreEndOfBreak) {
48-
this._buf = '';
49-
} else {
50-
this._buf = null;
51-
}
52-
cb();
53-
} catch(err) {
54-
cb(err); // invalid data type;
38+
const lines = this._buf.split(this._brRe);
39+
const lastIndex = lines.length - 1;
40+
for (let i = 0; i < lastIndex; i++) {
41+
this._writeItem(lines[i]);
42+
}
43+
44+
const lastLine = lines[lastIndex];
45+
if (lastLine.length) {
46+
this._buf = lastLine;
47+
} else if (!this._ignoreEndOfBreak) {
48+
this._buf = '';
49+
} else {
50+
this._buf = null;
51+
}
52+
return cb();
53+
} catch (err) {
54+
return cb(err); // invalid data type;
55+
}
5556
}
56-
}
5757

58-
_flush(cb) {
59-
if (this._buf !== null) {
60-
this._writeItem(this._buf);
61-
this._buf = null;
58+
_flush(cb) {
59+
if (this._buf !== null) {
60+
this._writeItem(this._buf);
61+
this._buf = null;
62+
}
63+
cb();
6264
}
63-
cb();
64-
}
6565

66-
_writeItem(line) {
67-
if (line.length > 0 || !this._skipEmpty) {
68-
this.push(line);
66+
_writeItem(line) {
67+
if (line.length > 0 || !this._skipEmpty) {
68+
this.push(line);
69+
}
6970
}
70-
}
7171
}
7272

7373
export default ReadlineTransform;

extensions/cli-ext-insight-journal/logger.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export default new Command({
4444
},
4545
}))
4646
;
47-
47+
4848
const response = await opts.http.post(`https://${log.fqdn}/log`, {
4949
body: inStream,
5050
headers: { authorization: `Bearer ${token}` },

extensions/cli-ext-insight-journal/stream.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default new Command({
2929
? process.stdout
3030
: fs.createWriteStream(optsAll['log-file-output'])
3131
;
32-
32+
3333
const logResp = await opts.api
3434
.get(openapi.getUrl(`/insight/pl-waw-1/project/${optsAll.project}/journal/${optsAll.journal}`));
3535
const log = logResp.bodyJson;

0 commit comments

Comments
 (0)