From 79c2e431eda1b57eb030f48e2dbabbf8318eab1f Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 30 Nov 2026 11:00:52 +0100 Subject: [PATCH 1/2] tools: allow unused variables named only with underscores And enforces that underscore-only variables stayed unused. Signed-off-by: Antoine du Hamel --- benchmark/readline/readline-iterable.js | 1 - .../streams/iter-throughput-broadcast.js | 1 - benchmark/test_runner/run-single-test-file.js | 1 - eslint.config.mjs | 9 +++++++- test/parallel/test-blob-file-backed.js | 3 +-- .../test-fs-promises-file-handle-pull.js | 1 - .../test-fs-promises-watch-ignore-invalid.mjs | 2 -- test/parallel/test-fs-promises-watch.js | 20 ++++++++-------- .../test-fs-watch-recursive-promise.js | 1 - test/parallel/test-path-resolve.js | 4 ++-- .../test-quic-edge-concurrent-close.mjs | 2 +- ...test-quic-edge-endpoint-destroy-active.mjs | 4 ++-- test/parallel/test-quic-edge-idempotent.mjs | 2 +- ...st-quic-flow-control-concurrent-volume.mjs | 2 +- ...st-quic-flow-control-large-constrained.mjs | 2 +- ...quic-flow-control-slow-consumer-volume.mjs | 2 +- ...st-quic-h3-stream-destroy-no-resurrect.mjs | 1 - .../test-quic-internal-setcallbacks.mjs | 1 - .../test-quic-stats-tojson-inspect.mjs | 4 ++-- .../test-quic-stream-destroy-no-resurrect.mjs | 1 - .../parallel/test-quic-stream-id-ordering.mjs | 4 ++-- .../test-quic-stream-setbody-errors.mjs | 5 ++-- test/parallel/test-quic-stream-writer-api.mjs | 2 +- test/parallel/test-quic-token-reuse.mjs | 4 ++-- .../test-quic-writer-abort-signal.mjs | 2 +- .../test-quic-zero-rtt-disabled-client.mjs | 2 +- .../test-quic-zero-rtt-disabled-server.mjs | 2 +- .../parallel/test-readline-async-iterators.js | 1 - ...est-runner-coverage-isolation-none-api.mjs | 1 - .../test-runner-execution-ordered-bypass.mjs | 1 - test/parallel/test-runner-log.mjs | 1 - test/parallel/test-runner-mock-timers.js | 4 ++-- ...test-runner-no-isolation-different-cwd.mjs | 1 - test/parallel/test-runner-no-isolation.mjs | 1 - test/parallel/test-runner-plan.mjs | 11 --------- .../test-runner-randomize-first-draw.mjs | 1 - test/parallel/test-runner-run-coverage.mjs | 5 ---- .../test-runner-run-files-undefined.mjs | 1 - test/parallel/test-runner-run.mjs | 23 ------------------- test/parallel/test-runner-tags-events.mjs | 4 ---- test/parallel/test-runner-tags-validation.mjs | 2 -- .../test-runner-test-rerun-failures.js | 3 --- test/parallel/test-sqlite-template-tag.js | 1 - .../test-stream-iter-broadcast-basic.js | 3 --- .../test-stream-iter-broadcast-from.js | 2 -- .../test-stream-iter-consumers-merge.js | 4 ---- .../test-stream-iter-consumers-tap.js | 1 - test/parallel/test-stream-iter-duplex.js | 3 --- test/parallel/test-stream-iter-from-sync.js | 2 -- test/parallel/test-stream-iter-pull-async.js | 3 --- test/parallel/test-stream-iter-pull-sync.js | 9 ++------ test/parallel/test-stream-iter-push-basic.js | 5 ---- test/parallel/test-stream-iter-push-writer.js | 1 - test/parallel/test-stream-iter-share-async.js | 3 --- test/parallel/test-stream-iter-share-sync.js | 3 --- test/parallel/test-stream-map.js | 1 - ...tream-pipe-objectmode-to-non-objectmode.js | 1 - test/parallel/test-stream-readable-to-web.mjs | 1 - .../test-timers-interval-promisified.js | 3 +-- test/parallel/test-vfs-dir-handle.js | 1 - .../test-whatwg-readablebytestream.js | 2 -- ...twg-readablestream-pipeto-async-context.js | 1 - test/parallel/test-whatwg-readablestream.js | 6 ++--- ...nsformstream-parked-write-async-context.js | 1 - .../test-whatwg-webstreams-async-context.js | 2 -- .../test-zlib-zip-security-hardening.js | 1 - .../test-run-watch-cwd-isolation-process.mjs | 1 - test/test-runner/test-run-watch-cwd.mjs | 1 - .../test-run-watch-emit-restarted.mjs | 1 - ...t-run-watch-no-emit-restarted-disabled.mjs | 1 - 70 files changed, 47 insertions(+), 162 deletions(-) diff --git a/benchmark/readline/readline-iterable.js b/benchmark/readline/readline-iterable.js index 9be4ea1f52b4..094fbd610f38 100644 --- a/benchmark/readline/readline-iterable.js +++ b/benchmark/readline/readline-iterable.js @@ -74,7 +74,6 @@ async function main({ n, type }) { const readlineIterable = type === 'old' ? oldWay.call(iterable) : iterable; - // eslint-disable-next-line no-unused-vars for await (const _ of readlineIterable) { lineCount++; } diff --git a/benchmark/streams/iter-throughput-broadcast.js b/benchmark/streams/iter-throughput-broadcast.js index c5bbac930677..1bf1dd78dba7 100644 --- a/benchmark/streams/iter-throughput-broadcast.js +++ b/benchmark/streams/iter-throughput-broadcast.js @@ -114,7 +114,6 @@ function benchIter(chunk, numConsumers, datasize, n, totalOps) { // No-op consumer: drain all batches without collecting async function drain(source) { - // eslint-disable-next-line no-unused-vars for await (const _ of source) { /* drain */ } } diff --git a/benchmark/test_runner/run-single-test-file.js b/benchmark/test_runner/run-single-test-file.js index 839517d8f93b..7d4b2125a26d 100644 --- a/benchmark/test_runner/run-single-test-file.js +++ b/benchmark/test_runner/run-single-test-file.js @@ -47,7 +47,6 @@ async function runBenchmark({ numberOfTestFiles, isolation }) { concurrency: false, // We don't want to run tests concurrently }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); return numberOfTestFiles; diff --git a/eslint.config.mjs b/eslint.config.mjs index 45464ffc0d64..fa7dcf63cefa 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -242,7 +242,14 @@ export default [ 'no-undef': ['error', { typeof: true }], 'no-undef-init': 'error', 'no-unused-expressions': ['error', { allowShortCircuit: true }], - 'no-unused-vars': ['error', { args: 'none', caughtErrors: 'all' }], + 'no-unused-vars': ['error', { + args: 'none', + caughtErrors: 'all', + varsIgnorePattern: '^_+$', + caughtErrorsIgnorePattern: '^_+$', + destructuredArrayIgnorePattern: '^_+$', + reportUsedIgnorePattern: true, + }], 'no-use-before-define': ['error', { classes: true, functions: false, diff --git a/test/parallel/test-blob-file-backed.js b/test/parallel/test-blob-file-backed.js index 769aa5642980..142f761bf422 100644 --- a/test/parallel/test-blob-file-backed.js +++ b/test/parallel/test-blob-file-backed.js @@ -57,7 +57,7 @@ writeFileSync(testfile5, ''); stream = blob.stream(); const read = async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of stream) {} }; @@ -98,7 +98,6 @@ writeFileSync(testfile5, ''); const blob = await openAsBlob(testfile3); const stream = blob.stream(); const read = async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of stream) { writeFileSync(testfile3, data + 'abc'); } diff --git a/test/parallel/test-fs-promises-file-handle-pull.js b/test/parallel/test-fs-promises-file-handle-pull.js index 055a1e395298..7530b138b275 100644 --- a/test/parallel/test-fs-promises-file-handle-pull.js +++ b/test/parallel/test-fs-promises-file-handle-pull.js @@ -216,7 +216,6 @@ async function testPullAbortSignal() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of readable) { assert.fail('Should not reach here'); } diff --git a/test/parallel/test-fs-promises-watch-ignore-invalid.mjs b/test/parallel/test-fs-promises-watch-ignore-invalid.mjs index 597fecc3bb04..3b05c0520325 100644 --- a/test/parallel/test-fs-promises-watch-ignore-invalid.mjs +++ b/test/parallel/test-fs-promises-watch-ignore-invalid.mjs @@ -9,7 +9,6 @@ const { watch } = await import('node:fs/promises'); await assert.rejects( async () => { const watcher = watch('.', { ignore: 123 }); - // eslint-disable-next-line no-unused-vars for await (const _ of watcher) { // Will throw before yielding } @@ -23,7 +22,6 @@ await assert.rejects( await assert.rejects( async () => { const watcher = watch('.', { ignore: '' }); - // eslint-disable-next-line no-unused-vars for await (const _ of watcher) { // Will throw before yielding } diff --git a/test/parallel/test-fs-promises-watch.js b/test/parallel/test-fs-promises-watch.js index 397297b4f4ca..9977ff5dafb7 100644 --- a/test/parallel/test-fs-promises-watch.js +++ b/test/parallel/test-fs-promises-watch.js @@ -83,61 +83,61 @@ for (const testCase of kCases) { assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch(1)) { } }, { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall()); assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch(__filename, 1)) { } }, { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall()); assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch('', { persistent: 1 })) { } }, { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall()); assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch('', { recursive: 1 })) { } }, { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall()); assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch('', { encoding: 1 })) { } }, { code: 'ERR_INVALID_ARG_VALUE' }).then(common.mustCall()); assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch('', { signal: 1 })) { } }, { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall()); assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch('', { maxQueue: 'silly' })) { } }, { code: 'ERR_INVALID_ARG_TYPE' }).then(common.mustCall()); assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch('', { overflow: 1 })) { } }, { code: 'ERR_INVALID_ARG_VALUE' }).then(common.mustCall()); assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch('', { overflow: 'barf' })) { } }, { code: 'ERR_INVALID_ARG_VALUE' }).then(common.mustCall()); @@ -147,7 +147,7 @@ assert.rejects( const { signal } = ac; setImmediate(() => ac.abort()); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of watch(__filename, { signal })) { } }, { name: 'AbortError' }); })().then(common.mustCall()); diff --git a/test/parallel/test-fs-watch-recursive-promise.js b/test/parallel/test-fs-watch-recursive-promise.js index cb00a35db274..77a8f99acf46 100644 --- a/test/parallel/test-fs-watch-recursive-promise.js +++ b/test/parallel/test-fs-watch-recursive-promise.js @@ -61,7 +61,6 @@ tmpdir.refresh(); const error = new Error(); const watcher = fs.watch(testsubdir, { recursive: true, signal: AbortSignal.abort(error) }); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of watcher); }, { code: 'ABORT_ERR', cause: error }); })().then(common.mustCall()); diff --git a/test/parallel/test-path-resolve.js b/test/parallel/test-path-resolve.js index dd70dea530fe..56a7642a6a07 100644 --- a/test/parallel/test-path-resolve.js +++ b/test/parallel/test-path-resolve.js @@ -11,9 +11,9 @@ const backslashRE = /\\/g; const posixyCwd = common.isWindows ? (() => { - const _ = process.cwd() + const cwd = process.cwd() .replaceAll(path.sep, path.posix.sep); - return _.slice(_.indexOf(path.posix.sep)); + return cwd.slice(cwd.indexOf(path.posix.sep)); })() : process.cwd(); diff --git a/test/parallel/test-quic-edge-concurrent-close.mjs b/test/parallel/test-quic-edge-concurrent-close.mjs index 49dcd244344e..542c5464e16a 100644 --- a/test/parallel/test-quic-edge-concurrent-close.mjs +++ b/test/parallel/test-quic-edge-concurrent-close.mjs @@ -31,7 +31,7 @@ await clientSession.opened; // Open a stream so the server session has work, then close from both sides. const stream = clientSession.createBidirectionalStream(); stream.writer.endSync(); -for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars +for await (const _ of stream) { /* drain */ } await stream.closed; // Client close happens around the same time as server close above. diff --git a/test/parallel/test-quic-edge-endpoint-destroy-active.mjs b/test/parallel/test-quic-edge-endpoint-destroy-active.mjs index 192ed04a2889..c02810f20169 100644 --- a/test/parallel/test-quic-edge-endpoint-destroy-active.mjs +++ b/test/parallel/test-quic-edge-endpoint-destroy-active.mjs @@ -20,7 +20,7 @@ const serverDone = Promise.withResolvers(); const serverEndpoint = await listen(mustCall(async (serverSession) => { serverSession.onstream = mustCall(async (stream) => { - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } stream.writer.endSync(); await stream.closed; }); @@ -35,7 +35,7 @@ await clientSession.opened; const stream = clientSession.createBidirectionalStream({ body: encoder.encode('hello'), }); -for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars +for await (const _ of stream) { /* drain */ } await stream.closed; // Close the endpoint while the server session is still active diff --git a/test/parallel/test-quic-edge-idempotent.mjs b/test/parallel/test-quic-edge-idempotent.mjs index ba44c31ec01a..d28ad79a7bcf 100644 --- a/test/parallel/test-quic-edge-idempotent.mjs +++ b/test/parallel/test-quic-edge-idempotent.mjs @@ -29,7 +29,7 @@ await clientSession.opened; // Signal server to close via stream first (before we close). const stream = clientSession.createBidirectionalStream(); stream.writer.endSync(); -for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars +for await (const _ of stream) { /* drain */ } await stream.closed; // Double close() on session — both return the same promise. diff --git a/test/parallel/test-quic-flow-control-concurrent-volume.mjs b/test/parallel/test-quic-flow-control-concurrent-volume.mjs index 74793cdfa7a1..3449cb2616c8 100644 --- a/test/parallel/test-quic-flow-control-concurrent-volume.mjs +++ b/test/parallel/test-quic-flow-control-concurrent-volume.mjs @@ -112,7 +112,7 @@ for (let i = 0; i < kStreams; i++) { } await Promise.all(streams.map(async (stream) => { - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } await stream.closed; })); diff --git a/test/parallel/test-quic-flow-control-large-constrained.mjs b/test/parallel/test-quic-flow-control-large-constrained.mjs index 2ad22e133bdb..6e4dd6b9ead5 100644 --- a/test/parallel/test-quic-flow-control-large-constrained.mjs +++ b/test/parallel/test-quic-flow-control-large-constrained.mjs @@ -84,7 +84,7 @@ const windowCaps = { stream.setBody(payload); - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } await Promise.all([stream.closed, serverDone.promise]); await clientSession.close(); await serverEndpoint.close(); diff --git a/test/parallel/test-quic-flow-control-slow-consumer-volume.mjs b/test/parallel/test-quic-flow-control-slow-consumer-volume.mjs index 566ba6c0ee59..3db74e86ab62 100644 --- a/test/parallel/test-quic-flow-control-slow-consumer-volume.mjs +++ b/test/parallel/test-quic-flow-control-slow-consumer-volume.mjs @@ -85,7 +85,7 @@ const stream = clientSession.createBidirectionalStream(); stream.onblocked = mustCallAtLeast(1); stream.setBody(payload); -for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars +for await (const _ of stream) { /* drain */ } await Promise.all([stream.closed, serverDone.promise]); // Integrity first: bounded buffering is only interesting if no data was lost. diff --git a/test/parallel/test-quic-h3-stream-destroy-no-resurrect.mjs b/test/parallel/test-quic-h3-stream-destroy-no-resurrect.mjs index 691b095f7a14..e01b11e0390f 100644 --- a/test/parallel/test-quic-h3-stream-destroy-no-resurrect.mjs +++ b/test/parallel/test-quic-h3-stream-destroy-no-resurrect.mjs @@ -84,7 +84,6 @@ for (let i = 0; i < kRequests; i++) { // Take one batch of the response, then abandon the rest and destroy, so // DATA frames keep arriving for a stream we no longer track. - // eslint-disable-next-line no-unused-vars for await (const _ of stream) break; stream.destroy(); diff --git a/test/parallel/test-quic-internal-setcallbacks.mjs b/test/parallel/test-quic-internal-setcallbacks.mjs index 910f1fa97a74..6f696cb89d61 100644 --- a/test/parallel/test-quic-internal-setcallbacks.mjs +++ b/test/parallel/test-quic-internal-setcallbacks.mjs @@ -38,7 +38,6 @@ const callbacks = { }; // Fail if any callback is missing for (const fn of Object.keys(callbacks)) { - // eslint-disable-next-line no-unused-vars const { [fn]: _, ...rest } = callbacks; assert.throws(() => quic.setCallbacks(rest), { code: 'ERR_MISSING_ARGS', diff --git a/test/parallel/test-quic-stats-tojson-inspect.mjs b/test/parallel/test-quic-stats-tojson-inspect.mjs index bffafa4bd0ac..140fda5d23aa 100644 --- a/test/parallel/test-quic-stats-tojson-inspect.mjs +++ b/test/parallel/test-quic-stats-tojson-inspect.mjs @@ -27,7 +27,7 @@ const serverEndpoint = await listen(mustCall((serverSession) => { assert.ok(sessionStatsInspect.includes('QuicSessionStats')); serverSession.onstream = mustCall(async (stream) => { - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } stream.writer.endSync(); await stream.closed; serverSession.close(); @@ -57,7 +57,7 @@ assert.ok(clientStatsInspect.includes('QuicSessionStats')); const stream = clientSession.createBidirectionalStream({ body: new TextEncoder().encode('test'), }); -for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars +for await (const _ of stream) { /* drain */ } await Promise.all([stream.closed, serverDone.promise]); diff --git a/test/parallel/test-quic-stream-destroy-no-resurrect.mjs b/test/parallel/test-quic-stream-destroy-no-resurrect.mjs index 81c49ee128a8..08b99d01f0e8 100644 --- a/test/parallel/test-quic-stream-destroy-no-resurrect.mjs +++ b/test/parallel/test-quic-stream-destroy-no-resurrect.mjs @@ -66,7 +66,6 @@ for (let i = 0; i < kStreams; i++) { // Read a little, then abandon the rest and destroy. Breaking out of the // loop leaves the server mid-send, so frames keep arriving after destroy. - // eslint-disable-next-line no-unused-vars for await (const _ of stream) break; stream.destroy(); diff --git a/test/parallel/test-quic-stream-id-ordering.mjs b/test/parallel/test-quic-stream-id-ordering.mjs index 3bd02918e608..6c822e58f611 100644 --- a/test/parallel/test-quic-stream-id-ordering.mjs +++ b/test/parallel/test-quic-stream-id-ordering.mjs @@ -17,7 +17,7 @@ let serverStreamCount = 0; const serverEndpoint = await listen(mustCall((serverSession) => { serverSession.onstream = mustCall(async (stream) => { - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } stream.writer.endSync(); await stream.closed; if (++serverStreamCount === 10) { @@ -36,7 +36,7 @@ for (let i = 0; i < 10; i++) { body: encoder.encode(`stream ${i}`), }); ids.push(stream.id); - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } await stream.closed; } diff --git a/test/parallel/test-quic-stream-setbody-errors.mjs b/test/parallel/test-quic-stream-setbody-errors.mjs index bd32af704972..cf4954f55581 100644 --- a/test/parallel/test-quic-stream-setbody-errors.mjs +++ b/test/parallel/test-quic-stream-setbody-errors.mjs @@ -17,7 +17,7 @@ const encoder = new TextEncoder(); const serverEndpoint = await listen(mustCall(async (serverSession) => { serverSession.onstream = mustCall(async (stream) => { - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } stream.writer.endSync(); await stream.closed; serverSession.close(); @@ -37,7 +37,7 @@ await clientSession.opened; message: /outbound already configured/, }); - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } await stream.closed; } @@ -57,7 +57,6 @@ await clientSession.opened; // this stream is never answered and never receives a FIN. Reading it // therefore surfaces the truncation rather than ending cleanly. await assert.rejects((async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of stream) { /* drain */ } })(), { code: 'ERR_QUIC_STREAM_ABORTED' }); await stream.closed; diff --git a/test/parallel/test-quic-stream-writer-api.mjs b/test/parallel/test-quic-stream-writer-api.mjs index d9c7fe4ace2c..3d3aa2c06945 100644 --- a/test/parallel/test-quic-stream-writer-api.mjs +++ b/test/parallel/test-quic-stream-writer-api.mjs @@ -109,7 +109,7 @@ await clientSession.opened; { code: 'ERR_INVALID_STATE', name: 'TypeError' }); await assert.rejects(w.writev(['closed']), { code: 'ERR_INVALID_STATE', name: 'TypeError' }); - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } await stream.closed; } diff --git a/test/parallel/test-quic-token-reuse.mjs b/test/parallel/test-quic-token-reuse.mjs index 4b21bec93e7c..09f824110bae 100644 --- a/test/parallel/test-quic-token-reuse.mjs +++ b/test/parallel/test-quic-token-reuse.mjs @@ -40,7 +40,7 @@ await Promise.all([cs1.opened, gotToken.promise]); // Signal the server to close this session. const s1 = cs1.createBidirectionalStream(); s1.writer.endSync(); -for await (const _ of s1) { /* drain */ } // eslint-disable-line no-unused-vars +for await (const _ of s1) { /* drain */ } await Promise.all([s1.closed, cs1.closed]); // Second connection: reuse the token. The connection should succeed. @@ -52,7 +52,7 @@ await cs2.opened; // Verify data transfer works on the second connection. const s2 = cs2.createBidirectionalStream(); s2.writer.endSync(); -for await (const _ of s2) { /* drain */ } // eslint-disable-line no-unused-vars +for await (const _ of s2) { /* drain */ } await s2.closed; // Close from the client side. diff --git a/test/parallel/test-quic-writer-abort-signal.mjs b/test/parallel/test-quic-writer-abort-signal.mjs index 950388448b4b..eae0c5057f71 100644 --- a/test/parallel/test-quic-writer-abort-signal.mjs +++ b/test/parallel/test-quic-writer-abort-signal.mjs @@ -58,7 +58,7 @@ await assert.rejects(abortedEnd, (error) => error === reason); await pendingWrite; assert.strictEqual(await w.end(), 1028); -for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars +for await (const _ of stream) { /* drain */ } await Promise.all([stream.closed, serverDone.promise]); await clientSession.close(); await serverEndpoint.close(); diff --git a/test/parallel/test-quic-zero-rtt-disabled-client.mjs b/test/parallel/test-quic-zero-rtt-disabled-client.mjs index 245761e05521..a81a9da2a050 100644 --- a/test/parallel/test-quic-zero-rtt-disabled-client.mjs +++ b/test/parallel/test-quic-zero-rtt-disabled-client.mjs @@ -21,7 +21,7 @@ const gotToken = Promise.withResolvers(); const serverEndpoint = await listen((serverSession) => { serverSession.onstream = async (stream) => { - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } stream.writer.endSync(); await stream.closed; serverSession.close(); diff --git a/test/parallel/test-quic-zero-rtt-disabled-server.mjs b/test/parallel/test-quic-zero-rtt-disabled-server.mjs index 5cfede792267..ee23e8de2cb9 100644 --- a/test/parallel/test-quic-zero-rtt-disabled-server.mjs +++ b/test/parallel/test-quic-zero-rtt-disabled-server.mjs @@ -34,7 +34,7 @@ const alpn = ['quic-test']; // First server: enableEarlyData: true (default) to generate a valid ticket. const serverEndpoint1 = await listen((serverSession) => { serverSession.onstream = async (stream) => { - for await (const _ of stream) { /* drain */ } // eslint-disable-line no-unused-vars + for await (const _ of stream) { /* drain */ } stream.writer.endSync(); await stream.closed; serverSession.close(); diff --git a/test/parallel/test-readline-async-iterators.js b/test/parallel/test-readline-async-iterators.js index a88c550c07ef..531eaff1222f 100644 --- a/test/parallel/test-readline-async-iterators.js +++ b/test/parallel/test-readline-async-iterators.js @@ -129,7 +129,6 @@ async function testSlowStreamForLeaks() { }); let lines = 0; - // eslint-disable-next-line no-unused-vars for await (const _ of iterable) { lines++; } diff --git a/test/parallel/test-runner-coverage-isolation-none-api.mjs b/test/parallel/test-runner-coverage-isolation-none-api.mjs index a647645c3905..f45c4beb468d 100644 --- a/test/parallel/test-runner-coverage-isolation-none-api.mjs +++ b/test/parallel/test-runner-coverage-isolation-none-api.mjs @@ -37,7 +37,6 @@ describe('run() coverage with isolation: none', skipIfNoInspector, () => { stream.on('test:coverage', common.mustCall(({ summary: s }) => { summary = s; })); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); assert.ok(summary, 'test:coverage event must fire'); diff --git a/test/parallel/test-runner-execution-ordered-bypass.mjs b/test/parallel/test-runner-execution-ordered-bypass.mjs index 75e9eb51d7d9..244da6e40d85 100644 --- a/test/parallel/test-runner-execution-ordered-bypass.mjs +++ b/test/parallel/test-runner-execution-ordered-bypass.mjs @@ -58,7 +58,6 @@ test('execution-ordered events bypass FileTest declaration-order buffer', { events.push(`log:${data.message}`); }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); const completeFast = events.indexOf('complete:fast-fail'); diff --git a/test/parallel/test-runner-log.mjs b/test/parallel/test-runner-log.mjs index 8e767e0f903c..a9fbc25a4970 100644 --- a/test/parallel/test-runner-log.mjs +++ b/test/parallel/test-runner-log.mjs @@ -42,7 +42,6 @@ test('test:log is emitted immediately with the expected payload', async () => { events.push(`pass:${data.name}`); }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); assert.strictEqual(logs.length, 3); diff --git a/test/parallel/test-runner-mock-timers.js b/test/parallel/test-runner-mock-timers.js index 25510fe023d0..6789a59f32e6 100644 --- a/test/parallel/test-runner-mock-timers.js +++ b/test/parallel/test-runner-mock-timers.js @@ -711,7 +711,7 @@ describe('Mock Timers Test Suite', () => { let time = 0; async function run() { const times = []; - for await (const _ of nodeTimersPromises.setInterval(interval)) { // eslint-disable-line no-unused-vars + for await (const _ of nodeTimersPromises.setInterval(interval)) { time += interval; times.push(time); if (times.length === expectedIterations) break; @@ -814,7 +814,7 @@ describe('Mock Timers Test Suite', () => { let numIterations = 0; async function run() { const it = nodeTimersPromises.setInterval(interval, undefined, { signal }); - for await (const _ of it) { // eslint-disable-line no-unused-vars + for await (const _ of it) { numIterations += 1; if (numIterations === 5) break; } diff --git a/test/parallel/test-runner-no-isolation-different-cwd.mjs b/test/parallel/test-runner-no-isolation-different-cwd.mjs index 9138c480bf3e..f42484c0cbbc 100644 --- a/test/parallel/test-runner-no-isolation-different-cwd.mjs +++ b/test/parallel/test-runner-no-isolation-different-cwd.mjs @@ -10,7 +10,6 @@ const stream = run({ stream.on('test:pass', mustCall(4)); -// eslint-disable-next-line no-unused-vars for await (const _ of stream); allowGlobals(globalThis.GLOBAL_ORDER); assert.deepStrictEqual(globalThis.GLOBAL_ORDER, [ diff --git a/test/parallel/test-runner-no-isolation.mjs b/test/parallel/test-runner-no-isolation.mjs index 6f0aba6b9548..40cf32ab2844 100644 --- a/test/parallel/test-runner-no-isolation.mjs +++ b/test/parallel/test-runner-no-isolation.mjs @@ -13,7 +13,6 @@ const stream = run({ stream.on('test:fail', mustNotCall()); stream.on('test:pass', mustCall(4)); -// eslint-disable-next-line no-unused-vars for await (const _ of stream); allowGlobals(globalThis.GLOBAL_ORDER); assert.deepStrictEqual(globalThis.GLOBAL_ORDER, [ diff --git a/test/parallel/test-runner-plan.mjs b/test/parallel/test-runner-plan.mjs index 85f8f570453c..fe4e8227b3a1 100644 --- a/test/parallel/test-runner-plan.mjs +++ b/test/parallel/test-runner-plan.mjs @@ -43,7 +43,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(1)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -55,7 +54,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustCall(1)); stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -67,7 +65,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustCall(1)); stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -79,7 +76,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(2)); // Parent + child test - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -91,7 +87,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustCall(1)); stream.on('test:pass', common.mustCall(1)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -103,7 +98,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(1)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -115,7 +109,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(3)); // Parent + 2 levels of nesting - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -128,7 +121,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustCall(1)); stream.on('test:pass', common.mustCall(1)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -140,7 +132,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustCall(1)); stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -152,7 +143,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustCall(1)); stream.on('test:pass', common.mustCall(1)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -164,7 +154,6 @@ describe('test planning', () => { stream.on('test:fail', common.mustCall(1)); // Fails because plan is not met immediately stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); }); diff --git a/test/parallel/test-runner-randomize-first-draw.mjs b/test/parallel/test-runner-randomize-first-draw.mjs index 349b53669150..3e1b3721463f 100644 --- a/test/parallel/test-runner-randomize-first-draw.mjs +++ b/test/parallel/test-runner-randomize-first-draw.mjs @@ -29,7 +29,6 @@ test('randomizes the first subtest draw deterministically', async () => { } }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); assert.deepStrictEqual(actual, expected, `seed ${seed}`); diff --git a/test/parallel/test-runner-run-coverage.mjs b/test/parallel/test-runner-run-coverage.mjs index 5a70644a89d9..e9cedc142813 100644 --- a/test/parallel/test-runner-run-coverage.mjs +++ b/test/parallel/test-runner-run-coverage.mjs @@ -103,7 +103,6 @@ describe('require(\'node:test\').run coverage settings', { concurrency: true }, stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall()); stream.on('test:coverage', common.mustCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -115,7 +114,6 @@ describe('require(\'node:test\').run coverage settings', { concurrency: true }, const filesPaths = files.map(({ path }) => path); assert.strictEqual(filesPaths.some((path) => path.includes(`test-runner${sep}invalid-tap.js`)), false); })); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -132,7 +130,6 @@ describe('require(\'node:test\').run coverage settings', { concurrency: true }, const filesPaths = files.map(({ path }) => path); assert.strictEqual(filesPaths.some((path) => path.includes(`v8-coverage${sep}throw.js`)), true); })); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -150,7 +147,6 @@ describe('require(\'node:test\').run coverage settings', { concurrency: true }, assert.strictEqual(filesPaths.every((path) => !path.includes(`test-runner${sep}invalid-tap.js`)), true); assert.strictEqual(filesPaths.some((path) => path.includes(`test-runner${sep}coverage.js`)), true); })); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -177,7 +173,6 @@ describe('require(\'node:test\').run coverage settings', { concurrency: true }, thresholdErrors.push(match[1]); } }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); assert.deepStrictEqual(thresholdErrors.sort(), ['branch', 'function', 'line']); assert.strictEqual(process.exitCode, 1); diff --git a/test/parallel/test-runner-run-files-undefined.mjs b/test/parallel/test-runner-run-files-undefined.mjs index a0981b307d19..49f56b11b8c6 100644 --- a/test/parallel/test-runner-run-files-undefined.mjs +++ b/test/parallel/test-runner-run-files-undefined.mjs @@ -17,7 +17,6 @@ async function runTests(run, reporters) { throw new Error('Received test:pass with ' + reporterName); }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); } } diff --git a/test/parallel/test-runner-run.mjs b/test/parallel/test-runner-run.mjs index a973ecb7cb71..dbf816424f17 100644 --- a/test/parallel/test-runner-run.mjs +++ b/test/parallel/test-runner-run.mjs @@ -15,7 +15,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { const stream = run({ files: [] }); stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -23,7 +22,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { const stream = run({ files: ['a-random-file-that-does-not-exist.js'] }); stream.on('test:fail', common.mustCall(1)); stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -31,7 +29,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { const stream = run({ files: [join(testFixtures, 'default-behavior/test/random.cjs')] }); stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(1)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -46,7 +43,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { stream.on('test:diagnostic', (event) => { diagnosticEvents.push(event); }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); assert(diagnosticEvents.length > 0, 'No diagnostic events were emitted'); const infoEvent = diagnosticEvents.find((e) => e.level === 'info'); @@ -63,7 +59,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { const stream = run({ files: [argPrintingFile], argv: ['--a-custom-argument'] }); stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -76,7 +71,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { }); stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(2)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -84,7 +78,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { const stream = run({ files: [testFixtures] }); stream.on('test:fail', common.mustCall(1)); stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -96,7 +89,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { assert.strictEqual(data.details.error.failureType, 'testTimeoutFailure'); }, 2)); stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -117,7 +109,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { } }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); assert.deepStrictEqual(cancelledFailures, [ @@ -262,7 +253,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { } }, 3)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -274,7 +264,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { ] }); stream.on('test:fail', common.mustCall(2)); stream.on('test:pass', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -402,7 +391,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { executedTestFiles.push(basename(passedTest.file)); } }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream) ; return executedTestFiles; @@ -422,7 +410,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { executionOrder.push(passedTest.name.slice('internal '.length)); } }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream) ; return executionOrder; @@ -525,7 +512,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { stream.on('test:pass', (passedTest) => { executedTestFiles.push(passedTest.file); }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream) ; assert.deepStrictEqual(executedTestFiles, [ @@ -555,7 +541,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { } await Promise.all(testStreams.map(async (stream) => { - // eslint-disable-next-line no-unused-vars for await (const _ of stream) ; })); @@ -583,7 +568,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { } await Promise.all(testStreams.map(async (stream) => { - // eslint-disable-next-line no-unused-vars for await (const _ of stream) ; })); @@ -648,7 +632,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { stream.on('test:diagnostic', ({ message }) => { diagnostics.push(message); }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream) ; assert( @@ -744,7 +727,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { }); stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); }); @@ -756,7 +738,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { stream.on('test:pass', common.mustCall(1)); stream.on('test:stderr', (c) => { stderr += c.message; }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); assert.match(stderr, /Warning: node:test run\(\) is being called recursively/); }); @@ -768,7 +749,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(1)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -784,7 +764,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { diagnostics.push(message); }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); for (const entry of [ 'tests 0', @@ -812,7 +791,6 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { diagnostics.push(message); }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); for (const entry of [ 'tests 0', @@ -839,7 +817,6 @@ describe('env', () => { const stream = run({ files: [join(testFixtures, 'process-env.js')], env }); stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(1)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); delete process.env.ABC; }); diff --git a/test/parallel/test-runner-tags-events.mjs b/test/parallel/test-runner-tags-events.mjs index fab32cfe92c0..7691fc2b0bc7 100644 --- a/test/parallel/test-runner-tags-events.mjs +++ b/test/parallel/test-runner-tags-events.mjs @@ -15,7 +15,6 @@ async function collectEvents(opts = {}) { events.push({ kind, name: data.name, tags: data.tags, nesting: data.nesting }); }); } - // eslint-disable-next-line no-unused-vars for await (const _ of stream); return events; } @@ -87,7 +86,6 @@ describe('tag-bearing event payloads', { concurrency: false }, () => { stream.on('test:fail', common.mustNotCall()); // 3 db-tagged tests pass + the db suite itself. stream.on('test:pass', common.mustCall(4)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -98,7 +96,6 @@ describe('tag-bearing event payloads', { concurrency: false }, () => { stream.on('test:fail', common.mustNotCall()); // 3 db-tagged tests pass + the db suite itself. stream.on('test:pass', common.mustCall(4)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); @@ -106,7 +103,6 @@ describe('tag-bearing event payloads', { concurrency: false }, () => { const stream = run({ files: [fixture], testTagFilters: ['not nonexistent'] }); stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(13)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); }); diff --git a/test/parallel/test-runner-tags-validation.mjs b/test/parallel/test-runner-tags-validation.mjs index 3b6138bbf782..345e53b3705f 100644 --- a/test/parallel/test-runner-tags-validation.mjs +++ b/test/parallel/test-runner-tags-validation.mjs @@ -133,12 +133,10 @@ test('run() accepts a bare-string testTagFilters and normalizes it', async () => // The string form is converted to a single-element array internally and // must not throw. const stream = run({ files: [], testTagFilters: 'db' }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); test('run() treats an empty testTagFilters array as a no-op', async () => { const stream = run({ files: [], testTagFilters: [] }); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); }); diff --git a/test/parallel/test-runner-test-rerun-failures.js b/test/parallel/test-runner-test-rerun-failures.js index cdaef0f1d6d3..2d028a0e2557 100644 --- a/test/parallel/test-runner-test-rerun-failures.js +++ b/test/parallel/test-runner-test-rerun-failures.js @@ -284,7 +284,6 @@ test('using `run` api', async () => { stream.on('test:pass', common.mustCall(19)); stream.on('test:fail', common.mustCall(4)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); await setTimeout(common.platformTimeout(10)); // Wait for the stream to finish processing assert.deepStrictEqual(await getStateFile(), expectedStateFile.slice(0, 1)); @@ -294,7 +293,6 @@ test('using `run` api', async () => { stream.on('test:pass', common.mustCall(20)); stream.on('test:fail', common.mustCall(3)); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); await setTimeout(common.platformTimeout(10)); // Wait for the stream to finish processing assert.deepStrictEqual(await getStateFile(), expectedStateFile.slice(0, 2)); @@ -304,7 +302,6 @@ test('using `run` api', async () => { stream.on('test:pass', common.mustCall(23)); stream.on('test:fail', common.mustNotCall()); - // eslint-disable-next-line no-unused-vars for await (const _ of stream); await setTimeout(common.platformTimeout(10)); // Wait for the stream to finish processing assert.deepStrictEqual(await getStateFile(), expectedStateFile); diff --git a/test/parallel/test-sqlite-template-tag.js b/test/parallel/test-sqlite-template-tag.js index 5ecf055523f4..c94d38dd5f62 100644 --- a/test/parallel/test-sqlite-template-tag.js +++ b/test/parallel/test-sqlite-template-tag.js @@ -83,7 +83,6 @@ test('queries with no results', () => { assert.deepStrictEqual(empty, []); let count = 0; - // eslint-disable-next-line no-unused-vars for (const _ of sql.iterate`SELECT * FROM foo WHERE text = ${'notfound'}`) { count++; } diff --git a/test/parallel/test-stream-iter-broadcast-basic.js b/test/parallel/test-stream-iter-broadcast-basic.js index 7b2187f94e32..da38fefa6654 100644 --- a/test/parallel/test-stream-iter-broadcast-basic.js +++ b/test/parallel/test-stream-iter-broadcast-basic.js @@ -189,7 +189,6 @@ async function testWriterFail() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of consumer) { assert.fail('Should not reach here'); } @@ -289,7 +288,6 @@ async function testFailDetachesConsumers() { // Both consumers should see the error await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of consumer1) { assert.fail('Should not reach here'); } @@ -299,7 +297,6 @@ async function testFailDetachesConsumers() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of consumer2) { assert.fail('Should not reach here'); } diff --git a/test/parallel/test-stream-iter-broadcast-from.js b/test/parallel/test-stream-iter-broadcast-from.js index 1d1049083d87..a8806e04ffc1 100644 --- a/test/parallel/test-stream-iter-broadcast-from.js +++ b/test/parallel/test-stream-iter-broadcast-from.js @@ -94,7 +94,6 @@ async function testAbortSignal() { ac.abort(); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of consumer) { assert.fail('Should not reach here'); } @@ -106,7 +105,6 @@ async function testAlreadyAbortedSignal() { const consumer = bc.push(); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of consumer) { assert.fail('Should not reach here'); } diff --git a/test/parallel/test-stream-iter-consumers-merge.js b/test/parallel/test-stream-iter-consumers-merge.js index 9e69d5f7fcb9..51536cc124b3 100644 --- a/test/parallel/test-stream-iter-consumers-merge.js +++ b/test/parallel/test-stream-iter-consumers-merge.js @@ -61,7 +61,6 @@ async function testMergeWithAbortSignal() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of merged) { assert.fail('Should not reach here'); } @@ -228,7 +227,6 @@ async function testMergeConsumerBreak() { source2Return = true; } } - // eslint-disable-next-line no-unused-vars for await (const _ of merge(source1(), source2())) { break; // Break after first batch } @@ -431,7 +429,6 @@ async function testMergeBreakWithCleanupError() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of merge(failingReturnSource())) { break; } @@ -452,7 +449,6 @@ async function testMergeMultiSourceBreakWithCleanupError() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of merge(failingReturnSource(), from('other'))) { break; } diff --git a/test/parallel/test-stream-iter-consumers-tap.js b/test/parallel/test-stream-iter-consumers-tap.js index a82339d80252..e7e867002d8a 100644 --- a/test/parallel/test-stream-iter-consumers-tap.js +++ b/test/parallel/test-stream-iter-consumers-tap.js @@ -94,7 +94,6 @@ async function testTapAsyncErrorPropagation() { function testTapSyncErrorPropagation() { const badTap = tapSync(() => { throw new Error('tapSync error'); }); assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of pullSync(fromSync('hello'), badTap)) { /* consume */ } }, { message: 'tapSync error' }); } diff --git a/test/parallel/test-stream-iter-duplex.js b/test/parallel/test-stream-iter-duplex.js index d06b394d0aa8..fd2e89d3c40f 100644 --- a/test/parallel/test-stream-iter-duplex.js +++ b/test/parallel/test-stream-iter-duplex.js @@ -139,7 +139,6 @@ async function testAbortSignal() { // Both directions should error await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of channelA.readable) { assert.fail('Should not reach here'); } @@ -218,14 +217,12 @@ async function testAbortSignalBothChannels() { ac.abort(); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of channelA.readable) { assert.fail('Should not reach here'); } }, (err) => err.name === 'AbortError'); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of channelB.readable) { assert.fail('Should not reach here'); } diff --git a/test/parallel/test-stream-iter-from-sync.js b/test/parallel/test-stream-iter-from-sync.js index f6b2b0a5f84a..db67f0b440fd 100644 --- a/test/parallel/test-stream-iter-from-sync.js +++ b/test/parallel/test-stream-iter-from-sync.js @@ -116,7 +116,6 @@ function testFromSyncGeneratorError() { } const readable = fromSync(gen()); assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of readable) { /* consume */ } }, { message: 'generator boom' }); } @@ -135,7 +134,6 @@ function testFromSyncRejectsNonStreamable() { function testFromSyncEmptyGenerator() { function* empty() {} let count = 0; - // eslint-disable-next-line no-unused-vars for (const _ of fromSync(empty())) { count++; } assert.strictEqual(count, 0); } diff --git a/test/parallel/test-stream-iter-pull-async.js b/test/parallel/test-stream-iter-pull-async.js index 53480cb653df..611a8b271f93 100644 --- a/test/parallel/test-stream-iter-pull-async.js +++ b/test/parallel/test-stream-iter-pull-async.js @@ -504,7 +504,6 @@ async function testPullConsumerBreakCleanup() { } } // Consumer breaks after first chunk - // eslint-disable-next-line no-unused-vars for await (const _ of pull(infiniteSource(), trackingTransform)) { break; } @@ -841,7 +840,6 @@ async function testTransformErrorClosesSource() { for (const transform of [fail, async (chunks) => fail(chunks)]) { const log = []; await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of pull(createLoggedSource(log, [1, 2, 3]), createLoggedTransform(log, transform))); }, /transform failed/); @@ -855,7 +853,6 @@ async function testTransformErrorClosesSource() { async function testTransformSourceErrorDoesNotCloseSource() { const log = []; await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of pull(createLoggedSource(log, [1], { failAt: 1 }), createLoggedTransform(log))); }, /source failed/); diff --git a/test/parallel/test-stream-iter-pull-sync.js b/test/parallel/test-stream-iter-pull-sync.js index af481dbfa137..65c8249bb018 100644 --- a/test/parallel/test-stream-iter-pull-sync.js +++ b/test/parallel/test-stream-iter-pull-sync.js @@ -109,7 +109,6 @@ function testPullSyncSourceError() { throw new Error('sync source boom'); } assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of pullSync(failingSource())) { /* consume */ } }, { message: 'sync source boom' }); } @@ -125,7 +124,6 @@ function testPullSyncEmptySource() { function testTapSyncCallbackError() { const badTap = tapSync(() => { throw new Error('tapSync boom'); }); assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of pullSync(fromSync('hello'), badTap)) { /* consume */ } }, { message: 'tapSync boom' }); } @@ -137,7 +135,6 @@ function testPullSyncStatelessTransformError() { throw new Error('stateless transform boom'); }; assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of pullSync(fromSync('hello'), badTransform)) { /* consume */ } }, { message: 'stateless transform boom' }); } @@ -153,7 +150,6 @@ function testPullSyncStatefulTransformError() { }, }; assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of pullSync(fromSync('hello'), badStateful)) { /* consume */ } }, { message: 'stateful transform boom' }); } @@ -194,7 +190,6 @@ function testPullSyncStatelessTransformFlushError() { return chunks; }; assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of pullSync(fromSync('hello'), badFlush)) { /* consume */ } }, { message: 'flush boom' }); } @@ -210,11 +205,11 @@ function testPullSyncEmptySourceType() { // Invalid transform argument function testPullSyncInvalidTransform() { assert.throws( - () => { for (const _ of pullSync(fromSync('x'), 42)) { /* consume */ } }, // eslint-disable-line no-unused-vars + () => { for (const _ of pullSync(fromSync('x'), 42)) { /* consume */ } }, { code: 'ERR_INVALID_ARG_TYPE' }, ); assert.throws( - () => { for (const _ of pullSync(fromSync('x'), null)) { /* consume */ } }, // eslint-disable-line no-unused-vars + () => { for (const _ of pullSync(fromSync('x'), null)) { /* consume */ } }, { code: 'ERR_INVALID_ARG_TYPE' }, ); } diff --git a/test/parallel/test-stream-iter-push-basic.js b/test/parallel/test-stream-iter-push-basic.js index ad7eab5f53a4..dbf21e71981e 100644 --- a/test/parallel/test-stream-iter-push-basic.js +++ b/test/parallel/test-stream-iter-push-basic.js @@ -64,7 +64,6 @@ async function testWriterFail() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of readable) { assert.fail('Should not reach here'); } @@ -81,7 +80,6 @@ async function testConsumerBreak() { writer.writeSync('c'); // Break after first batch - // eslint-disable-next-line no-unused-vars for await (const _ of readable) { break; } @@ -98,7 +96,6 @@ async function testAbortSignal() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of readable) { assert.fail('Should not reach here'); } @@ -120,7 +117,6 @@ async function testAbortSignalReason() { async function testPreAbortedSignal() { const { readable } = push({ signal: AbortSignal.abort() }); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of readable) { assert.fail('Should not reach here'); } @@ -132,7 +128,6 @@ async function testConsumerBreakWriteSyncReturnsFalse() { writer.writeSync('a'); // Break after first batch - // eslint-disable-next-line no-unused-vars for await (const _ of readable) { break; } diff --git a/test/parallel/test-stream-iter-push-writer.js b/test/parallel/test-stream-iter-push-writer.js index 0278ce569b9d..48c046ac5309 100644 --- a/test/parallel/test-stream-iter-push-writer.js +++ b/test/parallel/test-stream-iter-push-writer.js @@ -623,7 +623,6 @@ async function testEndRejectsWhenErrored() { ); // Drain readable try { - // eslint-disable-next-line no-unused-vars for await (const _ of readable) { break; } } catch { // Expected - reader may see the error diff --git a/test/parallel/test-stream-iter-share-async.js b/test/parallel/test-stream-iter-share-async.js index 11df7c9bfa56..4326b55631b9 100644 --- a/test/parallel/test-stream-iter-share-async.js +++ b/test/parallel/test-stream-iter-share-async.js @@ -124,7 +124,6 @@ async function testShareCancelWithReason() { await assert.rejects( async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of consumer) { assert.fail('Should not reach here'); } @@ -307,7 +306,6 @@ async function testShareAlreadyAborted() { const consumer = shared.pull(); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of consumer) { assert.fail('Should not reach here'); } @@ -452,7 +450,6 @@ async function testShareConsumerBreak() { assert.strictEqual(shared.consumerCount, 2); // c1 breaks after first batch - // eslint-disable-next-line no-unused-vars for await (const _ of c1) { break; } diff --git a/test/parallel/test-stream-iter-share-sync.js b/test/parallel/test-stream-iter-share-sync.js index a843e7311dd1..739ede0555b1 100644 --- a/test/parallel/test-stream-iter-share-sync.js +++ b/test/parallel/test-stream-iter-share-sync.js @@ -130,11 +130,9 @@ function testShareSyncSourceError() { // Both consumers should see the error assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of c1) { /* consume */ } }, { message: 'sync share boom' }); assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of c2) { /* consume */ } }, { message: 'sync share boom' }); } @@ -218,7 +216,6 @@ function testShareSyncStrictForOfDoesNotWedgeOthers() { const shared = shareSync(source(), { budget: 16384, backpressure: 'strict' }); const slow = shared.pull()[Symbol.iterator](); assert.throws(() => { - // eslint-disable-next-line no-unused-vars for (const _ of shared.pull()) { /* consume */ } }, { code: 'ERR_OUT_OF_RANGE' }); assert.strictEqual(shared.consumerCount, 1); diff --git a/test/parallel/test-stream-map.js b/test/parallel/test-stream-map.js index be2628c41825..68d7d410722a 100644 --- a/test/parallel/test-stream-map.js +++ b/test/parallel/test-stream-map.js @@ -328,7 +328,6 @@ function createDependentPromises(n) { return item; }, { concurrency: 2 }) .map((item) => { - // eslint-disable-next-line no-unused-vars for (const [_, resolve] of promises) { resolve(); } diff --git a/test/parallel/test-stream-pipe-objectmode-to-non-objectmode.js b/test/parallel/test-stream-pipe-objectmode-to-non-objectmode.js index 71fbf1412484..f97f083d6980 100644 --- a/test/parallel/test-stream-pipe-objectmode-to-non-objectmode.js +++ b/test/parallel/test-stream-pipe-objectmode-to-non-objectmode.js @@ -24,7 +24,6 @@ const { Readable, Transform, Writable } = require('node:stream'); objectReadable.pipe(passThrough); assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of passThrough); }, /ERR_INVALID_ARG_TYPE/).then(common.mustCall()); } diff --git a/test/parallel/test-stream-readable-to-web.mjs b/test/parallel/test-stream-readable-to-web.mjs index 8ff9f2fb16ed..e051b26b85e7 100644 --- a/test/parallel/test-stream-readable-to-web.mjs +++ b/test/parallel/test-stream-readable-to-web.mjs @@ -47,7 +47,6 @@ try { timeout = setTimeout(mustCall(async () => { // Did the stream leak memory? checkMemoryUsage(); - // eslint-disable-next-line no-unused-vars for await (const _ of randomWebStream) { // Yield event loop to allow garbage collection await setImmediate(); diff --git a/test/parallel/test-timers-interval-promisified.js b/test/parallel/test-timers-interval-promisified.js index c31b5af7f271..16233647fb60 100644 --- a/test/parallel/test-timers-interval-promisified.js +++ b/test/parallel/test-timers-interval-promisified.js @@ -132,7 +132,6 @@ const { setInterval } = timerPromises; async function tryBreak() { const iterator = setInterval(10, undefined, { signal }); let i = 0; - // eslint-disable-next-line no-unused-vars for await (const _ of iterator) { if (i === 0) { assert.strictEqual(listenerCount(signal, 'abort'), 1); @@ -248,7 +247,7 @@ const { setInterval } = timerPromises; await assert.rejects(async () => { const iterable = timerPromises.setInterval(2, undefined, { signal }); - // eslint-disable-next-line no-unused-vars, no-empty + // eslint-disable-next-line no-empty for await (const _ of iterable) { } }, { cause: 'boom' }, 'should have failed'); })().then(common.mustCall()); diff --git a/test/parallel/test-vfs-dir-handle.js b/test/parallel/test-vfs-dir-handle.js index 8bbd51fd70e0..68306ed35c47 100644 --- a/test/parallel/test-vfs-dir-handle.js +++ b/test/parallel/test-vfs-dir-handle.js @@ -88,7 +88,6 @@ myVfs.opendir('/d', common.mustSucceed((dir) => { // entries() iteration on a closed dir rejects with ERR_DIR_CLOSED (async () => { await assert.rejects( - // eslint-disable-next-line no-unused-vars (async () => { for await (const _ of dir.entries()); })(), { code: 'ERR_DIR_CLOSED' }); })().then(common.mustCall()); diff --git a/test/parallel/test-whatwg-readablebytestream.js b/test/parallel/test-whatwg-readablebytestream.js index 2207cb0cf43b..ef593d898bad 100644 --- a/test/parallel/test-whatwg-readablebytestream.js +++ b/test/parallel/test-whatwg-readablebytestream.js @@ -172,7 +172,6 @@ class Source { assert(stream[kState].controller instanceof ReadableByteStreamController); async function read(stream) { - // eslint-disable-next-line no-unused-vars for await (const _ of stream) break; } @@ -187,7 +186,6 @@ class Source { const error = new Error('boom'); async function read(stream) { - // eslint-disable-next-line no-unused-vars for await (const _ of stream) throw error; } diff --git a/test/parallel/test-whatwg-readablestream-pipeto-async-context.js b/test/parallel/test-whatwg-readablestream-pipeto-async-context.js index 5a096e3097a2..490a37cb5764 100644 --- a/test/parallel/test-whatwg-readablestream-pipeto-async-context.js +++ b/test/parallel/test-whatwg-readablestream-pipeto-async-context.js @@ -109,7 +109,6 @@ test('pipeThrough() with pulls resolved from another context', [ }, }))); const consumed = als.run('reader', async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of readable); }); await settleUntil(consumed, 'resolver', pending); diff --git a/test/parallel/test-whatwg-readablestream.js b/test/parallel/test-whatwg-readablestream.js index 0105d4bf723b..f00914873723 100644 --- a/test/parallel/test-whatwg-readablestream.js +++ b/test/parallel/test-whatwg-readablestream.js @@ -1308,7 +1308,7 @@ class Source { async function read(stream) { for await (const _ of stream.values({ preventCancel: true })) - return; + break; } read(stream).then(common.mustCall((data) => { @@ -1322,7 +1322,7 @@ class Source { async function read(stream) { for await (const _ of stream.values({ preventCancel: false })) - return; + break; } read(stream).then(common.mustCall((data) => { @@ -1337,7 +1337,6 @@ class Source { const error = new Error('boom'); async function read(stream) { - // eslint-disable-next-line no-unused-vars for await (const _ of stream.values({ preventCancel: true })) throw error; } @@ -1354,7 +1353,6 @@ class Source { const error = new Error('boom'); async function read(stream) { - // eslint-disable-next-line no-unused-vars for await (const _ of stream.values({ preventCancel: false })) throw error; } diff --git a/test/parallel/test-whatwg-transformstream-parked-write-async-context.js b/test/parallel/test-whatwg-transformstream-parked-write-async-context.js index a5db0afdec42..25af87bacaf1 100644 --- a/test/parallel/test-whatwg-transformstream-parked-write-async-context.js +++ b/test/parallel/test-whatwg-transformstream-parked-write-async-context.js @@ -30,7 +30,6 @@ function createPipeline(seen) { } async function consume(readable) { - // eslint-disable-next-line no-unused-vars for await (const _ of readable); } diff --git a/test/parallel/test-whatwg-webstreams-async-context.js b/test/parallel/test-whatwg-webstreams-async-context.js index 82384a0975b8..fa8b529c1f03 100644 --- a/test/parallel/test-whatwg-webstreams-async-context.js +++ b/test/parallel/test-whatwg-webstreams-async-context.js @@ -18,7 +18,6 @@ function store() { } async function consume(readable) { - // eslint-disable-next-line no-unused-vars for await (const _ of readable); } @@ -64,7 +63,6 @@ test('ReadableStream pull to fill the queue', [ }, { highWaterMark: 2 })); await tick(); await als.run('reader', async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of rs) seen.push(`chunk:${store()}`); }); }); diff --git a/test/parallel/test-zlib-zip-security-hardening.js b/test/parallel/test-zlib-zip-security-hardening.js index 32c228d2b128..8b62ef8114d0 100644 --- a/test/parallel/test-zlib-zip-security-hardening.js +++ b/test/parallel/test-zlib-zip-security-hardening.js @@ -224,7 +224,6 @@ test('contentIterator rejects a member that inflates past its declared size', as buf.writeUInt32LE(100, c + 24); // Central uncompressed size const entry = new zlib.ZipBuffer(buf).get('big'); await assert.rejects(async () => { - // eslint-disable-next-line no-unused-vars for await (const _ of entry.contentIterator()) { /* drain */ } }, { code: 'ERR_ZIP_ENTRY_CORRUPT', message: /inflates beyond its declared size/ }); }); diff --git a/test/test-runner/test-run-watch-cwd-isolation-process.mjs b/test/test-runner/test-run-watch-cwd-isolation-process.mjs index 428fac1c1336..330f15c5d4ef 100644 --- a/test/test-runner/test-run-watch-cwd-isolation-process.mjs +++ b/test/test-runner/test-run-watch-cwd-isolation-process.mjs @@ -33,5 +33,4 @@ const stream = run({ stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(1)); -// eslint-disable-next-line no-unused-vars for await (const _ of stream); diff --git a/test/test-runner/test-run-watch-cwd.mjs b/test/test-runner/test-run-watch-cwd.mjs index b3faa65399bb..4ac977cfcbf8 100644 --- a/test/test-runner/test-run-watch-cwd.mjs +++ b/test/test-runner/test-run-watch-cwd.mjs @@ -22,5 +22,4 @@ const stream = run({ stream.on('test:fail', common.mustNotCall()); stream.on('test:pass', common.mustCall(1)); -// eslint-disable-next-line no-unused-vars for await (const _ of stream); diff --git a/test/test-runner/test-run-watch-emit-restarted.mjs b/test/test-runner/test-run-watch-emit-restarted.mjs index fd4b6b1b32b0..365f4150620f 100644 --- a/test/test-runner/test-run-watch-emit-restarted.mjs +++ b/test/test-runner/test-run-watch-emit-restarted.mjs @@ -36,7 +36,6 @@ events.length = 0; written = true; writeFileSync(tmpdir.resolve('test.js'), fixtureContent['test.js']); -// eslint-disable-next-line no-unused-vars for await (const _ of stream); assert.deepStrictEqual(events.slice(-2), ['test:watch:restarted', 'test:watch:drained']); diff --git a/test/test-runner/test-run-watch-no-emit-restarted-disabled.mjs b/test/test-runner/test-run-watch-no-emit-restarted-disabled.mjs index 7623ad1aca31..a0d4c1da6e0a 100644 --- a/test/test-runner/test-run-watch-no-emit-restarted-disabled.mjs +++ b/test/test-runner/test-run-watch-no-emit-restarted-disabled.mjs @@ -16,5 +16,4 @@ const stream = run({ stream.on('test:watch:restarted', common.mustNotCall()); writeFileSync(tmpdir.resolve('test.js'), fixtureContent['test.js']); -// eslint-disable-next-line no-unused-vars for await (const _ of stream); From 249d608d28a504fd9c605fb36f3e897227be8b99 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 30 Nov 2026 11:08:42 +0100 Subject: [PATCH 2/2] fixup! tools: allow unused variables named only with underscores --- benchmark/es/foreach-bench.js | 10 ++++---- benchmark/fs/bench-opendir.js | 3 +-- lib/diagnostics_channel.js | 24 +++++++------------- lib/internal/streams/operators.js | 3 +-- lib/internal/test_runner/mock/mock_timers.js | 6 ++--- 5 files changed, 16 insertions(+), 30 deletions(-) diff --git a/benchmark/es/foreach-bench.js b/benchmark/es/foreach-bench.js index 63280d1c9a9d..fde29dee4249 100644 --- a/benchmark/es/foreach-bench.js +++ b/benchmark/es/foreach-bench.js @@ -12,8 +12,7 @@ function useFor(n, items, count) { bench.start(); for (let i = 0; i < n; i++) { for (let j = 0; j < count; j++) { - // eslint-disable-next-line no-unused-vars - const item = items[j]; + const _ = items[j]; } } bench.end(n); @@ -22,8 +21,8 @@ function useFor(n, items, count) { function useForOf(n, items) { bench.start(); for (let i = 0; i < n; i++) { - // eslint-disable-next-line no-unused-vars, no-empty - for (const item of items) {} + // eslint-disable-next-line no-empty + for (const _ of items) {} } bench.end(n); } @@ -32,8 +31,7 @@ function useForIn(n, items) { bench.start(); for (let i = 0; i < n; i++) { for (const j in items) { - // eslint-disable-next-line no-unused-vars - const item = items[j]; + const _ = items[j]; } } bench.end(n); diff --git a/benchmark/fs/bench-opendir.js b/benchmark/fs/bench-opendir.js index 77ea471fa548..e6471f184260 100644 --- a/benchmark/fs/bench-opendir.js +++ b/benchmark/fs/bench-opendir.js @@ -20,8 +20,7 @@ async function main({ n, dir, mode, bufferSize }) { for (let i = 0; i < n; i++) { if (mode === 'async') { const dir = await fs.promises.opendir(fullPath, { bufferSize }); - // eslint-disable-next-line no-unused-vars - for await (const entry of dir) + for await (const _ of dir) counter++; } else if (mode === 'callback') { const dir = await fs.promises.opendir(fullPath, { bufferSize }); diff --git a/lib/diagnostics_channel.js b/lib/diagnostics_channel.js index 61d310d383a9..89fac3fa84e1 100644 --- a/lib/diagnostics_channel.js +++ b/lib/diagnostics_channel.js @@ -208,8 +208,7 @@ class ActiveChannel { } runStores(data, fn, thisArg, ...args) { - // eslint-disable-next-line no-unused-vars - using scope = this.withStoreScope(data); + using _ = this.withStoreScope(data); return ReflectApply(fn, thisArg, args); } } @@ -406,8 +405,7 @@ class BoundedChannel { run(context, fn, thisArg, ...args) { context ??= {}; - // eslint-disable-next-line no-unused-vars - using scope = this.withScope(context); + using _ = this.withScope(context); return ReflectApply(fn, thisArg, args); } } @@ -535,8 +533,7 @@ class TracingChannel { const { error } = this; - // eslint-disable-next-line no-unused-vars - using scope = this.#callWindow.withScope(context); + using _ = this.#callWindow.withScope(context); try { const result = ReflectApply(fn, thisArg, args); context.result = result; @@ -568,8 +565,7 @@ class TracingChannel { context.error = err; error.publish(context); // Use continuation window for asyncStart/asyncEnd - // eslint-disable-next-line no-unused-vars - using scope = continuationWindow.withScope(context); + using _ = continuationWindow.withScope(context); // TODO: Is there a way to have asyncEnd _after_ the continuation? } @@ -581,14 +577,12 @@ class TracingChannel { function onResolve(result) { context.result = result; // Use continuation window for asyncStart/asyncEnd - // eslint-disable-next-line no-unused-vars - using scope = continuationWindow.withScope(context); + using _ = continuationWindow.withScope(context); // TODO: Is there a way to have asyncEnd _after_ the continuation? return result; } - // eslint-disable-next-line no-unused-vars - using scope = this.#callWindow.withScope(context); + using _ = this.#callWindow.withScope(context); try { const result = ReflectApply(fn, thisArg, args); // If the return value is not a thenable, return it directly with a warning. @@ -637,8 +631,7 @@ class TracingChannel { } // Use continuation window for asyncStart/asyncEnd around callback - // eslint-disable-next-line no-unused-vars - using scope = continuationWindow.withScope(context); + using _ = continuationWindow.withScope(context); return ReflectApply(callback, this, arguments); } @@ -646,8 +639,7 @@ class TracingChannel { validateFunction(callback, 'callback'); ArrayPrototypeSplice(args, position, 1, wrappedCallback); - // eslint-disable-next-line no-unused-vars - using scope = this.#callWindow.withScope(context); + using _ = this.#callWindow.withScope(context); try { return ReflectApply(fn, thisArg, args); } catch (err) { diff --git a/lib/internal/streams/operators.js b/lib/internal/streams/operators.js index 1cd4d7aa8951..e87cc7204f7f 100644 --- a/lib/internal/streams/operators.js +++ b/lib/internal/streams/operators.js @@ -220,8 +220,7 @@ async function forEach(fn, options) { await fn(value, options); return kEmpty; } - // eslint-disable-next-line no-unused-vars - for await (const unused of map.call(this, forEachFn, options)); + for await (const _ of map.call(this, forEachFn, options)); } function filter(fn, options) { diff --git a/lib/internal/test_runner/mock/mock_timers.js b/lib/internal/test_runner/mock/mock_timers.js index 1e425b606ee5..a8e88c0f2e02 100644 --- a/lib/internal/test_runner/mock/mock_timers.js +++ b/lib/internal/test_runner/mock/mock_timers.js @@ -409,8 +409,7 @@ class MockTimers { } // Prototype is read-only, and non assignable through Object.defineProperties - // eslint-disable-next-line no-unused-vars -- used to get the prototype out of the object - const { prototype, ...dateProps } = ObjectGetOwnPropertyDescriptors(NativeDateConstructor); + const { prototype: _, ...dateProps } = ObjectGetOwnPropertyDescriptors(NativeDateConstructor); // Binds all the properties of Date to the MockDate function ObjectDefineProperties( @@ -478,8 +477,7 @@ class MockTimers { options); try { - // eslint-disable-next-line no-unused-vars - for await (const event of eventIt) { + for await (const _ of eventIt) { yield result; } } finally {