Skip to content

Commit

Permalink
lib: do not disable linter for entire files
Browse files Browse the repository at this point in the history
Disabling linter for single lines is less error prone.

PR-URL: #48299
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Paolo Insogna <paolo@cowtech.it>
  • Loading branch information
aduh95 authored and targos committed Jun 4, 2023
1 parent a94f87e commit 72de4e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
7 changes: 3 additions & 4 deletions lib/internal/http2/core.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

/* eslint-disable no-use-before-define */

const {
ArrayFrom,
ArrayIsArray,
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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]}://` +
Expand Down Expand Up @@ -3412,5 +3413,3 @@ module.exports = {
Http2ServerRequest,
Http2ServerResponse,
};

/* eslint-enable no-use-before-define */
8 changes: 4 additions & 4 deletions lib/internal/webstreams/readablestream.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

/* eslint-disable no-use-before-define */

const {
ArrayBuffer,
ArrayBufferPrototypeGetByteLength,
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
});
}
Expand Down Expand Up @@ -3259,5 +3261,3 @@ module.exports = {
setupReadableByteStreamController,
setupReadableByteStreamControllerFromSource,
};

/* eslint-enable no-use-before-define */
5 changes: 1 addition & 4 deletions lib/internal/webstreams/writablestream.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

/* eslint-disable no-use-before-define */

const {
ArrayPrototypePush,
ArrayPrototypeShift,
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -1360,5 +1359,3 @@ module.exports = {
setupWritableStreamDefaultControllerFromSink,
setupWritableStreamDefaultController,
};

/* eslint-enable no-use-before-define */

0 comments on commit 72de4e7

Please sign in to comment.