Skip to content

Commit 06eba07

Browse files
committed
[eslint] enable brace-style
1 parent a08dc34 commit 06eba07

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

.eslintrc

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
"Promise": false,
99
},
1010
"rules": {
11+
"brace-style": ["error", "1tbs", {
12+
"allowSingleLine": true,
13+
}],
1114
"comma-dangle": ["error", "never"],
1215
"comma-spacing": [2, {
1316
"before": false,

lib/default_stream.js

+15-6
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,27 @@ module.exports = function () {
1313
var c = typeof buf === 'string'
1414
? buf.charAt(i)
1515
: String.fromCharCode(buf[i]);
16-
if (c === '\n') { flush(); }
17-
else { line += c; }
16+
if (c === '\n') {
17+
flush();
18+
} else {
19+
line += c;
20+
}
1821
}
1922
}
2023

2124
function flush() {
2225
if (fs.writeSync && (/^win/).test(process.platform)) {
23-
try { fs.writeSync(1, line + '\n'); }
24-
catch (e) { stream.emit('error', e); }
26+
try {
27+
fs.writeSync(1, line + '\n');
28+
} catch (e) {
29+
stream.emit('error', e);
30+
}
2531
} else {
26-
try { console.log(line); }
27-
catch (e) { stream.emit('error', e); }
32+
try {
33+
console.log(line);
34+
} catch (e) {
35+
stream.emit('error', e);
36+
}
2837
}
2938
line = '';
3039
}

test/double_end.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ test(function (tt) {
2929
var atExpected;
3030
try {
3131
to._onTimeout();
32-
}
33-
catch (e) {
32+
} catch (e) {
3433
stackExpected = stripFullStack(e.stack)[1];
3534
stackExpected = stackExpected.replace('double_end.js', 'double_end/double.js');
3635
stackExpected = stackExpected.trim();

0 commit comments

Comments
 (0)