GeezerVison is showing github.com — tools: enable no-else-return lint rule · nodejs/node@9119344
File treeExpand file treeCollapse file tree Open diff view settings addons/stringbytes-external-exceed-max
Some content is hiddenLarge Commits have some content hidden by default. Use the searchbox below for content that may be hidden. Dismiss bannerExpand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .eslintrc.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -129,6 +129,7 @@ module.exports = { | 129 | 129 | 'no-dupe-else-if': 'error', | 130 | 130 | 'no-duplicate-case': 'error', | 131 | 131 | 'no-duplicate-imports': 'error', | | 132 | + 'no-else-return': ['error', { allowElseIf: true }], | 132 | 133 | 'no-empty-character-class': 'error', | 133 | 134 | 'no-ex-assign': 'error', | 134 | 135 | 'no-extra-boolean-cast': 'error', | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/es/spread-bench.js +3-4Lines changed: 3 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -16,11 +16,10 @@ function makeTest(count, rest) { | 16 | 16 | return function test(...args) { | 17 | 17 | assert.strictEqual(count, args.length); | 18 | 18 | }; | 19 | | - } else { | 20 | | - return function test() { | 21 | | - assert.strictEqual(count, arguments.length); | 22 | | - }; | 23 | 19 | } | | 20 | + return function test() { | | 21 | + assert.strictEqual(count, arguments.length); | | 22 | + }; | 24 | 23 | } | 25 | 24 |
| 26 | 25 | function main({ n, context, count, rest, method }) { | |
Collapse file Copy file name to clipboardExpand all lines: benchmark/scatter.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -30,9 +30,8 @@ let printHeader = true; | 30 | 30 | function csvEncodeValue(value) { | 31 | 31 | if (typeof value === 'number') { | 32 | 32 | return value.toString(); | 33 | | - } else { | 34 | | - return `"${value.replace(/"/g, '""')}"`; | 35 | 33 | } | | 34 | + return `"${value.replace(/"/g, '""')}"`; | 36 | 35 | } | 37 | 36 |
| 38 | 37 | (function recursive(i) { | |
Collapse file Copy file name to clipboardExpand all lines: lib/_http_incoming.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -248,9 +248,8 @@ function matchKnownFields(field, lowercased) { | 248 | 248 | } | 249 | 249 | if (lowercased) { | 250 | 250 | return '\u0000' + field; | 251 | | - } else { | 252 | | - return matchKnownFields(field.toLowerCase(), true); | 253 | 251 | } | | 252 | + return matchKnownFields(field.toLowerCase(), true); | 254 | 253 | } | 255 | 254 | // Add the given (field, value) pair to the message | 256 | 255 | // | |
Collapse file Copy file name to clipboardExpand all lines: lib/_stream_readable.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -372,8 +372,7 @@ function howMuchToRead(n, state) { | 372 | 372 | // Only flow one buffer at a time. | 373 | 373 | if (state.flowing && state.length) | 374 | 374 | return state.buffer.first().length; | 375 | | - else | 376 | | - return state.length; | | 375 | + return state.length; | 377 | 376 | } | 378 | 377 | if (n <= state.length) | 379 | 378 | return n; | |
Collapse file Copy file name to clipboardExpand all lines: lib/_stream_writable.js +2-3Lines changed: 2 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -298,10 +298,9 @@ Writable.prototype.write = function(chunk, encoding, cb) { | 298 | 298 | process.nextTick(cb, err); | 299 | 299 | errorOrDestroy(this, err, true); | 300 | 300 | return false; | 301 | | - } else { | 302 | | - state.pendingcb++; | 303 | | - return writeOrBuffer(this, state, chunk, encoding, cb); | 304 | 301 | } | | 302 | + state.pendingcb++; | | 303 | + return writeOrBuffer(this, state, chunk, encoding, cb); | 305 | 304 | }; | 306 | 305 |
| 307 | 306 | Writable.prototype.cork = function() { | |
Collapse file Copy file name to clipboardExpand all lines: lib/_tls_wrap.js +5-6Lines changed: 5 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1503,13 +1503,12 @@ function onConnectSecure() { | 1503 | 1503 | if (options.rejectUnauthorized) { | 1504 | 1504 | this.destroy(verifyError); | 1505 | 1505 | return; | 1506 | | - } else { | 1507 | | - debug('client emit secureConnect. rejectUnauthorized: %s, ' + | 1508 | | - 'authorizationError: %s', options.rejectUnauthorized, | 1509 | | - this.authorizationError); | 1510 | | - this.secureConnecting = false; | 1511 | | - this.emit('secureConnect'); | 1512 | 1506 | } | | 1507 | + debug('client emit secureConnect. rejectUnauthorized: %s, ' + | | 1508 | + 'authorizationError: %s', options.rejectUnauthorized, | | 1509 | + this.authorizationError); | | 1510 | + this.secureConnecting = false; | | 1511 | + this.emit('secureConnect'); | 1513 | 1512 | } else { | 1514 | 1513 | this.authorized = true; | 1515 | 1514 | debug('client emit secureConnect. authorized:', this.authorized); | |
Collapse file Copy file name to clipboardExpand all lines: lib/dns.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -261,9 +261,8 @@ function resolve(hostname, rrtype, callback) { | 261 | 261 |
| 262 | 262 | if (typeof resolver === 'function') { | 263 | 263 | return resolver.call(this, hostname, callback); | 264 | | - } else { | 265 | | - throw new ERR_INVALID_OPT_VALUE('rrtype', rrtype); | 266 | 264 | } | | 265 | + throw new ERR_INVALID_OPT_VALUE('rrtype', rrtype); | 267 | 266 | } | 268 | 267 |
| 269 | 268 | function defaultResolverSetServers(servers) { | |
Collapse file Copy file name to clipboardExpand all lines: lib/events.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -577,9 +577,8 @@ EventEmitter.prototype.rawListeners = function rawListeners(type) { | 577 | 577 | EventEmitter.listenerCount = function(emitter, type) { | 578 | 578 | if (typeof emitter.listenerCount === 'function') { | 579 | 579 | return emitter.listenerCount(type); | 580 | | - } else { | 581 | | - return listenerCount.call(emitter, type); | 582 | 580 | } | | 581 | + return listenerCount.call(emitter, type); | 583 | 582 | }; | 584 | 583 |
| 585 | 584 | EventEmitter.prototype.listenerCount = listenerCount; | |
Collapse file Copy file name to clipboardExpand all lines: lib/fs.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -1545,9 +1545,8 @@ function encodeRealpathResult(result, options) { | 1545 | 1545 | const asBuffer = Buffer.from(result); | 1546 | 1546 | if (options.encoding === 'buffer') { | 1547 | 1547 | return asBuffer; | 1548 | | - } else { | 1549 | | - return asBuffer.toString(options.encoding); | 1550 | 1548 | } | | 1549 | + return asBuffer.toString(options.encoding); | 1551 | 1550 | } | 1552 | 1551 |
| 1553 | 1552 | // Finds the next portion of a (partial) path, up to the next path delimiter | |
|