Skip to content

Commit

Permalink
tools: enable getter-return lint rule
Browse files Browse the repository at this point in the history
PR-URL: #26615
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Masashi Hirano <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
  • Loading branch information
cjihrig authored and BethGriggs committed Mar 26, 2019
1 parent 0791e3c commit 802c76a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ module.exports = {
'func-call-spacing': 'error',
'func-name-matching': 'error',
'func-style': ['error', 'declaration', { allowArrowFunctions: true }],
'getter-return': 'error',
'indent': ['error', 2, {
ArrayExpression: 'first',
CallExpression: { arguments: 'first' },
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/http2/compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ class Http2ServerResponse extends Stream {
// This is compatible with http1 which removes socket reference
// only from ServerResponse but not IncomingMessage
if (this[kState].closed)
return;
return undefined;

const stream = this[kStream];
const proxySocket = stream[kProxySocket];
Expand Down
2 changes: 1 addition & 1 deletion lib/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ Object.defineProperty(Socket.prototype, 'readyState', {


Object.defineProperty(Socket.prototype, 'bufferSize', {
get: function() {
get: function() { // eslint-disable-line getter-return
if (this._handle) {
return this[kLastWriteQueueSize] + this.writableLength;
}
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,11 +289,11 @@ assert.strictEqual(
// Dynamic properties.
{
assert.strictEqual(
util.inspect({ get readonly() {} }),
util.inspect({ get readonly() { return 1; } }),
'{ readonly: [Getter] }');

assert.strictEqual(
util.inspect({ get readwrite() {}, set readwrite(val) {} }),
util.inspect({ get readwrite() { return 1; }, set readwrite(val) {} }),
'{ readwrite: [Getter/Setter] }');

assert.strictEqual(
Expand Down

0 comments on commit 802c76a

Please sign in to comment.