From 2115a8ea9d12caa43ee427d232b7b54a10f04485 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 2 Jan 2022 20:21:46 -0800 Subject: [PATCH] tools,benchmark,lib,test: enable no-case-declarations lint rule --- .eslintrc.js | 1 + benchmark/zlib/inflate.js | 6 +++-- lib/_http_server.js | 3 ++- .../bootstrap/switches/is_main_thread.js | 24 ++++++++++++------- lib/internal/crypto/aes.js | 3 ++- lib/internal/crypto/webcrypto.js | 3 ++- lib/internal/error_serdes.js | 6 +++-- lib/internal/http2/compat.js | 15 ++++++++---- lib/internal/http2/core.js | 15 ++++++++---- lib/internal/repl/utils.js | 3 ++- lib/internal/util/inspect.js | 12 ++++++---- test/addons/worker-addon/test.js | 3 ++- test/async-hooks/test-callback-error.js | 3 ++- test/common/dns.js | 3 ++- .../test-child-process-spawnsync-timeout.js | 3 ++- test/parallel/test-cluster-basic.js | 4 ++-- test/parallel/test-fs-write-stream-err.js | 3 ++- test/parallel/test-http-mutable-headers.js | 4 ++-- test/parallel/test-http-response-splitting.js | 3 ++- .../parallel/test-http2-response-splitting.js | 3 ++- test/parallel/test-pending-deprecation.js | 3 ++- test/parallel/test-stdio-pipe-access.js | 3 ++- test/parallel/test-stdio-pipe-redirect.js | 6 +++-- test/parallel/test-trace-events-api.js | 6 +++-- test/sequential/test-tls-securepair-client.js | 4 ++-- tools/doc/json.mjs | 4 ++-- 26 files changed, 95 insertions(+), 51 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index b630e21b5565d1..5f1d0894373cae 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -175,6 +175,7 @@ module.exports = { }], 'new-parens': 'error', 'no-async-promise-executor': 'error', + 'no-case-declarations': 'error', 'no-class-assign': 'error', 'no-confusing-arrow': 'error', 'no-const-assign': 'error', diff --git a/benchmark/zlib/inflate.js b/benchmark/zlib/inflate.js index 09379c00c1250b..e4642b394468a9 100644 --- a/benchmark/zlib/inflate.js +++ b/benchmark/zlib/inflate.js @@ -16,7 +16,7 @@ function main({ n, method, inputLen }) { let i = 0; switch (method) { // Performs `n` single inflate operations - case 'inflate': + case 'inflate': { const inflate = zlib.inflate; bench.start(); (function next(err, result) { @@ -25,14 +25,16 @@ function main({ n, method, inputLen }) { inflate(chunk, next); })(); break; + } // Performs `n` single inflateSync operations - case 'inflateSync': + case 'inflateSync': { const inflateSync = zlib.inflateSync; bench.start(); for (; i < n; ++i) inflateSync(chunk); bench.end(n); break; + } default: throw new Error('Unsupported inflate method'); } diff --git a/lib/_http_server.js b/lib/_http_server.js index 0d06919ea017a4..fc615667fe67f5 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -411,7 +411,7 @@ Server.prototype.setTimeout = function setTimeout(msecs, callback) { Server.prototype[EE.captureRejectionSymbol] = function(err, event, ...args) { switch (event) { - case 'request': + case 'request': { const { 1: res } = args; if (!res.headersSent && !res.writableEnded) { // Don't leak headers. @@ -425,6 +425,7 @@ Server.prototype[EE.captureRejectionSymbol] = function(err, event, ...args) { res.destroy(); } break; + } default: net.Server.prototype[SymbolFor('nodejs.rejection')] .apply(this, arguments); diff --git a/lib/internal/bootstrap/switches/is_main_thread.js b/lib/internal/bootstrap/switches/is_main_thread.js index 404b6e4c7d7ffd..606da95f21ca8f 100644 --- a/lib/internal/bootstrap/switches/is_main_thread.js +++ b/lib/internal/bootstrap/switches/is_main_thread.js @@ -42,20 +42,22 @@ function createWritableStdioStream(fd) { let stream; // Note stream._type is used for test-module-load-list.js switch (guessHandleType(fd)) { - case 'TTY': + case 'TTY': { const tty = require('tty'); stream = new tty.WriteStream(fd); stream._type = 'tty'; break; + } - case 'FILE': + case 'FILE': { const SyncWriteStream = require('internal/fs/sync_write_stream'); stream = new SyncWriteStream(fd, { autoClose: false }); stream._type = 'fs'; break; + } case 'PIPE': - case 'TCP': + case 'TCP': { const net = require('net'); // If fd is already being used for the IPC channel, libuv will return @@ -78,8 +80,9 @@ function createWritableStdioStream(fd) { stream._type = 'pipe'; break; + } - default: + default: { // Provide a dummy black-hole output for e.g. non-console // Windows applications. const { Writable } = require('stream'); @@ -88,6 +91,7 @@ function createWritableStdioStream(fd) { cb(); } }); + } } // For supporting legacy API we put the FD here. @@ -147,18 +151,20 @@ function getStdin() { const fd = 0; switch (guessHandleType(fd)) { - case 'TTY': + case 'TTY': { const tty = require('tty'); stdin = new tty.ReadStream(fd); break; + } - case 'FILE': + case 'FILE': { const fs = require('fs'); stdin = new fs.ReadStream(null, { fd: fd, autoClose: false }); break; + } case 'PIPE': - case 'TCP': + case 'TCP': { const net = require('net'); // It could be that process has been started with an IPC channel @@ -183,13 +189,15 @@ function getStdin() { // Make sure the stdin can't be `.end()`-ed stdin._writableState.ended = true; break; + } - default: + default: { // Provide a dummy contentless input for e.g. non-console // Windows applications. const { Readable } = require('stream'); stdin = new Readable({ read() {} }); stdin.push(null); + } } // For supporting legacy API we put the FD here. diff --git a/lib/internal/crypto/aes.js b/lib/internal/crypto/aes.js index 0675c59ec368ca..9136913b7b9d14 100644 --- a/lib/internal/crypto/aes.js +++ b/lib/internal/crypto/aes.js @@ -189,7 +189,7 @@ function asyncAesGcmCipher( const tagByteLength = MathFloor(tagLength / 8); let tag; switch (mode) { - case kWebCryptoCipherDecrypt: + case kWebCryptoCipherDecrypt: { const slice = ArrayBufferIsView(data) ? TypedArrayPrototypeSlice : ArrayBufferPrototypeSlice; tag = slice(data, -tagByteLength); @@ -206,6 +206,7 @@ function asyncAesGcmCipher( data = slice(data, 0, -tagByteLength); break; + } case kWebCryptoCipherEncrypt: tag = tagByteLength; break; diff --git a/lib/internal/crypto/webcrypto.js b/lib/internal/crypto/webcrypto.js index 0edd5c2cd3f131..501ea38fd35104 100644 --- a/lib/internal/crypto/webcrypto.js +++ b/lib/internal/crypto/webcrypto.js @@ -427,7 +427,7 @@ async function importGenericSecretKey( break; } - case 'raw': + case 'raw': { if (hasAnyNotIn(usagesSet, ['deriveKey', 'deriveBits'])) { throw lazyDOMException( `Unsupported key usage for a ${name} key`, @@ -449,6 +449,7 @@ async function importGenericSecretKey( const keyObject = createSecretKey(keyData); return new InternalCryptoKey(keyObject, { name }, keyUsages, false); + } } throw lazyDOMException( diff --git a/lib/internal/error_serdes.js b/lib/internal/error_serdes.js index 47392752df6318..6a2081b8e2d4ff 100644 --- a/lib/internal/error_serdes.js +++ b/lib/internal/error_serdes.js @@ -120,7 +120,7 @@ let deserialize; function deserializeError(error) { if (!deserialize) deserialize = require('v8').deserialize; switch (error[0]) { - case kSerializedError: + case kSerializedError: { const { constructor, properties } = deserialize(error.subarray(1)); const ctor = errors[constructor]; ObjectDefineProperty(properties, SymbolToStringTag, { @@ -128,13 +128,15 @@ function deserializeError(error) { enumerable: true }); return ObjectCreate(ctor.prototype, properties); + } case kSerializedObject: return deserialize(error.subarray(1)); - case kInspectedError: + case kInspectedError: { const buf = Buffer.from(error.buffer, error.byteOffset + 1, error.byteLength - 1); return buf.toString('utf8'); + } } require('assert').fail('This should not happen'); } diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js index a1ee6cdbbc7777..0c4519dfff5986 100644 --- a/lib/internal/http2/compat.js +++ b/lib/internal/http2/compat.js @@ -217,28 +217,31 @@ const proxySocketHandler = { case 'writable': case 'destroyed': return stream[prop]; - case 'readable': + case 'readable': { if (stream.destroyed) return false; const request = stream[kRequest]; return request ? request.readable : stream.readable; - case 'setTimeout': + } + case 'setTimeout': { const session = stream.session; if (session !== undefined) return FunctionPrototypeBind(session.setTimeout, session); return FunctionPrototypeBind(stream.setTimeout, stream); + } case 'write': case 'read': case 'pause': case 'resume': throw new ERR_HTTP2_NO_SOCKET_MANIPULATION(); - default: + default: { const ref = stream.session !== undefined ? stream.session[kSocket] : stream; const value = ref[prop]; return typeof value === 'function' ? FunctionPrototypeBind(value, ref) : value; + } } }, getPrototypeOf(stream) { @@ -258,23 +261,25 @@ const proxySocketHandler = { case 'destroy': stream[prop] = value; return true; - case 'setTimeout': + case 'setTimeout': { const session = stream.session; if (session !== undefined) session.setTimeout = value; else stream.setTimeout = value; return true; + } case 'write': case 'read': case 'pause': case 'resume': throw new ERR_HTTP2_NO_SOCKET_MANIPULATION(); - default: + default: { const ref = stream.session !== undefined ? stream.session[kSocket] : stream; ref[prop] = value; return true; + } } } }; diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js index c5bee6d405e495..c486676f72a2bd 100644 --- a/lib/internal/http2/core.js +++ b/lib/internal/http2/core.js @@ -867,7 +867,7 @@ const proxySocketHandler = { case 'setKeepAlive': case 'setNoDelay': throw new ERR_HTTP2_NO_SOCKET_MANIPULATION(); - default: + default: { const socket = session[kSocket]; if (socket === undefined) throw new ERR_HTTP2_SOCKET_UNBOUND(); @@ -875,6 +875,7 @@ const proxySocketHandler = { return typeof value === 'function' ? FunctionPrototypeBind(value, socket) : value; + } } }, getPrototypeOf(session) { @@ -901,12 +902,13 @@ const proxySocketHandler = { case 'setKeepAlive': case 'setNoDelay': throw new ERR_HTTP2_NO_SOCKET_MANIPULATION(); - default: + default: { const socket = session[kSocket]; if (socket === undefined) throw new ERR_HTTP2_SOCKET_UNBOUND(); socket[prop] = value; return true; + } } } }; @@ -1558,10 +1560,11 @@ class Http2Session extends EventEmitter { [EventEmitter.captureRejectionSymbol](err, event, ...args) { switch (event) { - case 'stream': + case 'stream': { const stream = args[0]; stream.destroy(err); break; + } default: this.destroy(err); } @@ -3184,7 +3187,7 @@ Http2Server.prototype[EventEmitter.captureRejectionSymbol] = function( err, event, ...args) { switch (event) { - case 'stream': + case 'stream': { // TODO(mcollina): we might want to match this with what we do on // the compat side. const { 0: stream } = args; @@ -3195,7 +3198,8 @@ Http2Server.prototype[EventEmitter.captureRejectionSymbol] = function( stream.end(); } break; - case 'request': + } + case 'request': { const { 1: res } = args; if (!res.headersSent && !res.finished) { // Don't leak headers. @@ -3208,6 +3212,7 @@ Http2Server.prototype[EventEmitter.captureRejectionSymbol] = function( res.destroy(); } break; + } default: ArrayPrototypeUnshift(args, err, event); ReflectApply(net.Server.prototype[EventEmitter.captureRejectionSymbol], diff --git a/lib/internal/repl/utils.js b/lib/internal/repl/utils.js index 4ee177f6eb02bd..ee8c54be5bb5c3 100644 --- a/lib/internal/repl/utils.js +++ b/lib/internal/repl/utils.js @@ -110,7 +110,7 @@ function isRecoverableError(e, code) { recoverable = true; break; - case 'Unterminated string constant': + case 'Unterminated string constant': { const token = StringPrototypeSlice(this.input, this.lastTokStart, this.pos); // See https://www.ecma-international.org/ecma-262/#sec-line-terminators @@ -118,6 +118,7 @@ function isRecoverableError(e, code) { token)) { recoverable = true; } + } } super.raise(pos, message); } diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index ceaf8e133788ca..3e2309a00bcb91 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -2061,7 +2061,7 @@ function formatWithOptionsInternal(inspectOptions, args) { const nextChar = StringPrototypeCharCodeAt(first, ++i); if (a + 1 !== args.length) { switch (nextChar) { - case 115: // 's' + case 115: { // 's' const tempArg = args[++a]; if (typeof tempArg === 'number') { tempStr = formatNumberNoColor(tempArg, inspectOptions); @@ -2080,10 +2080,11 @@ function formatWithOptionsInternal(inspectOptions, args) { }); } break; + } case 106: // 'j' tempStr = tryStringify(args[++a]); break; - case 100: // 'd' + case 100: { // 'd' const tempNum = args[++a]; if (typeof tempNum === 'bigint') { tempStr = formatBigIntNoColor(tempNum, inspectOptions); @@ -2093,6 +2094,7 @@ function formatWithOptionsInternal(inspectOptions, args) { tempStr = formatNumberNoColor(Number(tempNum), inspectOptions); } break; + } case 79: // 'O' tempStr = inspect(args[++a], inspectOptions); break; @@ -2104,7 +2106,7 @@ function formatWithOptionsInternal(inspectOptions, args) { depth: 4 }); break; - case 105: // 'i' + case 105: { // 'i' const tempInteger = args[++a]; if (typeof tempInteger === 'bigint') { tempStr = formatBigIntNoColor(tempInteger, inspectOptions); @@ -2115,7 +2117,8 @@ function formatWithOptionsInternal(inspectOptions, args) { NumberParseInt(tempInteger), inspectOptions); } break; - case 102: // 'f' + } + case 102: { // 'f' const tempFloat = args[++a]; if (typeof tempFloat === 'symbol') { tempStr = 'NaN'; @@ -2124,6 +2127,7 @@ function formatWithOptionsInternal(inspectOptions, args) { NumberParseFloat(tempFloat), inspectOptions); } break; + } case 99: // 'c' a += 1; tempStr = ''; diff --git a/test/addons/worker-addon/test.js b/test/addons/worker-addon/test.js index f9923638d48767..2d64c2f1c5187d 100644 --- a/test/addons/worker-addon/test.js +++ b/test/addons/worker-addon/test.js @@ -11,7 +11,7 @@ switch (process.argv[2]) { require(binding); // fallthrough case 'worker-twice': - case 'worker': + case 'worker': { const worker = new Worker(`require(${JSON.stringify(binding)});`, { eval: true }); @@ -23,6 +23,7 @@ switch (process.argv[2]) { })); } return; + } case 'main-thread': process.env.addExtraItemToEventLoop = 'yes'; require(binding); diff --git a/test/async-hooks/test-callback-error.js b/test/async-hooks/test-callback-error.js index e8e255a7cf96c9..5665464c2d3921 100644 --- a/test/async-hooks/test-callback-error.js +++ b/test/async-hooks/test-callback-error.js @@ -14,13 +14,14 @@ switch (arg) { new async_hooks.AsyncResource(`${arg}_type`); return; - case 'test_callback': + case 'test_callback': { initHooks({ onbefore: common.mustCall(() => { throw new Error(arg); }) }).enable(); const resource = new async_hooks.AsyncResource(`${arg}_type`); resource.runInAsyncScope(() => {}); return; + } case 'test_callback_abort': initHooks({ diff --git a/test/common/dns.js b/test/common/dns.js index 70e171695ff20d..0c88d1963f24d3 100644 --- a/test/common/dns.js +++ b/test/common/dns.js @@ -236,7 +236,7 @@ function writeDNSPacket(parsed) { rdLengthBuf[0] = 16; buffers.push(writeIPv6(rr.address)); break; - case 'TXT': + case 'TXT': { const total = rr.entries.map((s) => s.length).reduce((a, b) => a + b); // Total length of all strings + 1 byte each for their lengths. rdLengthBuf[0] = rr.entries.length + total; @@ -245,6 +245,7 @@ function writeDNSPacket(parsed) { buffers.push(Buffer.from(txt)); } break; + } case 'MX': rdLengthBuf[0] = 2; buffers.push(new Uint16Array([rr.priority])); diff --git a/test/parallel/test-child-process-spawnsync-timeout.js b/test/parallel/test-child-process-spawnsync-timeout.js index 2923d8c21cb017..aeb2be86608cf4 100644 --- a/test/parallel/test-child-process-spawnsync-timeout.js +++ b/test/parallel/test-child-process-spawnsync-timeout.js @@ -37,7 +37,7 @@ switch (process.argv[2]) { process.exit(1); }, SLEEP); break; - default: + default: { const start = Date.now(); const ret = spawnSync(process.execPath, [__filename, 'child'], { timeout: TIMER }); @@ -47,4 +47,5 @@ switch (process.argv[2]) { assert(end < SLEEP); assert(ret.status > 128 || ret.signal); break; + } } diff --git a/test/parallel/test-cluster-basic.js b/test/parallel/test-cluster-basic.js index 79d8640cf4f65c..6d788cf363ba90 100644 --- a/test/parallel/test-cluster-basic.js +++ b/test/parallel/test-cluster-basic.js @@ -126,7 +126,7 @@ if (cluster.isWorker) { assert.strictEqual(arguments.length, 2); break; - case 'listening': + case 'listening': { assert.strictEqual(arguments.length, 1); assert.strictEqual(Object.keys(arguments[0]).length, 4); assert.strictEqual(arguments[0].address, '127.0.0.1'); @@ -138,7 +138,7 @@ if (cluster.isWorker) { assert(port >= 1); assert(port <= 65535); break; - + } default: assert.strictEqual(arguments.length, 0); break; diff --git a/test/parallel/test-fs-write-stream-err.js b/test/parallel/test-fs-write-stream-err.js index 6d6f25b21f0e27..003f315a3b7160 100644 --- a/test/parallel/test-fs-write-stream-err.js +++ b/test/parallel/test-fs-write-stream-err.js @@ -40,13 +40,14 @@ fs.write = function() { console.error('first write'); // First time is ok. return write.apply(fs, arguments); - case 1: + case 1: { // Then it breaks. console.error('second write'); const cb = arguments[arguments.length - 1]; return process.nextTick(function() { cb(err); }); + } default: // It should not be called again! throw new Error('BOOM!'); diff --git a/test/parallel/test-http-mutable-headers.js b/test/parallel/test-http-mutable-headers.js index e0273cf6c0645c..9b31dd44dda0ef 100644 --- a/test/parallel/test-http-mutable-headers.js +++ b/test/parallel/test-http-mutable-headers.js @@ -41,7 +41,7 @@ const cookies = [ const s = http.createServer(common.mustCall((req, res) => { switch (test) { - case 'headers': + case 'headers': { // Check that header-related functions work before setting any headers const headers = res.getHeaders(); const exoticObj = Object.create(null); @@ -141,7 +141,7 @@ const s = http.createServer(common.mustCall((req, res) => { assert.strictEqual(res.hasHeader('X-TEST-HEADER2'), false); assert.strictEqual(res.hasHeader('X-Test-Header2'), false); break; - + } case 'contentLength': res.setHeader('content-length', content.length); assert.strictEqual(res.getHeader('Content-Length'), content.length); diff --git a/test/parallel/test-http-response-splitting.js b/test/parallel/test-http-response-splitting.js index 2b3bf8d7fb38c6..88f94e6658b174 100644 --- a/test/parallel/test-http-response-splitting.js +++ b/test/parallel/test-http-response-splitting.js @@ -35,10 +35,11 @@ function test(res, code, key, value) { const server = http.createServer((req, res) => { switch (count++) { - case 0: + case 0: { const loc = url.parse(req.url, true).query.lang; test(res, 302, 'Location', `/foo?lang=${loc}`); break; + } case 1: test(res, 200, 'foo', x); break; diff --git a/test/parallel/test-http2-response-splitting.js b/test/parallel/test-http2-response-splitting.js index a94b9ca4f72b35..791c3d74c21213 100644 --- a/test/parallel/test-http2-response-splitting.js +++ b/test/parallel/test-http2-response-splitting.js @@ -32,11 +32,12 @@ server.on('stream', common.mustCall((stream, headers) => { const obj = Object.create(null); switch (remaining--) { - case 3: + case 3: { const url = new URL(makeUrl(headers)); obj[':status'] = 302; obj.Location = `/foo?lang=${url.searchParams.get('lang')}`; break; + } case 2: obj.foo = x; break; diff --git a/test/parallel/test-pending-deprecation.js b/test/parallel/test-pending-deprecation.js index c94c75560df695..e808b6085821d9 100644 --- a/test/parallel/test-pending-deprecation.js +++ b/test/parallel/test-pending-deprecation.js @@ -29,7 +29,7 @@ switch (process.argv[2]) { true ); break; - default: + default: { // Verify that the flag is off by default. const envvar = process.env.NODE_PENDING_DEPRECATION; assert.strictEqual( @@ -61,4 +61,5 @@ switch (process.argv[2]) { }).on('exit', common.mustCall((code) => { assert.strictEqual(code, 0, message('NODE_PENDING_DEPRECATION')); })); + } } diff --git a/test/parallel/test-stdio-pipe-access.js b/test/parallel/test-stdio-pipe-access.js index 6093e60b8b10a5..ac0e22c399a1b9 100644 --- a/test/parallel/test-stdio-pipe-access.js +++ b/test/parallel/test-stdio-pipe-access.js @@ -18,12 +18,13 @@ switch (who) { { 'stdio': 'inherit' }); } break; - case 'parent': + case 'parent': { const middle = spawn(process.argv0, [process.argv[1], 'middle'], { 'stdio': 'pipe' }); middle.stdout.on('data', () => {}); break; + } case 'middle': spawn(process.argv0, [process.argv[1], 'bottom'], diff --git a/test/parallel/test-stdio-pipe-redirect.js b/test/parallel/test-stdio-pipe-redirect.js index fbde6ef8085457..8b48133c8b0317 100644 --- a/test/parallel/test-stdio-pipe-redirect.js +++ b/test/parallel/test-stdio-pipe-redirect.js @@ -13,7 +13,7 @@ const totalDots = 10000; const who = process.argv.length <= 2 ? 'parent' : process.argv[2]; switch (who) { - case 'parent': + case 'parent': { const consumer = spawn(process.argv0, [process.argv[1], 'consumer'], { stdio: ['pipe', 'ignore', 'inherit'], }); @@ -23,7 +23,8 @@ switch (who) { process.stdin.on('data', () => {}); producer.on('exit', process.exit); break; - case 'producer': + } + case 'producer': { const buffer = Buffer.alloc(writeSize, '.'); let written = 0; const write = () => { @@ -34,6 +35,7 @@ switch (who) { }; write(); break; + } case 'consumer': process.stdin.on('data', () => {}); break; diff --git a/test/parallel/test-trace-events-api.js b/test/parallel/test-trace-events-api.js index 1cd0210f39aeeb..5e0966fe7d78b7 100644 --- a/test/parallel/test-trace-events-api.js +++ b/test/parallel/test-trace-events-api.js @@ -161,16 +161,18 @@ function testApiInChildProcess(execArgs, cb) { traces.forEach((trace) => { assert.strictEqual(trace.pid, proc.pid); switch (trace.ph) { - case 'b': + case 'b': { const expectedBegin = expectedBegins.shift(); assert.strictEqual(trace.cat, expectedBegin.cat); assert.strictEqual(trace.name, expectedBegin.name); break; - case 'e': + } + case 'e': { const expectedEnd = expectedEnds.shift(); assert.strictEqual(trace.cat, expectedEnd.cat); assert.strictEqual(trace.name, expectedEnd.name); break; + } default: assert.fail('Unexpected trace event phase'); } diff --git a/test/sequential/test-tls-securepair-client.js b/test/sequential/test-tls-securepair-client.js index d5e2b7b7d2b08d..c9215c43ad6ddb 100644 --- a/test/sequential/test-tls-securepair-client.js +++ b/test/sequential/test-tls-securepair-client.js @@ -77,7 +77,7 @@ function test(keyPath, certPath, check, next) { serverStdoutBuffer += s; console.log(state); switch (state) { - case 'WAIT-ACCEPT': + case 'WAIT-ACCEPT': { const matches = serverStdoutBuffer.match(/ACCEPT .*?:(\d+)/); if (matches) { const port = matches[1]; @@ -85,7 +85,7 @@ function test(keyPath, certPath, check, next) { startClient(port); } break; - + } case 'WAIT-HELLO': if (/hello/.test(serverStdoutBuffer)) { diff --git a/tools/doc/json.mjs b/tools/doc/json.mjs index ee8480114df612..1d2eab2e3cf466 100644 --- a/tools/doc/json.mjs +++ b/tools/doc/json.mjs @@ -128,7 +128,7 @@ export function jsonAPI({ filename }) { switch (current.type) { case 'ctor': case 'classMethod': - case 'method': + case 'method': { // Each item is an argument, unless the name is 'return', // in which case it's the return value. const sig = {}; @@ -142,7 +142,7 @@ export function jsonAPI({ filename }) { parseSignature(current.textRaw, sig); current.signatures = [sig]; break; - + } case 'property': // There should be only one item, which is the value. // Copy the data up to the section.