Skip to content

Commit

Permalink
[eslint] enable brace-style
Browse files Browse the repository at this point in the history
  • Loading branch information
ljharb committed Jul 26, 2021
1 parent a08dc34 commit 06eba07
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Expand Up @@ -8,6 +8,9 @@
"Promise": false,
},
"rules": {
"brace-style": ["error", "1tbs", {
"allowSingleLine": true,
}],
"comma-dangle": ["error", "never"],
"comma-spacing": [2, {
"before": false,
Expand Down
21 changes: 15 additions & 6 deletions lib/default_stream.js
Expand Up @@ -13,18 +13,27 @@ module.exports = function () {
var c = typeof buf === 'string'
? buf.charAt(i)
: String.fromCharCode(buf[i]);
if (c === '\n') { flush(); }
else { line += c; }
if (c === '\n') {
flush();
} else {
line += c;
}
}
}

function flush() {
if (fs.writeSync && (/^win/).test(process.platform)) {
try { fs.writeSync(1, line + '\n'); }
catch (e) { stream.emit('error', e); }
try {
fs.writeSync(1, line + '\n');
} catch (e) {
stream.emit('error', e);
}
} else {
try { console.log(line); }
catch (e) { stream.emit('error', e); }
try {
console.log(line);
} catch (e) {
stream.emit('error', e);
}
}
line = '';
}
Expand Down
3 changes: 1 addition & 2 deletions test/double_end.js
Expand Up @@ -29,8 +29,7 @@ test(function (tt) {
var atExpected;
try {
to._onTimeout();
}
catch (e) {
} catch (e) {
stackExpected = stripFullStack(e.stack)[1];
stackExpected = stackExpected.replace('double_end.js', 'double_end/double.js');
stackExpected = stackExpected.trim();
Expand Down

0 comments on commit 06eba07

Please sign in to comment.