tools: enable getter-return lint rule
PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
d989e20717
commit
5de804e636
@ -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' },
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user