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: nodejs#48299
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Debadree Chatterjee <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Paolo Insogna <[email protected]>
  • Loading branch information
aduh95 authored and Ceres6 committed Aug 14, 2023
1 parent 4e1308f commit 4b516f9
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 4b516f9

Please sign in to comment.