From 286c358832ef06729fdc4cd227e3fc47303ef824 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Fri, 2 Jun 2023 14:18:53 +0200 Subject: [PATCH] lib: do not disable linter for entire files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Disabling linter for single lines is less error prone. PR-URL: https://github.com/nodejs/node/pull/48299 Reviewed-By: Michaƫl Zasso Reviewed-By: Debadree Chatterjee Reviewed-By: Moshe Atlow Reviewed-By: Yagiz Nizipli Reviewed-By: Paolo Insogna --- lib/internal/http2/core.js | 7 +++---- lib/internal/webstreams/readablestream.js | 8 ++++---- lib/internal/webstreams/writablestream.js | 5 +---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index 37d22691259077..0657e23c6d2792 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -1,7 +1,5 @@ 'use strict'; -/* eslint-disable no-use-before-define */ - const { ArrayFrom, ArrayIsArray, @@ -363,6 +361,7 @@ function onSessionHeaders(handle, id, cat, flags, headers, sensitiveHeaders) { } // session[kType] can be only one of two possible values if (type === NGHTTP2_SESSION_SERVER) { + // eslint-disable-next-line no-use-before-define stream = new ServerHttp2Stream(session, handle, id, {}, obj); if (endOfStream) { stream.push(null); @@ -374,6 +373,7 @@ function onSessionHeaders(handle, id, cat, flags, headers, sensitiveHeaders) { stream[kState].flags |= STREAM_FLAGS_HEAD_REQUEST; } } else { + // eslint-disable-next-line no-use-before-define stream = new ClientHttp2Stream(session, handle, id, {}); if (endOfStream) { stream.push(null); @@ -1788,6 +1788,7 @@ class ClientHttp2Session extends Http2Session { const headersList = mapToHeaders(headers); + // eslint-disable-next-line no-use-before-define const stream = new ClientHttp2Stream(this, undefined, undefined, {}); stream[kSentHeaders] = headers; stream[kOrigin] = `${headers[HTTP2_HEADER_SCHEME]}://` + @@ -3412,5 +3413,3 @@ module.exports = { Http2ServerRequest, Http2ServerResponse, }; - -/* eslint-enable no-use-before-define */ diff --git a/lib/internal/webstreams/readablestream.js b/lib/internal/webstreams/readablestream.js index 44ac87594001fd..8eadb631650c2c 100644 --- a/lib/internal/webstreams/readablestream.js +++ b/lib/internal/webstreams/readablestream.js @@ -1,7 +1,5 @@ 'use strict'; -/* eslint-disable no-use-before-define */ - const { ArrayBuffer, ArrayBufferPrototypeGetByteLength, @@ -343,10 +341,12 @@ class ReadableStream { const mode = options?.mode; if (mode === undefined) + // eslint-disable-next-line no-use-before-define return new ReadableStreamDefaultReader(this); if (`${mode}` !== 'byob') throw new ERR_INVALID_ARG_VALUE('options.mode', mode); + // eslint-disable-next-line no-use-before-define return new ReadableStreamBYOBReader(this); } @@ -466,6 +466,7 @@ class ReadableStream { preventCancel = false, } = options; + // eslint-disable-next-line no-use-before-define const reader = new ReadableStreamDefaultReader(this); let done = false; let started = false; @@ -576,6 +577,7 @@ class ReadableStream { locked: this.locked, state: this[kState].state, supportsBYOB: + // eslint-disable-next-line no-use-before-define this[kState].controller instanceof ReadableByteStreamController, }); } @@ -3259,5 +3261,3 @@ module.exports = { setupReadableByteStreamController, setupReadableByteStreamControllerFromSource, }; - -/* eslint-enable no-use-before-define */ diff --git a/lib/internal/webstreams/writablestream.js b/lib/internal/webstreams/writablestream.js index e04ff381c51cd4..b0eb5f20abb80e 100644 --- a/lib/internal/webstreams/writablestream.js +++ b/lib/internal/webstreams/writablestream.js @@ -1,7 +1,5 @@ 'use strict'; -/* eslint-disable no-use-before-define */ - const { ArrayPrototypePush, ArrayPrototypeShift, @@ -262,6 +260,7 @@ class WritableStream { getWriter() { if (!isWritableStream(this)) throw new ERR_INVALID_THIS('WritableStream'); + // eslint-disable-next-line no-use-before-define return new WritableStreamDefaultWriter(this); } @@ -1360,5 +1359,3 @@ module.exports = { setupWritableStreamDefaultControllerFromSink, setupWritableStreamDefaultController, }; - -/* eslint-enable no-use-before-define */