diff --git a/.eslintrc.js b/.eslintrc.js index d80507467bc041..3a51903e0dddc1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -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' }, diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index 551c9f1efa6bba..d866631fad0894 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -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]; diff --git a/lib/net.js b/lib/net.js index d363878a929404..d6d5327f7c513a 100644 --- a/lib/net.js +++ b/lib/net.js @@ -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; } diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 5a626fe3a83b34..6c6d210dfe7fc6 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -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(