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 <ruben@bridgewater.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
  • Loading branch information
cjihrig authored and targos committed Mar 27, 2019
1 parent 8b65aa7 commit fef2a54
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 @@ -461,7 +461,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 @@ -516,7 +516,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 fef2a54

Please sign in to comment.