diff --git a/.eslintrc.js b/.eslintrc.js index 4863bbd9986348..f5202002f39923 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 23266eb6c2d469..84630a37176e8a 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -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]; diff --git a/lib/net.js b/lib/net.js index a5f012ac3302bb..42c45e09b82952 100644 --- a/lib/net.js +++ b/lib/net.js @@ -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; } diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 9abbeec199b09a..a474fd56e44b71 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(