lib: enforce use of trailing commas for functions

PR-URL: https://github.com/nodejs/node/pull/46629
Reviewed-By: Jacob Smith <jacob@frende.me>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
Antoine du Hamel 2023-02-14 18:45:16 +01:00 committed by GitHub
parent 3acdeb1f7a
commit fe514bf960
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
109 changed files with 389 additions and 389 deletions

View File

@ -5,7 +5,7 @@ rules:
comma-dangle: [error, { comma-dangle: [error, {
arrays: always-multiline, arrays: always-multiline,
exports: always-multiline, exports: always-multiline,
functions: only-multiline, functions: always-multiline,
imports: always-multiline, imports: always-multiline,
objects: only-multiline, objects: only-multiline,
}] }]

View File

@ -396,7 +396,7 @@ function installListeners(agent, s, options) {
// TODO(ronag): Always destroy, even if not in free list. // TODO(ronag): Always destroy, even if not in free list.
const sockets = agent.freeSockets; const sockets = agent.freeSockets;
if (ArrayPrototypeSome(ObjectKeys(sockets), (name) => if (ArrayPrototypeSome(ObjectKeys(sockets), (name) =>
ArrayPrototypeIncludes(sockets[name], s) ArrayPrototypeIncludes(sockets[name], s),
)) { )) {
return s.destroy(); return s.destroy();
} }

View File

@ -609,7 +609,7 @@ function checkConnections() {
function connectionListener(socket) { function connectionListener(socket) {
defaultTriggerAsyncIdScope( defaultTriggerAsyncIdScope(
getOrSetAsyncId(socket), connectionListenerInternal, this, socket getOrSetAsyncId(socket), connectionListenerInternal, this, socket,
); );
} }
@ -812,15 +812,15 @@ function onParserTimeout(server, socket) {
const noop = () => {}; const noop = () => {};
const badRequestResponse = Buffer.from( const badRequestResponse = Buffer.from(
`HTTP/1.1 400 ${STATUS_CODES[400]}\r\n` + `HTTP/1.1 400 ${STATUS_CODES[400]}\r\n` +
'Connection: close\r\n\r\n', 'ascii' 'Connection: close\r\n\r\n', 'ascii',
); );
const requestTimeoutResponse = Buffer.from( const requestTimeoutResponse = Buffer.from(
`HTTP/1.1 408 ${STATUS_CODES[408]}\r\n` + `HTTP/1.1 408 ${STATUS_CODES[408]}\r\n` +
'Connection: close\r\n\r\n', 'ascii' 'Connection: close\r\n\r\n', 'ascii',
); );
const requestHeaderFieldsTooLargeResponse = Buffer.from( const requestHeaderFieldsTooLargeResponse = Buffer.from(
`HTTP/1.1 431 ${STATUS_CODES[431]}\r\n` + `HTTP/1.1 431 ${STATUS_CODES[431]}\r\n` +
'Connection: close\r\n\r\n', 'ascii' 'Connection: close\r\n\r\n', 'ascii',
); );
function socketOnError(e) { function socketOnError(e) {
// Ignore further errors // Ignore further errors

View File

@ -171,7 +171,7 @@ function onhandshakedone() {
function loadSession(hello) { function loadSession(hello) {
debug('server onclienthello', debug('server onclienthello',
'sessionid.len', hello.sessionId.length, 'sessionid.len', hello.sessionId.length,
'ticket?', hello.tlsTicket 'ticket?', hello.tlsTicket,
); );
const owner = this[owner_symbol]; const owner = this[owner_symbol];
@ -350,7 +350,7 @@ function onPskServerCallback(identity, maxPskLen) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'ret', 'ret',
['Object', 'Buffer', 'TypedArray', 'DataView'], ['Object', 'Buffer', 'TypedArray', 'DataView'],
ret ret,
); );
} }
psk = ret.psk; psk = ret.psk;
@ -361,7 +361,7 @@ function onPskServerCallback(identity, maxPskLen) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'psk', 'psk',
psk, psk,
`Pre-shared key exceeds ${maxPskLen} bytes` `Pre-shared key exceeds ${maxPskLen} bytes`,
); );
} }
@ -381,7 +381,7 @@ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'psk', 'psk',
ret.psk, ret.psk,
`Pre-shared key exceeds ${maxPskLen} bytes` `Pre-shared key exceeds ${maxPskLen} bytes`,
); );
} }
@ -390,7 +390,7 @@ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'identity', 'identity',
ret.identity, ret.identity,
`PSK identity exceeds ${maxIdentityLen} bytes` `PSK identity exceeds ${maxIdentityLen} bytes`,
); );
} }
@ -447,7 +447,7 @@ function initRead(tlsSocket, socket) {
debug('%s initRead', debug('%s initRead',
tlsSocket._tlsOptions.isServer ? 'server' : 'client', tlsSocket._tlsOptions.isServer ? 'server' : 'client',
'handle?', !!tlsSocket._handle, 'handle?', !!tlsSocket._handle,
'buffered?', !!socket && socket.readableLength 'buffered?', !!socket && socket.readableLength,
); );
// If we were destroyed already don't bother reading // If we were destroyed already don't bother reading
if (!tlsSocket._handle) if (!tlsSocket._handle)
@ -689,7 +689,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
debug('%s _init', debug('%s _init',
options.isServer ? 'server' : 'client', options.isServer ? 'server' : 'client',
'handle?', !!ssl 'handle?', !!ssl,
); );
// Clients (!isServer) always request a cert, servers request a client cert // Clients (!isServer) always request a cert, servers request a client cert
@ -846,7 +846,7 @@ TLSSocket.prototype.renegotiate = function(options, callback) {
debug('%s renegotiate()', debug('%s renegotiate()',
this._tlsOptions.isServer ? 'server' : 'client', this._tlsOptions.isServer ? 'server' : 'client',
'destroyed?', this.destroyed 'destroyed?', this.destroyed,
); );
if (this.destroyed) if (this.destroyed)
@ -1456,7 +1456,7 @@ Server.prototype.addContext = function(servername, context) {
const re = new RegExp('^' + StringPrototypeReplaceAll( const re = new RegExp('^' + StringPrototypeReplaceAll(
RegExpPrototypeSymbolReplace(/([.^$+?\-\\[\]{}])/g, servername, '\\$1'), RegExpPrototypeSymbolReplace(/([.^$+?\-\\[\]{}])/g, servername, '\\$1'),
'*', '[^.]*' '*', '[^.]*',
) + '$'); ) + '$');
ArrayPrototypePush(this._contexts, ArrayPrototypePush(this._contexts,
[re, tls.createSecureContext(context).context]); [re, tls.createSecureContext(context).context]);
@ -1680,7 +1680,7 @@ exports.connect = function connect(...args) {
'Setting the TLS ServerName to an IP address is not permitted by ' + 'Setting the TLS ServerName to an IP address is not permitted by ' +
'RFC 6066. This will be ignored in a future version.', 'RFC 6066. This will be ignored in a future version.',
'DeprecationWarning', 'DeprecationWarning',
'DEP0123' 'DEP0123',
); );
ipServernameWarned = true; ipServernameWarned = true;
} }

View File

@ -148,7 +148,7 @@ function fail(actual, expected, message, operator, stackStartFn) {
'assert.fail() with more than one argument is deprecated. ' + 'assert.fail() with more than one argument is deprecated. ' +
'Please use assert.strictEqual() instead or only pass a message.', 'Please use assert.strictEqual() instead or only pass a message.',
'DeprecationWarning', 'DeprecationWarning',
'DEP0094' 'DEP0094',
); );
} }
if (argsLen === 2) if (argsLen === 2)
@ -807,13 +807,13 @@ function expectsError(stackStartFn, actual, error, message) {
if (actual.message === error) { if (actual.message === error) {
throw new ERR_AMBIGUOUS_ARGUMENT( throw new ERR_AMBIGUOUS_ARGUMENT(
'error/message', 'error/message',
`The error message "${actual.message}" is identical to the message.` `The error message "${actual.message}" is identical to the message.`,
); );
} }
} else if (actual === error) { } else if (actual === error) {
throw new ERR_AMBIGUOUS_ARGUMENT( throw new ERR_AMBIGUOUS_ARGUMENT(
'error/message', 'error/message',
`The error "${actual}" is identical to the message.` `The error "${actual}" is identical to the message.`,
); );
} }
message = error; message = error;
@ -855,7 +855,7 @@ function hasMatchingError(actual, expected) {
return RegExpPrototypeExec(expected, str) !== null; return RegExpPrototypeExec(expected, str) !== null;
} }
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'expected', ['Function', 'RegExp'], expected 'expected', ['Function', 'RegExp'], expected,
); );
} }
// Guard instanceof against arrow functions as they don't have a prototype. // Guard instanceof against arrow functions as they don't have a prototype.
@ -970,7 +970,7 @@ assert.ifError = function ifError(err) {
if (origStackStart !== -1) { if (origStackStart !== -1) {
const originalFrames = StringPrototypeSplit( const originalFrames = StringPrototypeSplit(
StringPrototypeSlice(origStack, origStackStart + 1), StringPrototypeSlice(origStack, origStackStart + 1),
'\n' '\n',
); );
// Filter all frames existing in err.stack. // Filter all frames existing in err.stack.
let newFrames = StringPrototypeSplit(newErr.stack, '\n'); let newFrames = StringPrototypeSplit(newErr.stack, '\n');
@ -996,7 +996,7 @@ assert.ifError = function ifError(err) {
function internalMatch(string, regexp, message, fn) { function internalMatch(string, regexp, message, fn) {
if (!isRegExp(regexp)) { if (!isRegExp(regexp)) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'regexp', 'RegExp', regexp 'regexp', 'RegExp', regexp,
); );
} }
const match = fn === assert.match; const match = fn === assert.match;

View File

@ -326,7 +326,7 @@ Buffer.from = function from(value, encodingOrOffset, length) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'first argument', 'first argument',
['string', 'Buffer', 'ArrayBuffer', 'Array', 'Array-like Object'], ['string', 'Buffer', 'ArrayBuffer', 'Array', 'Array-like Object'],
value value,
); );
}; };
@ -733,7 +733,7 @@ function byteLength(string, encoding) {
} }
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'string', ['string', 'Buffer', 'ArrayBuffer'], string 'string', ['string', 'Buffer', 'ArrayBuffer'], string,
); );
} }
@ -954,7 +954,7 @@ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
} }
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'value', ['number', 'string', 'Buffer', 'Uint8Array'], val 'value', ['number', 'string', 'Buffer', 'Uint8Array'], val,
); );
} }
@ -1210,7 +1210,7 @@ if (internalBinding('config').hasIntl) {
const code = icuErrName(result); const code = icuErrName(result);
const err = genericNodeError( const err = genericNodeError(
`Unable to transcode Buffer [${code}]`, `Unable to transcode Buffer [${code}]`,
{ code: code, errno: result } { code: code, errno: result },
); );
throw err; throw err;
}; };
@ -1362,10 +1362,10 @@ ObjectDefineProperties(module.exports, {
defineLazyProperties( defineLazyProperties(
module.exports, module.exports,
'internal/blob', 'internal/blob',
['Blob', 'resolveObjectURL'] ['Blob', 'resolveObjectURL'],
); );
defineLazyProperties( defineLazyProperties(
module.exports, module.exports,
'internal/file', 'internal/file',
['File'] ['File'],
); );

View File

@ -56,7 +56,7 @@ let debug = require('internal/util/debuglog').debuglog(
'child_process', 'child_process',
(fn) => { (fn) => {
debug = fn; debug = fn;
} },
); );
const { Buffer } = require('buffer'); const { Buffer } = require('buffer');
const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap'); const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
@ -686,7 +686,7 @@ function normalizeSpawnArguments(file, args, options) {
} }
sawKey.add(uppercaseKey); sawKey.add(uppercaseKey);
return true; return true;
} },
); );
} }

View File

@ -317,7 +317,7 @@ function getRandomBytesAlias(key) {
configurable: true, configurable: true,
writable: true, writable: true,
value: value value: value
} },
); );
return value; return value;
}, },
@ -331,7 +331,7 @@ function getRandomBytesAlias(key) {
configurable: true, configurable: true,
writable: true, writable: true,
value value
} },
); );
} }
}; };

View File

@ -412,7 +412,7 @@ function _connect(port, address, callback) {
defaultTriggerAsyncIdScope( defaultTriggerAsyncIdScope(
this[async_id_symbol], this[async_id_symbol],
doConnect, doConnect,
ex, this, ip, address, port, callback ex, this, ip, address, port, callback,
); );
}; };
@ -662,7 +662,7 @@ Socket.prototype.send = function(buffer,
defaultTriggerAsyncIdScope( defaultTriggerAsyncIdScope(
this[async_id_symbol], this[async_id_symbol],
doSend, doSend,
ex, this, ip, list, address, port, callback ex, this, ip, list, address, port, callback,
); );
}; };
@ -1066,7 +1066,7 @@ module.exports = {
_createSocketHandle: deprecate( _createSocketHandle: deprecate(
_createSocketHandle, _createSocketHandle,
'dgram._createSocketHandle() is deprecated', 'dgram._createSocketHandle() is deprecated',
'DEP0112' 'DEP0112',
), ),
createSocket, createSocket,
Socket Socket

View File

@ -219,7 +219,7 @@ function lookup(hostname, options, callback) {
req.oncomplete = all ? onlookupall : onlookup; req.oncomplete = all ? onlookupall : onlookup;
const err = cares.getaddrinfo( const err = cares.getaddrinfo(
req, toASCII(hostname), family, hints, verbatim req, toASCII(hostname), family, hints, verbatim,
); );
if (err) { if (err) {
process.nextTick(callback, dnsException(err, 'getaddrinfo', hostname)); process.nextTick(callback, dnsException(err, 'getaddrinfo', hostname));

View File

@ -3109,7 +3109,7 @@ module.exports = fs = {
defineLazyProperties( defineLazyProperties(
fs, fs,
'internal/fs/dir', 'internal/fs/dir',
['Dir', 'opendir', 'opendirSync'] ['Dir', 'opendir', 'opendirSync'],
); );
ObjectDefineProperties(fs, { ObjectDefineProperties(fs, {

View File

@ -72,7 +72,7 @@ function inspectValue(val) {
sorted: true, sorted: true,
// Inspect getters as we also check them when comparing entries. // Inspect getters as we also check them when comparing entries.
getters: true, getters: true,
} },
); );
} }

View File

@ -201,7 +201,7 @@ function emitInitNative(asyncId, type, triggerAsyncId, resource) {
if (typeof active_hooks.array[i][init_symbol] === 'function') { if (typeof active_hooks.array[i][init_symbol] === 'function') {
active_hooks.array[i][init_symbol]( active_hooks.array[i][init_symbol](
asyncId, type, triggerAsyncId, asyncId, type, triggerAsyncId,
resource resource,
); );
} }
} }

View File

@ -201,7 +201,7 @@ class BuiltinModule {
* @type {Map<string, BuiltinModule>} * @type {Map<string, BuiltinModule>}
*/ */
static map = new SafeMap( static map = new SafeMap(
ArrayPrototypeMap(builtinIds, (id) => [id, new BuiltinModule(id)]) ArrayPrototypeMap(builtinIds, (id) => [id, new BuiltinModule(id)]),
); );
constructor(id) { constructor(id) {

View File

@ -223,13 +223,13 @@ defineOperation(globalThis, 'setImmediate', timers.setImmediate);
defineLazyProperties( defineLazyProperties(
globalThis, globalThis,
'internal/structured_clone', 'internal/structured_clone',
['structuredClone'] ['structuredClone'],
); );
exposeLazyInterfaces( exposeLazyInterfaces(
globalThis, globalThis,
'internal/worker/io', 'internal/worker/io',
['BroadcastChannel'] ['BroadcastChannel'],
); );
// Set the per-Environment callback that will be called // Set the per-Environment callback that will be called
// when the TrackingTraceStateObserver updates trace state. // when the TrackingTraceStateObserver updates trace state.

View File

@ -947,7 +947,7 @@ function setupChannel(target, channel, serializationMode) {
ArrayPrototypePush( ArrayPrototypePush(
target.channel[kPendingMessages], target.channel[kPendingMessages],
[event, message, handle] [event, message, handle],
); );
} }

View File

@ -82,11 +82,11 @@ const advanced = {
channel[kMessageBuffer][0] : channel[kMessageBuffer][0] :
Buffer.concat( Buffer.concat(
channel[kMessageBuffer], channel[kMessageBuffer],
channel[kMessageBufferSize] channel[kMessageBufferSize],
); );
const deserializer = new ChildProcessDeserializer( const deserializer = new ChildProcessDeserializer(
TypedArrayPrototypeSubarray(concatenatedBuffer, 4, fullMessageSize) TypedArrayPrototypeSubarray(concatenatedBuffer, 4, fullMessageSize),
); );
messageBufferHead = TypedArrayPrototypeSubarray(concatenatedBuffer, fullMessageSize); messageBufferHead = TypedArrayPrototypeSubarray(concatenatedBuffer, fullMessageSize);

View File

@ -29,10 +29,10 @@ function Worker(options) {
if (options.process) { if (options.process) {
this.process = options.process; this.process = options.process;
this.process.on('error', (code, signal) => this.process.on('error', (code, signal) =>
this.emit('error', code, signal) this.emit('error', code, signal),
); );
this.process.on('message', (message, handle) => this.process.on('message', (message, handle) =>
this.emit('message', message, handle) this.emit('message', message, handle),
); );
} }
} }

View File

@ -490,7 +490,7 @@ const consoleMethods = {
this[kGroupIndent] = StringPrototypeSlice( this[kGroupIndent] = StringPrototypeSlice(
this[kGroupIndent], this[kGroupIndent],
0, 0,
this[kGroupIndent].length - this[kGroupIndentationWidth] this[kGroupIndent].length - this[kGroupIndentationWidth],
); );
}, },
@ -653,7 +653,7 @@ function formatTime(ms) {
if (hours !== 0 || minutes !== 0) { if (hours !== 0 || minutes !== 0) {
({ 0: seconds, 1: ms } = StringPrototypeSplit( ({ 0: seconds, 1: ms } = StringPrototypeSplit(
NumberPrototypeToFixed(seconds, 3), NumberPrototypeToFixed(seconds, 3),
'.' '.',
)); ));
const res = hours !== 0 ? `${hours}:${pad(minutes)}` : minutes; const res = hours !== 0 ? `${hours}:${pad(minutes)}` : minutes;
return `${res}:${pad(seconds)}.${ms} (${hours !== 0 ? 'h:m' : ''}m:ss.mmm)`; return `${res}:${pad(seconds)}.${ms} (${hours !== 0 ? 'h:m' : ''}m:ss.mmm)`;

View File

@ -79,7 +79,7 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'sizeOrKey', 'sizeOrKey',
['number', 'string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'], ['number', 'string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'],
sizeOrKey sizeOrKey,
); );
} }
@ -114,7 +114,7 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'generator', 'generator',
['number', 'string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'], ['number', 'string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'],
generator generator,
); );
} }

View File

@ -203,7 +203,7 @@ const {
case 'ec': case 'ec':
return this[kAsymmetricKeyDetails] || return this[kAsymmetricKeyDetails] ||
(this[kAsymmetricKeyDetails] = normalizeKeyDetails( (this[kAsymmetricKeyDetails] = normalizeKeyDetails(
this[kHandle].keyDetail({}) this[kHandle].keyDetail({}),
)); ));
default: default:
return {}; return {};
@ -382,7 +382,7 @@ function getKeyObjectHandle(key, ctx) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'key', 'key',
['string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'], ['string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'],
key key,
); );
} }

View File

@ -231,7 +231,7 @@ function randomInt(min, max, callback) {
} }
if (max <= min) { if (max <= min) {
throw new ERR_OUT_OF_RANGE( throw new ERR_OUT_OF_RANGE(
'max', `greater than the value of "min" (${min})`, max 'max', `greater than the value of "min" (${min})`, max,
); );
} }
@ -547,7 +547,7 @@ function checkPrime(candidate, options = kEmptyObject, callback) {
'DataView', 'DataView',
'bigint', 'bigint',
], ],
candidate candidate,
); );
} }
if (typeof options === 'function') { if (typeof options === 'function') {
@ -580,7 +580,7 @@ function checkPrimeSync(candidate, options = kEmptyObject) {
'DataView', 'DataView',
'bigint', 'bigint',
], ],
candidate candidate,
); );
} }
validateObject(options, 'options'); validateObject(options, 'options');

View File

@ -244,7 +244,7 @@ function verifyOneShot(algorithm, data, key, signature, callback) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'data', 'data',
['Buffer', 'TypedArray', 'DataView'], ['Buffer', 'TypedArray', 'DataView'],
data data,
); );
} }
@ -259,7 +259,7 @@ function verifyOneShot(algorithm, data, key, signature, callback) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'signature', 'signature',
['Buffer', 'TypedArray', 'DataView'], ['Buffer', 'TypedArray', 'DataView'],
signature signature,
); );
} }

View File

@ -132,7 +132,7 @@ const getArrayBufferOrView = hideStackFrames((buffer, name, encoding) => {
'TypedArray', 'TypedArray',
'DataView', 'DataView',
], ],
buffer buffer,
); );
} }
return buffer; return buffer;

View File

@ -278,7 +278,7 @@ class NodeInspector {
if (StringPrototypeEndsWith( if (StringPrototypeEndsWith(
textToPrint, textToPrint,
'Waiting for the debugger to disconnect...\n' 'Waiting for the debugger to disconnect...\n',
)) { )) {
this.killChild(); this.killChild();
} }

View File

@ -55,7 +55,7 @@ function validateHandshake(requestKey, responseKey) {
if (shabuf.toString('base64') !== responseKey) { if (shabuf.toString('base64') !== responseKey) {
throw new ERR_DEBUGGER_ERROR( throw new ERR_DEBUGGER_ERROR(
`WebSocket secret mismatch: ${requestKey} did not match ${responseKey}` `WebSocket secret mismatch: ${requestKey} did not match ${responseKey}`,
); );
} }
} }

View File

@ -521,7 +521,7 @@ function createRepl(inspector) {
return SafePromiseAllReturnArrayLike( return SafePromiseAllReturnArrayLike(
ArrayPrototypeFilter( ArrayPrototypeFilter(
this.scopeChain, this.scopeChain,
(scope) => scope.type !== 'global' (scope) => scope.type !== 'global',
), ),
async (scope) => { async (scope) => {
const { objectId } = scope.object; const { objectId } = scope.object;
@ -566,7 +566,7 @@ function createRepl(inspector) {
(callFrame) => (callFrame) =>
(callFrame instanceof CallFrame ? (callFrame instanceof CallFrame ?
callFrame : callFrame :
new CallFrame(callFrame)) new CallFrame(callFrame)),
); );
} }
} }
@ -624,7 +624,7 @@ function createRepl(inspector) {
FunctionPrototypeCall( FunctionPrototypeCall(
then, result, then, result,
(result) => returnToCallback(null, result), (result) => returnToCallback(null, result),
returnToCallback returnToCallback,
); );
} else { } else {
returnToCallback(null, result); returnToCallback(null, result);
@ -643,7 +643,7 @@ function createRepl(inspector) {
PromisePrototypeThen(evalInCurrentContext(input), PromisePrototypeThen(evalInCurrentContext(input),
(result) => returnToCallback(null, result), (result) => returnToCallback(null, result),
returnToCallback returnToCallback,
); );
} }
@ -926,7 +926,7 @@ function createRepl(inspector) {
Profile.createAndRegister({ profile }); Profile.createAndRegister({ profile });
print( print(
'Captured new CPU profile.\n' + 'Captured new CPU profile.\n' +
`Access it with profiles[${profiles.length - 1}]` `Access it with profiles[${profiles.length - 1}]`,
); );
}); });
@ -1010,7 +1010,7 @@ function createRepl(inspector) {
takeHeapSnapshot(filename = 'node.heapsnapshot') { takeHeapSnapshot(filename = 'node.heapsnapshot') {
if (heapSnapshotPromise) { if (heapSnapshotPromise) {
print( print(
'Cannot take heap snapshot because another snapshot is in progress.' 'Cannot take heap snapshot because another snapshot is in progress.',
); );
return heapSnapshotPromise; return heapSnapshotPromise;
} }

View File

@ -269,7 +269,7 @@ function emitInvalidHostnameWarning(hostname) {
`The provided hostname "${hostname}" is not a valid ` + `The provided hostname "${hostname}" is not a valid ` +
'hostname, and is supported in the dns module solely for compatibility.', 'hostname, and is supported in the dns module solely for compatibility.',
'DeprecationWarning', 'DeprecationWarning',
'DEP0118' 'DEP0118',
); );
invalidHostnameWarningEmitted = true; invalidHostnameWarningEmitted = true;
} }

View File

@ -445,7 +445,7 @@ function getMessage(key, args, self) {
assert( assert(
msg.length <= args.length, // Default options do not count. msg.length <= args.length, // Default options do not count.
`Code: ${key}; The provided arguments length (${args.length}) does not ` + `Code: ${key}; The provided arguments length (${args.length}) does not ` +
`match the required ones (${msg.length}).` `match the required ones (${msg.length}).`,
); );
return ReflectApply(msg, self, args); return ReflectApply(msg, self, args);
} }
@ -456,7 +456,7 @@ function getMessage(key, args, self) {
assert( assert(
expectedLength === args.length, expectedLength === args.length,
`Code: ${key}; The provided arguments length (${args.length}) does not ` + `Code: ${key}; The provided arguments length (${args.length}) does not ` +
`match the required ones (${expectedLength}).` `match the required ones (${expectedLength}).`,
); );
if (args.length === 0) if (args.length === 0)
return msg; return msg;
@ -833,7 +833,7 @@ function hideInternalStackFrames(error) {
frames = ArrayPrototypeFilter( frames = ArrayPrototypeFilter(
stackFrames, stackFrames,
(frm) => !StringPrototypeStartsWith(frm.getFileName() || '', (frm) => !StringPrototypeStartsWith(frm.getFileName() || '',
'node:internal') 'node:internal'),
); );
} }
ArrayPrototypeUnshift(frames, error); ArrayPrototypeUnshift(frames, error);
@ -1395,7 +1395,7 @@ E(
'"%s" did not call the next hook in its chain and did not' + '"%s" did not call the next hook in its chain and did not' +
' explicitly signal a short circuit. If this is intentional, include' + ' explicitly signal a short circuit. If this is intentional, include' +
' `shortCircuit: true` in the hook\'s return.', ' `shortCircuit: true` in the hook\'s return.',
Error Error,
); );
E('ERR_MANIFEST_ASSERT_INTEGRITY', E('ERR_MANIFEST_ASSERT_INTEGRITY',
(moduleURL, realIntegrities) => { (moduleURL, realIntegrities) => {
@ -1406,7 +1406,7 @@ E('ERR_MANIFEST_ASSERT_INTEGRITY',
const sri = ArrayPrototypeJoin( const sri = ArrayPrototypeJoin(
ArrayFrom(realIntegrities.entries(), ArrayFrom(realIntegrities.entries(),
({ 0: alg, 1: dgs }) => `${alg}-${dgs}`), ({ 0: alg, 1: dgs }) => `${alg}-${dgs}`),
' ' ' ',
); );
msg += ` Integrities found are: ${sri}`; msg += ` Integrities found are: ${sri}`;
} else { } else {
@ -1442,7 +1442,7 @@ E('ERR_MISSING_ARGS',
args, args,
(a) => (ArrayIsArray(a) ? (a) => (ArrayIsArray(a) ?
ArrayPrototypeJoin(ArrayPrototypeMap(a, wrap), ' or ') : ArrayPrototypeJoin(ArrayPrototypeMap(a, wrap), ' or ') :
wrap(a)) wrap(a)),
); );
msg += `${formatList(args)} argument${len > 1 ? 's' : ''}`; msg += `${formatList(args)} argument${len > 1 ? 's' : ''}`;
return `${msg} must be specified`; return `${msg} must be specified`;

View File

@ -405,7 +405,7 @@ let weakListenersState = null;
let objectToWeakListenerMap = null; let objectToWeakListenerMap = null;
function weakListeners() { function weakListeners() {
weakListenersState ??= new SafeFinalizationRegistry( weakListenersState ??= new SafeFinalizationRegistry(
(listener) => listener.remove() (listener) => listener.remove(),
); );
objectToWeakListenerMap ??= new SafeWeakMap(); objectToWeakListenerMap ??= new SafeWeakMap();
return { registry: weakListenersState, map: objectToWeakListenerMap }; return { registry: weakListenersState, map: objectToWeakListenerMap };

View File

@ -215,7 +215,7 @@ module.exports = function() {
IteratorPrototype, // 27.1.2 IteratorPrototype IteratorPrototype, // 27.1.2 IteratorPrototype
// 27.1.3 AsyncIteratorPrototype // 27.1.3 AsyncIteratorPrototype
ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf( ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf(
(async function*() {})() (async function*() {})(),
))), ))),
PromisePrototype, // 27.2 PromisePrototype, // 27.2
@ -324,7 +324,7 @@ module.exports = function() {
ObjectGetPrototypeOf(ArrayIteratorPrototype), // 27.1.2 IteratorPrototype ObjectGetPrototypeOf(ArrayIteratorPrototype), // 27.1.2 IteratorPrototype
// 27.1.3 AsyncIteratorPrototype // 27.1.3 AsyncIteratorPrototype
ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf( ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf(
(async function*() {})() (async function*() {})(),
))), ))),
Promise, // 27.2 Promise, // 27.2
// 27.3 GeneratorFunction // 27.3 GeneratorFunction
@ -497,7 +497,7 @@ module.exports = function() {
if (obj === this) { if (obj === this) {
// eslint-disable-next-line no-restricted-syntax // eslint-disable-next-line no-restricted-syntax
throw new TypeError( throw new TypeError(
`Cannot assign to read only property '${prop}' of object '${obj}'` `Cannot assign to read only property '${prop}' of object '${obj}'`,
); );
} }
if (ObjectPrototypeHasOwnProperty(this, prop)) { if (ObjectPrototypeHasOwnProperty(this, prop)) {

View File

@ -128,7 +128,7 @@ class Dir {
this[kDirHandle].read( this[kDirHandle].read(
this[kDirOptions].encoding, this[kDirOptions].encoding,
this[kDirOptions].bufferSize, this[kDirOptions].bufferSize,
req req,
); );
} }
@ -152,7 +152,7 @@ class Dir {
this[kDirOptions].encoding, this[kDirOptions].encoding,
this[kDirOptions].bufferSize, this[kDirOptions].bufferSize,
undefined, undefined,
ctx ctx,
); );
handleErrorFromBinding(ctx); handleErrorFromBinding(ctx);
@ -256,7 +256,7 @@ function opendir(path, options, callback) {
dirBinding.opendir( dirBinding.opendir(
pathModule.toNamespacedPath(path), pathModule.toNamespacedPath(path),
options.encoding, options.encoding,
req req,
); );
} }
@ -271,7 +271,7 @@ function opendirSync(path, options) {
pathModule.toNamespacedPath(path), pathModule.toNamespacedPath(path),
options.encoding, options.encoding,
undefined, undefined,
ctx ctx,
); );
handleErrorFromBinding(ctx); handleErrorFromBinding(ctx);

View File

@ -225,7 +225,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
this[kFd] = -1; this[kFd] = -1;
this[kClosePromise] = SafePromisePrototypeFinally( this[kClosePromise] = SafePromisePrototypeFinally(
this[kHandle].close(), this[kHandle].close(),
() => { this[kClosePromise] = undefined; } () => { this[kClosePromise] = undefined; },
); );
} else { } else {
this[kClosePromise] = SafePromisePrototypeFinally( this[kClosePromise] = SafePromisePrototypeFinally(
@ -236,7 +236,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
this[kClosePromise] = undefined; this[kClosePromise] = undefined;
this[kCloseReject] = undefined; this[kCloseReject] = undefined;
this[kCloseResolve] = undefined; this[kCloseResolve] = undefined;
} },
); );
} }
@ -347,7 +347,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
PromisePrototypeThen( PromisePrototypeThen(
this[kHandle].close(), this[kHandle].close(),
this[kCloseResolve], this[kCloseResolve],
this[kCloseReject] this[kCloseReject],
); );
} }
} }
@ -361,8 +361,8 @@ async function handleFdClose(fileOpPromise, closeFunc) {
PromisePrototypeThen( PromisePrototypeThen(
closeFunc(), closeFunc(),
() => PromiseReject(opError), () => PromiseReject(opError),
(closeError) => PromiseReject(aggregateTwoErrors(closeError, opError)) (closeError) => PromiseReject(aggregateTwoErrors(closeError, opError)),
) ),
); );
} }
@ -421,7 +421,7 @@ async function writeFileHandle(filehandle, data, signal, encoding) {
data = new Uint8Array( data = new Uint8Array(
data.buffer, data.buffer,
data.byteOffset + bytesWritten, data.byteOffset + bytesWritten,
data.byteLength - bytesWritten data.byteLength - bytesWritten,
); );
} while (remaining > 0); } while (remaining > 0);
} }

View File

@ -204,7 +204,7 @@ function ReadStream(path, options) {
throw new ERR_OUT_OF_RANGE( throw new ERR_OUT_OF_RANGE(
'start', 'start',
`<= "end" (here: ${this.end})`, `<= "end" (here: ${this.end})`,
this.start this.start,
); );
} }
} }

View File

@ -118,7 +118,7 @@ const kMinimumCopyMode = MathMin(
kDefaultCopyMode, kDefaultCopyMode,
COPYFILE_EXCL, COPYFILE_EXCL,
COPYFILE_FICLONE, COPYFILE_FICLONE,
COPYFILE_FICLONE_FORCE COPYFILE_FICLONE_FORCE,
); );
const kMaximumCopyMode = COPYFILE_EXCL | const kMaximumCopyMode = COPYFILE_EXCL |
COPYFILE_FICLONE | COPYFILE_FICLONE |
@ -370,7 +370,7 @@ const nullCheck = hideStackFrames((path, propName, throwError = true) => {
const err = new ERR_INVALID_ARG_VALUE( const err = new ERR_INVALID_ARG_VALUE(
propName, propName,
path, path,
'must be a string or Uint8Array without null bytes' 'must be a string or Uint8Array without null bytes',
); );
if (throwError) { if (throwError) {
throw err; throw err;
@ -541,7 +541,7 @@ function getStatsFromBinding(stats, offset = 0) {
nsFromTimeSpecBigInt(stats[10 + offset], stats[11 + offset]), nsFromTimeSpecBigInt(stats[10 + offset], stats[11 + offset]),
nsFromTimeSpecBigInt(stats[12 + offset], stats[13 + offset]), nsFromTimeSpecBigInt(stats[12 + offset], stats[13 + offset]),
nsFromTimeSpecBigInt(stats[14 + offset], stats[15 + offset]), nsFromTimeSpecBigInt(stats[14 + offset], stats[15 + offset]),
nsFromTimeSpecBigInt(stats[16 + offset], stats[17 + offset]) nsFromTimeSpecBigInt(stats[16 + offset], stats[17 + offset]),
); );
} }
return new Stats( return new Stats(
@ -552,7 +552,7 @@ function getStatsFromBinding(stats, offset = 0) {
msFromTimeSpec(stats[10 + offset], stats[11 + offset]), msFromTimeSpec(stats[10 + offset], stats[11 + offset]),
msFromTimeSpec(stats[12 + offset], stats[13 + offset]), msFromTimeSpec(stats[12 + offset], stats[13 + offset]),
msFromTimeSpec(stats[14 + offset], stats[15 + offset]), msFromTimeSpec(stats[14 + offset], stats[15 + offset]),
msFromTimeSpec(stats[16 + offset], stats[17 + offset]) msFromTimeSpec(stats[16 + offset], stats[17 + offset]),
); );
} }
@ -570,7 +570,7 @@ class StatFs {
function getStatFsFromBinding(stats) { function getStatFsFromBinding(stats) {
return new StatFs( return new StatFs(
stats[0], stats[1], stats[2], stats[3], stats[4], stats[5], stats[6] stats[0], stats[1], stats[2], stats[3], stats[4], stats[5], stats[6],
); );
} }
@ -666,7 +666,7 @@ const validateOffsetLengthRead = hideStackFrames(
throw new ERR_OUT_OF_RANGE('length', throw new ERR_OUT_OF_RANGE('length',
`<= ${bufferLength - offset}`, length); `<= ${bufferLength - offset}`, length);
} }
} },
); );
const validateOffsetLengthWrite = hideStackFrames( const validateOffsetLengthWrite = hideStackFrames(
@ -684,7 +684,7 @@ const validateOffsetLengthWrite = hideStackFrames(
} }
validateInt32(length, 'length', 0); validateInt32(length, 'length', 0);
} },
); );
const validatePath = hideStackFrames((path, propName = 'path') => { const validatePath = hideStackFrames((path, propName = 'path') => {
@ -844,7 +844,7 @@ function emitRecursiveRmdirWarning() {
'In future versions of Node.js, fs.rmdir(path, { recursive: true }) ' + 'In future versions of Node.js, fs.rmdir(path, { recursive: true }) ' +
'will be removed. Use fs.rm(path, { recursive: true }) instead', 'will be removed. Use fs.rm(path, { recursive: true }) instead',
'DeprecationWarning', 'DeprecationWarning',
'DEP0147' 'DEP0147',
); );
recursiveRmdirWarned = true; recursiveRmdirWarned = true;
} }
@ -888,7 +888,7 @@ const validateStringAfterArrayBufferView = hideStackFrames((buffer, name) => {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
name, name,
['string', 'Buffer', 'TypedArray', 'DataView'], ['string', 'Buffer', 'TypedArray', 'DataView'],
buffer buffer,
); );
} }
}); });

View File

@ -119,7 +119,7 @@ function statusMessageWarn() {
if (statusMessageWarned === false) { if (statusMessageWarned === false) {
process.emitWarning( process.emitWarning(
'Status message is not supported by HTTP/2 (RFC7540 8.1.2.4)', 'Status message is not supported by HTTP/2 (RFC7540 8.1.2.4)',
'UnsupportedWarning' 'UnsupportedWarning',
); );
statusMessageWarned = true; statusMessageWarned = true;
} }
@ -136,7 +136,7 @@ function connectionHeaderMessageWarn() {
'The provided connection header is not valid, ' + 'The provided connection header is not valid, ' +
'the value will be dropped from the header and ' + 'the value will be dropped from the header and ' +
'will never be in use.', 'will never be in use.',
'UnsupportedWarning' 'UnsupportedWarning',
); );
statusConnectionHeaderWarned = true; statusConnectionHeaderWarned = true;
} }

View File

@ -539,7 +539,7 @@ function onStreamClose(code) {
debugStreamObj( debugStreamObj(
stream, 'closed with code %d, closed %s, readable %s', stream, 'closed with code %d, closed %s, readable %s',
code, stream.closed, stream.readable code, stream.closed, stream.readable,
); );
if (!stream.closed) if (!stream.closed)
@ -2123,7 +2123,7 @@ class Http2Stream extends Duplex {
this.once( this.once(
'ready', 'ready',
FunctionPrototypeBind(this[kWriteGeneric], FunctionPrototypeBind(this[kWriteGeneric],
this, writev, data, encoding, cb) this, writev, data, encoding, cb),
); );
return; return;
} }
@ -3096,7 +3096,7 @@ function initializeOptions(options) {
if (options.maxSessionRejectedStreams !== undefined) { if (options.maxSessionRejectedStreams !== undefined) {
validateUint32( validateUint32(
options.maxSessionRejectedStreams, options.maxSessionRejectedStreams,
'maxSessionRejectedStreams' 'maxSessionRejectedStreams',
); );
} }
@ -3233,7 +3233,7 @@ function setupCompat(ev) {
this.on('stream', FunctionPrototypeBind(onServerStream, this.on('stream', FunctionPrototypeBind(onServerStream,
this, this,
this[kOptions].Http2ServerRequest, this[kOptions].Http2ServerRequest,
this[kOptions].Http2ServerResponse) this[kOptions].Http2ServerResponse),
); );
} }
} }
@ -3393,7 +3393,7 @@ binding.setCallbackFunctions(
onAltSvc, onAltSvc,
onOrigin, onOrigin,
onStreamTrailers, onStreamTrailers,
onStreamClose onStreamClose,
); );
// Exports // Exports

View File

@ -376,7 +376,7 @@ function updateSettingsBuffer(settings) {
if (settings.maxHeaderSize !== undefined && if (settings.maxHeaderSize !== undefined &&
(settings.maxHeaderSize !== settings.maxHeaderListSize)) { (settings.maxHeaderSize !== settings.maxHeaderListSize)) {
process.emitWarning( process.emitWarning(
'settings.maxHeaderSize overwrite settings.maxHeaderListSize' 'settings.maxHeaderSize overwrite settings.maxHeaderListSize',
); );
settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE] = settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE] =
settings.maxHeaderSize; settings.maxHeaderSize;
@ -583,7 +583,7 @@ const assertWithinRange = hideStackFrames(
throw new ERR_HTTP2_INVALID_SETTING_VALUE.RangeError( throw new ERR_HTTP2_INVALID_SETTING_VALUE.RangeError(
name, value, min, max); name, value, min, max);
} }
} },
); );
function toHeaderObject(headers, sensitiveHeaders) { function toHeaderObject(headers, sensitiveHeaders) {

View File

@ -13,7 +13,7 @@ let debug = require('internal/util/debuglog').debuglog(
'stream_socket', 'stream_socket',
(fn) => { (fn) => {
debug = fn; debug = fn;
} },
); );
const { owner_symbol } = require('internal/async_hooks').symbols; const { owner_symbol } = require('internal/async_hooks').symbols;
const { ERR_STREAM_WRAP } = require('internal/errors').codes; const { ERR_STREAM_WRAP } = require('internal/errors').codes;

View File

@ -99,7 +99,7 @@ function requireForUserSnapshot(id) {
if (!BuiltinModule.canBeRequiredByUsers(id)) { if (!BuiltinModule.canBeRequiredByUsers(id)) {
// eslint-disable-next-line no-restricted-syntax // eslint-disable-next-line no-restricted-syntax
const err = new Error( const err = new Error(
`Cannot find module '${id}'. ` `Cannot find module '${id}'. `,
); );
err.code = 'MODULE_NOT_FOUND'; err.code = 'MODULE_NOT_FOUND';
throw err; throw err;

View File

@ -91,7 +91,7 @@ function fold(text, width) {
return RegExpPrototypeSymbolReplace( return RegExpPrototypeSymbolReplace(
new RegExp(`([^\n]{0,${width}})( |$)`, 'g'), new RegExp(`([^\n]{0,${width}})( |$)`, 'g'),
text, text,
(_, newLine, end) => newLine + (end === ' ' ? '\n' : '') (_, newLine, end) => newLine + (end === ' ' ? '\n' : ''),
); );
} }
@ -115,7 +115,7 @@ function getArgDescription(type) {
} }
function format( function format(
{ options, aliases = new SafeMap(), firstColumn, secondColumn } { options, aliases = new SafeMap(), firstColumn, secondColumn },
) { ) {
let text = ''; let text = '';
let maxFirstColumnUsed = 0; let maxFirstColumnUsed = 0;

View File

@ -167,7 +167,7 @@ port.on('message', (message) => {
} else { } else {
assert( assert(
message.type === STDIO_WANTS_MORE_DATA, message.type === STDIO_WANTS_MORE_DATA,
`Unknown worker message type ${message.type}` `Unknown worker message type ${message.type}`,
); );
const { stream } = message; const { stream } = message;
process[stream][kStdioWantsMoreDataCallback](); process[stream][kStdioWantsMoreDataCallback]();

View File

@ -194,21 +194,21 @@ class MIMEParams {
const paramsMap = params.#data; const paramsMap = params.#data;
const endOfSource = SafeStringPrototypeSearch( const endOfSource = SafeStringPrototypeSearch(
StringPrototypeSlice(str, position), StringPrototypeSlice(str, position),
START_ENDING_WHITESPACE START_ENDING_WHITESPACE,
) + position; ) + position;
while (position < endOfSource) { while (position < endOfSource) {
// Skip any whitespace before parameter // Skip any whitespace before parameter
position += SafeStringPrototypeSearch( position += SafeStringPrototypeSearch(
StringPrototypeSlice(str, position), StringPrototypeSlice(str, position),
END_BEGINNING_WHITESPACE END_BEGINNING_WHITESPACE,
); );
// Read until ';' or '=' // Read until ';' or '='
const afterParameterName = SafeStringPrototypeSearch( const afterParameterName = SafeStringPrototypeSearch(
StringPrototypeSlice(str, position), StringPrototypeSlice(str, position),
EQUALS_SEMICOLON_OR_END EQUALS_SEMICOLON_OR_END,
) + position; ) + position;
const parameterString = toASCIILower( const parameterString = toASCIILower(
StringPrototypeSlice(str, position, afterParameterName) StringPrototypeSlice(str, position, afterParameterName),
); );
position = afterParameterName; position = afterParameterName;
// If we found a terminating character // If we found a terminating character
@ -258,7 +258,7 @@ class MIMEParams {
const trimmedValue = StringPrototypeSlice( const trimmedValue = StringPrototypeSlice(
rawValue, rawValue,
0, 0,
SafeStringPrototypeSearch(rawValue, START_ENDING_WHITESPACE) SafeStringPrototypeSearch(rawValue, START_ENDING_WHITESPACE),
); );
// Ignore parameters without values // Ignore parameters without values
if (trimmedValue === '') continue; if (trimmedValue === '') continue;

View File

@ -108,12 +108,12 @@ const {
const packageJsonReader = require('internal/modules/package_json_reader'); const packageJsonReader = require('internal/modules/package_json_reader');
const { getOptionValue, getEmbedderOptions } = require('internal/options'); const { getOptionValue, getEmbedderOptions } = require('internal/options');
const policy = getLazy( const policy = getLazy(
() => (getOptionValue('--experimental-policy') ? require('internal/process/policy') : null) () => (getOptionValue('--experimental-policy') ? require('internal/process/policy') : null),
); );
const shouldReportRequiredModules = getLazy(() => process.env.WATCH_REPORT_DEPENDENCIES); const shouldReportRequiredModules = getLazy(() => process.env.WATCH_REPORT_DEPENDENCIES);
const getCascadedLoader = getLazy( const getCascadedLoader = getLazy(
() => require('internal/process/esm_loader').esmLoader () => require('internal/process/esm_loader').esmLoader,
); );
// Whether any user-provided CJS modules had been loaded (executed). // Whether any user-provided CJS modules had been loaded (executed).
@ -289,13 +289,13 @@ function initializeCJS() {
getModuleParent, getModuleParent,
'module.parent is deprecated due to accuracy issues. Please use ' + 'module.parent is deprecated due to accuracy issues. Please use ' +
'require.main to find program entry point instead.', 'require.main to find program entry point instead.',
'DEP0144' 'DEP0144',
) : getModuleParent, ) : getModuleParent,
set: pendingDeprecation ? deprecate( set: pendingDeprecation ? deprecate(
setModuleParent, setModuleParent,
'module.parent is deprecated due to accuracy issues. Please use ' + 'module.parent is deprecated due to accuracy issues. Please use ' +
'require.main to find program entry point instead.', 'require.main to find program entry point instead.',
'DEP0144' 'DEP0144',
) : setModuleParent, ) : setModuleParent,
}); });
Module._debug = deprecate(debug, 'Module._debug is deprecated.', 'DEP0077'); Module._debug = deprecate(debug, 'Module._debug is deprecated.', 'DEP0077');
@ -308,7 +308,7 @@ function initializeCJS() {
} }
const allBuiltins = new SafeSet( const allBuiltins = new SafeSet(
ArrayPrototypeFlatMap(builtinModules, (bm) => [bm, `node:${bm}`]) ArrayPrototypeFlatMap(builtinModules, (bm) => [bm, `node:${bm}`]),
); );
BuiltinModule.getSchemeOnlyModuleNames().forEach((builtin) => allBuiltins.add(`node:${builtin}`)); BuiltinModule.getSchemeOnlyModuleNames().forEach((builtin) => allBuiltins.add(`node:${builtin}`));
ObjectFreeze(builtinModules); ObjectFreeze(builtinModules);
@ -418,7 +418,7 @@ function tryPackage(requestPath, exts, isMain, originalPath) {
// eslint-disable-next-line no-restricted-syntax // eslint-disable-next-line no-restricted-syntax
const err = new Error( const err = new Error(
`Cannot find module '${filename}'. ` + `Cannot find module '${filename}'. ` +
'Please verify that the package.json has a valid "main" entry' 'Please verify that the package.json has a valid "main" entry',
); );
err.code = 'MODULE_NOT_FOUND'; err.code = 'MODULE_NOT_FOUND';
err.path = path.resolve(requestPath, 'package.json'); err.path = path.resolve(requestPath, 'package.json');
@ -431,7 +431,7 @@ function tryPackage(requestPath, exts, isMain, originalPath) {
`Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` + `Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` +
'Please either fix that or report it to the module author', 'Please either fix that or report it to the module author',
'DeprecationWarning', 'DeprecationWarning',
'DEP0128' 'DEP0128',
); );
} }
} }
@ -712,7 +712,7 @@ if (isWindows) {
if (p !== nmLen) if (p !== nmLen)
ArrayPrototypePush( ArrayPrototypePush(
paths, paths,
StringPrototypeSlice(from, 0, last) + '\\node_modules' StringPrototypeSlice(from, 0, last) + '\\node_modules',
); );
last = i; last = i;
p = 0; p = 0;
@ -747,7 +747,7 @@ if (isWindows) {
if (p !== nmLen) if (p !== nmLen)
ArrayPrototypePush( ArrayPrototypePush(
paths, paths,
StringPrototypeSlice(from, 0, last) + '/node_modules' StringPrototypeSlice(from, 0, last) + '/node_modules',
); );
last = i; last = i;
p = 0; p = 0;
@ -818,7 +818,7 @@ Module._resolveLookupPaths = function(request, parent) {
function emitCircularRequireWarning(prop) { function emitCircularRequireWarning(prop) {
process.emitWarning( process.emitWarning(
`Accessing non-existent property '${String(prop)}' of module exports ` + `Accessing non-existent property '${String(prop)}' of module exports ` +
'inside circular dependency' 'inside circular dependency',
); );
} }
@ -1393,7 +1393,7 @@ Module._initPaths = function() {
if (nodePath) { if (nodePath) {
ArrayPrototypeUnshiftApply(paths, ArrayPrototypeFilter( ArrayPrototypeUnshiftApply(paths, ArrayPrototypeFilter(
StringPrototypeSplit(nodePath, path.delimiter), StringPrototypeSplit(nodePath, path.delimiter),
Boolean Boolean,
)); ));
} }

View File

@ -136,7 +136,7 @@ function fetchWithRedirects(parsed) {
throw new ERR_NETWORK_IMPORT_DISALLOWED( throw new ERR_NETWORK_IMPORT_DISALLOWED(
res.headers.location, res.headers.location,
parsed.href, parsed.href,
'cannot redirect to non-network location' 'cannot redirect to non-network location',
); );
} }
const entry = await fetchWithRedirects(location); const entry = await fetchWithRedirects(location);
@ -161,7 +161,7 @@ function fetchWithRedirects(parsed) {
if (!contentType) { if (!contentType) {
throw new ERR_NETWORK_IMPORT_BAD_RESPONSE( throw new ERR_NETWORK_IMPORT_BAD_RESPONSE(
parsed.href, parsed.href,
"the 'Content-Type' header is required" "the 'Content-Type' header is required",
); );
} }
/** /**
@ -252,7 +252,7 @@ function fetchModule(parsed, { parentURL }) {
throw new ERR_NETWORK_IMPORT_DISALLOWED( throw new ERR_NETWORK_IMPORT_DISALLOWED(
href, href,
parentURL, parentURL,
'http can only be used to load local resources (use https instead).' 'http can only be used to load local resources (use https instead).',
); );
} }
return fetchWithRedirects(parsed); return fetchWithRedirects(parsed);

View File

@ -27,7 +27,7 @@ function mimeToFormat(mime) {
if ( if (
RegExpPrototypeExec( RegExpPrototypeExec(
/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i, /\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i,
mime mime,
) !== null ) !== null
) return 'module'; ) return 'module';
if (mime === 'application/json') return 'json'; if (mime === 'application/json') return 'json';

View File

@ -86,7 +86,7 @@ function getHttpProtocolModuleFormat(url, context) {
PromiseResolve(fetchModule(url, context)), PromiseResolve(fetchModule(url, context)),
(entry) => { (entry) => {
return mimeToFormat(entry.headers['content-type']); return mimeToFormat(entry.headers['content-type']);
} },
); );
} }
} }

View File

@ -188,7 +188,7 @@ class Hooks {
['getBuiltin', 'port', 'setImportMetaCallback'], ['getBuiltin', 'port', 'setImportMetaCallback'],
{ {
filename: '<preload>', filename: '<preload>',
} },
); );
const { BuiltinModule } = require('internal/bootstrap/loaders'); const { BuiltinModule } = require('internal/bootstrap/loaders');
// We only allow replacing the importMetaInitializer during preload; // We only allow replacing the importMetaInitializer during preload;
@ -504,7 +504,7 @@ class Hooks {
'a string, an ArrayBuffer, or a TypedArray', 'a string, an ArrayBuffer, or a TypedArray',
hookErrIdentifier, hookErrIdentifier,
'source', 'source',
source source,
); );
} }
@ -543,7 +543,7 @@ function pluckHooks({
globalPreload ??= getGlobalPreloadCode; globalPreload ??= getGlobalPreloadCode;
process.emitWarning( process.emitWarning(
'Loader hook "getGlobalPreloadCode" has been renamed to "globalPreload"' 'Loader hook "getGlobalPreloadCode" has been renamed to "globalPreload"',
); );
} }
if (dynamicInstantiate) { if (dynamicInstantiate) {
@ -630,7 +630,7 @@ function nextHookFactory(chain, meta, { validateArgs, validateOutput }) {
// eslint-disable-next-line func-name-matching // eslint-disable-next-line func-name-matching
nextNextHook = function chainAdvancedTooFar() { nextNextHook = function chainAdvancedTooFar() {
throw new ERR_INTERNAL_ASSERTION( throw new ERR_INTERNAL_ASSERTION(
`ESM custom loader '${hookName}' advanced beyond the end of the chain.` `ESM custom loader '${hookName}' advanced beyond the end of the chain.`,
); );
}; };
} }

View File

@ -16,7 +16,7 @@ function createImportMetaResolve(defaultParentUrl) {
({ url }) => url, ({ url }) => url,
(error) => ( (error) => (
error.code === 'ERR_UNSUPPORTED_DIR_IMPORT' ? error.code === 'ERR_UNSUPPORTED_DIR_IMPORT' ?
error.url : PromiseReject(error)) error.url : PromiseReject(error)),
); );
}; };
} }

View File

@ -116,7 +116,7 @@ class ESMLoader {
async eval( async eval(
source, source,
url = pathToFileURL(`${process.cwd()}/[eval${++this.evalIndex}]`).href url = pathToFileURL(`${process.cwd()}/[eval${++this.evalIndex}]`).href,
) { ) {
const evalInstance = (url) => { const evalInstance = (url) => {
const { ModuleWrap } = internalBinding('module_wrap'); const { ModuleWrap } = internalBinding('module_wrap');
@ -234,7 +234,7 @@ class ESMLoader {
importAssertions, importAssertions,
moduleProvider, moduleProvider,
parentURL === undefined, parentURL === undefined,
inspectBrk inspectBrk,
); );
this.moduleMap.set(url, importAssertions.type, job); this.moduleMap.set(url, importAssertions.type, job);

View File

@ -42,7 +42,7 @@ const CJSGlobalLike = [
const isCommonJSGlobalLikeNotDefinedError = (errorMessage) => const isCommonJSGlobalLikeNotDefinedError = (errorMessage) =>
ArrayPrototypeSome( ArrayPrototypeSome(
CJSGlobalLike, CJSGlobalLike,
(globalLike) => errorMessage === `${globalLike} is not defined` (globalLike) => errorMessage === `${globalLike} is not defined`,
); );
/* A ModuleJob tracks the loading of a single Module, and the ModuleJobs of /* A ModuleJob tracks the loading of a single Module, and the ModuleJobs of
@ -135,7 +135,7 @@ class ModuleJob {
const parentFileUrl = RegExpPrototypeSymbolReplace( const parentFileUrl = RegExpPrototypeSymbolReplace(
/:\d+$/, /:\d+$/,
splitStack[0], splitStack[0],
'' '',
); );
const { 1: childSpecifier, 2: name } = RegExpPrototypeExec( const { 1: childSpecifier, 2: name } = RegExpPrototypeExec(
/module '(.*)' does not provide an export named '(.+)'/, /module '(.*)' does not provide an export named '(.+)'/,

View File

@ -64,7 +64,7 @@ function getPackageConfig(path, specifier, base) {
throw new ERR_INVALID_PACKAGE_CONFIG( throw new ERR_INVALID_PACKAGE_CONFIG(
path, path,
(base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier), (base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier),
error.message error.message,
); );
} }

View File

@ -78,7 +78,7 @@ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
base ? ` imported from ${fileURLToPath(base)}` : base ? ` imported from ${fileURLToPath(base)}` :
''}. Mapping specifiers ending in "/" is no longer supported.`, ''}. Mapping specifiers ending in "/" is no longer supported.`,
'DeprecationWarning', 'DeprecationWarning',
'DEP0155' 'DEP0155',
); );
} }
@ -94,7 +94,7 @@ function emitInvalidSegmentDeprecation(target, request, match, pjsonUrl, interna
}in the "${internal ? 'imports' : 'exports'}" field module resolution of the package at ${ }in the "${internal ? 'imports' : 'exports'}" field module resolution of the package at ${
pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ''}.`, pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ''}.`,
'DeprecationWarning', 'DeprecationWarning',
'DEP0166' 'DEP0166',
); );
} }
@ -120,7 +120,7 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
basePath}.\n Automatic extension resolution of the "main" field is ` + basePath}.\n Automatic extension resolution of the "main" field is ` +
'deprecated for ES modules.', 'deprecated for ES modules.',
'DeprecationWarning', 'DeprecationWarning',
'DEP0151' 'DEP0151',
); );
else else
process.emitWarning( process.emitWarning(
@ -129,7 +129,7 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
StringPrototypeSlice(path, pkgPath.length)}", imported from ${basePath StringPrototypeSlice(path, pkgPath.length)}", imported from ${basePath
}.\nDefault "index" lookups for the main are deprecated for ES modules.`, }.\nDefault "index" lookups for the main are deprecated for ES modules.`,
'DeprecationWarning', 'DeprecationWarning',
'DEP0151' 'DEP0151',
); );
} }
@ -391,7 +391,7 @@ function resolvePackageTargetString(
if (pattern) { if (pattern) {
return new URL( return new URL(
RegExpPrototypeSymbolReplace(patternRegEx, resolved.href, () => subpath) RegExpPrototypeSymbolReplace(patternRegEx, resolved.href, () => subpath),
); );
} }
@ -539,7 +539,7 @@ function packageExportsResolve(
const target = exports[packageSubpath]; const target = exports[packageSubpath];
const resolveResult = resolvePackageTarget( const resolveResult = resolvePackageTarget(
packageJSONUrl, target, '', packageSubpath, base, false, false, false, packageJSONUrl, target, '', packageSubpath, base, false, false, false,
conditions conditions,
); );
if (resolveResult == null) { if (resolveResult == null) {
@ -638,7 +638,7 @@ function packageImportsResolve(name, base, conditions) {
!StringPrototypeIncludes(name, '*')) { !StringPrototypeIncludes(name, '*')) {
const resolveResult = resolvePackageTarget( const resolveResult = resolvePackageTarget(
packageJSONUrl, imports[name], '', name, base, false, true, false, packageJSONUrl, imports[name], '', name, base, false, true, false,
conditions conditions,
); );
if (resolveResult != null) { if (resolveResult != null) {
return resolveResult; return resolveResult;
@ -781,7 +781,7 @@ function packageResolve(specifier, base, conditions) {
return legacyMainResolve( return legacyMainResolve(
packageJSONUrl, packageJSONUrl,
packageConfig, packageConfig,
base base,
); );
} }
@ -913,7 +913,7 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
throw new ERR_NETWORK_IMPORT_DISALLOWED( throw new ERR_NETWORK_IMPORT_DISALLOWED(
specifier, specifier,
parsedParentURL, parsedParentURL,
'remote imports cannot import from a local location.' 'remote imports cannot import from a local location.',
); );
} }
@ -924,14 +924,14 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
throw new ERR_NETWORK_IMPORT_DISALLOWED( throw new ERR_NETWORK_IMPORT_DISALLOWED(
specifier, specifier,
parsedParentURL, parsedParentURL,
'remote imports cannot import from a local location.' 'remote imports cannot import from a local location.',
); );
} }
throw new ERR_NETWORK_IMPORT_DISALLOWED( throw new ERR_NETWORK_IMPORT_DISALLOWED(
specifier, specifier,
parsedParentURL, parsedParentURL,
'only relative and absolute specifiers are supported.' 'only relative and absolute specifiers are supported.',
); );
} }
} }
@ -986,7 +986,7 @@ async function defaultResolve(specifier, context = {}) {
reaction(new ERR_MANIFEST_DEPENDENCY_MISSING( reaction(new ERR_MANIFEST_DEPENDENCY_MISSING(
parentURL, parentURL,
specifier, specifier,
ArrayPrototypeJoin([...conditions], ', ')) ArrayPrototypeJoin([...conditions], ', ')),
); );
} }
} }
@ -1059,7 +1059,7 @@ async function defaultResolve(specifier, context = {}) {
specifier, specifier,
parentURL, parentURL,
conditions, conditions,
isMain ? preserveSymlinksMain : preserveSymlinks isMain ? preserveSymlinksMain : preserveSymlinks,
); );
} catch (error) { } catch (error) {
// Try to give the user a hint of what would have been the // Try to give the user a hint of what would have been the
@ -1113,7 +1113,7 @@ if (policy) {
const $defaultResolve = defaultResolve; const $defaultResolve = defaultResolve;
module.exports.defaultResolve = async function defaultResolve( module.exports.defaultResolve = async function defaultResolve(
specifier, specifier,
context context,
) { ) {
const ret = await $defaultResolve(specifier, context); const ret = await $defaultResolve(specifier, context);
// This is a preflight check to avoid data exfiltration by query params etc. // This is a preflight check to avoid data exfiltration by query params etc.
@ -1121,8 +1121,8 @@ if (policy) {
new ERR_MANIFEST_DEPENDENCY_MISSING( new ERR_MANIFEST_DEPENDENCY_MISSING(
context.parentURL, context.parentURL,
specifier, specifier,
context.conditions context.conditions,
) ),
); );
return ret; return ret;
}; };

View File

@ -84,7 +84,7 @@ function assertBufferSource(body, allowString, hookName) {
`${allowString ? 'string, ' : ''}array buffer, or typed array`, `${allowString ? 'string, ' : ''}array buffer, or typed array`,
hookName, hookName,
'source', 'source',
body body,
); );
} }
@ -136,7 +136,7 @@ function enrichCJSError(err, content, filename) {
// asynchronous warning would be emitted. // asynchronous warning would be emitted.
emitWarningSync( emitWarningSync(
'To load an ES module, set "type": "module" in the package.json or use ' + 'To load an ES module, set "type": "module" in the package.json or use ' +
'the .mjs extension.' 'the .mjs extension.',
); );
} }
} }

View File

@ -102,7 +102,7 @@ function makeRequireFunction(mod, redirects) {
reaction(new ERR_MANIFEST_DEPENDENCY_MISSING( reaction(new ERR_MANIFEST_DEPENDENCY_MISSING(
id, id,
specifier, specifier,
ArrayPrototypeJoin([...conditions], ', ') ArrayPrototypeJoin([...conditions], ', '),
)); ));
} }
return mod.require(specifier); return mod.require(specifier);

View File

@ -19,7 +19,7 @@ function read(jsonPath) {
} }
const { 0: string, 1: containsKeys } = internalModuleReadJSON( const { 0: string, 1: containsKeys } = internalModuleReadJSON(
toNamespacedPath(jsonPath) toNamespacedPath(jsonPath),
); );
const result = { string, containsKeys }; const result = { string, containsKeys };
const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('internal/options');

View File

@ -330,11 +330,11 @@ const createSafeIterator = (factory, next) => {
primordials.SafeArrayIterator = createSafeIterator( primordials.SafeArrayIterator = createSafeIterator(
primordials.ArrayPrototypeSymbolIterator, primordials.ArrayPrototypeSymbolIterator,
primordials.ArrayIteratorPrototypeNext primordials.ArrayIteratorPrototypeNext,
); );
primordials.SafeStringIterator = createSafeIterator( primordials.SafeStringIterator = createSafeIterator(
primordials.StringPrototypeSymbolIterator, primordials.StringPrototypeSymbolIterator,
primordials.StringIteratorPrototypeNext primordials.StringIteratorPrototypeNext,
); );
const copyProps = (src, dest) => { const copyProps = (src, dest) => {
@ -394,26 +394,26 @@ primordials.SafeMap = makeSafe(
Map, Map,
class SafeMap extends Map { class SafeMap extends Map {
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
} },
); );
primordials.SafeWeakMap = makeSafe( primordials.SafeWeakMap = makeSafe(
WeakMap, WeakMap,
class SafeWeakMap extends WeakMap { class SafeWeakMap extends WeakMap {
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
} },
); );
primordials.SafeSet = makeSafe( primordials.SafeSet = makeSafe(
Set, Set,
class SafeSet extends Set { class SafeSet extends Set {
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
} },
); );
primordials.SafeWeakSet = makeSafe( primordials.SafeWeakSet = makeSafe(
WeakSet, WeakSet,
class SafeWeakSet extends WeakSet { class SafeWeakSet extends WeakSet {
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
} },
); );
primordials.SafeFinalizationRegistry = makeSafe( primordials.SafeFinalizationRegistry = makeSafe(
@ -421,14 +421,14 @@ primordials.SafeFinalizationRegistry = makeSafe(
class SafeFinalizationRegistry extends FinalizationRegistry { class SafeFinalizationRegistry extends FinalizationRegistry {
// eslint-disable-next-line no-useless-constructor // eslint-disable-next-line no-useless-constructor
constructor(cleanupCallback) { super(cleanupCallback); } constructor(cleanupCallback) { super(cleanupCallback); }
} },
); );
primordials.SafeWeakRef = makeSafe( primordials.SafeWeakRef = makeSafe(
WeakRef, WeakRef,
class SafeWeakRef extends WeakRef { class SafeWeakRef extends WeakRef {
// eslint-disable-next-line no-useless-constructor // eslint-disable-next-line no-useless-constructor
constructor(target) { super(target); } constructor(target) { super(target); }
} },
); );
const SafePromise = makeSafe( const SafePromise = makeSafe(
@ -436,7 +436,7 @@ const SafePromise = makeSafe(
class SafePromise extends Promise { class SafePromise extends Promise {
// eslint-disable-next-line no-useless-constructor // eslint-disable-next-line no-useless-constructor
constructor(executor) { super(executor); } constructor(executor) { super(executor); }
} },
); );
/** /**
@ -454,7 +454,7 @@ primordials.SafePromisePrototypeFinally = (thisPromise, onFinally) =>
new Promise((a, b) => new Promise((a, b) =>
new SafePromise((a, b) => PromisePrototypeThen(thisPromise, a, b)) new SafePromise((a, b) => PromisePrototypeThen(thisPromise, a, b))
.finally(onFinally) .finally(onFinally)
.then(a, b) .then(a, b),
); );
primordials.AsyncIteratorPrototype = primordials.AsyncIteratorPrototype =
@ -467,8 +467,8 @@ const arrayToSafePromiseIterable = (promises, mapFn) =>
ArrayPrototypeMap( ArrayPrototypeMap(
promises, promises,
(promise, i) => (promise, i) =>
new SafePromise((a, b) => PromisePrototypeThen(mapFn == null ? promise : mapFn(promise, i), a, b)) new SafePromise((a, b) => PromisePrototypeThen(mapFn == null ? promise : mapFn(promise, i), a, b)),
) ),
); );
/** /**
@ -481,7 +481,7 @@ primordials.SafePromiseAll = (promises, mapFn) =>
// Wrapping on a new Promise is necessary to not expose the SafePromise // Wrapping on a new Promise is necessary to not expose the SafePromise
// prototype to user-land. // prototype to user-land.
new Promise((a, b) => new Promise((a, b) =>
SafePromise.all(arrayToSafePromiseIterable(promises, mapFn)).then(a, b) SafePromise.all(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),
); );
/** /**
@ -541,7 +541,7 @@ primordials.SafePromiseAllSettled = (promises, mapFn) =>
// Wrapping on a new Promise is necessary to not expose the SafePromise // Wrapping on a new Promise is necessary to not expose the SafePromise
// prototype to user-land. // prototype to user-land.
new Promise((a, b) => new Promise((a, b) =>
SafePromise.allSettled(arrayToSafePromiseIterable(promises, mapFn)).then(a, b) SafePromise.allSettled(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),
); );
/** /**
@ -572,7 +572,7 @@ primordials.SafePromiseAny = (promises, mapFn) =>
// Wrapping on a new Promise is necessary to not expose the SafePromise // Wrapping on a new Promise is necessary to not expose the SafePromise
// prototype to user-land. // prototype to user-land.
new Promise((a, b) => new Promise((a, b) =>
SafePromise.any(arrayToSafePromiseIterable(promises, mapFn)).then(a, b) SafePromise.any(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),
); );
/** /**
@ -585,7 +585,7 @@ primordials.SafePromiseRace = (promises, mapFn) =>
// Wrapping on a new Promise is necessary to not expose the SafePromise // Wrapping on a new Promise is necessary to not expose the SafePromise
// prototype to user-land. // prototype to user-land.
new Promise((a, b) => new Promise((a, b) =>
SafePromise.race(arrayToSafePromiseIterable(promises, mapFn)).then(a, b) SafePromise.race(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),
); );

View File

@ -15,7 +15,7 @@ function eventLoopUtilization(util1, util2) {
milestones[NODE_PERFORMANCE_MILESTONE_LOOP_START] / 1e6, milestones[NODE_PERFORMANCE_MILESTONE_LOOP_START] / 1e6,
loopIdleTime(), loopIdleTime(),
util1, util1,
util2 util2,
); );
} }

View File

@ -453,7 +453,7 @@ function bufferResourceTiming(entry) {
// Calculate the number of items to be pushed to the global buffer. // Calculate the number of items to be pushed to the global buffer.
const numbersToPreserve = MathMax( const numbersToPreserve = MathMax(
MathMin(resourceTimingBufferSizeLimit - resourceTimingBuffer.length, resourceTimingSecondaryBuffer.length), MathMin(resourceTimingBufferSizeLimit - resourceTimingBuffer.length, resourceTimingSecondaryBuffer.length),
0 0,
); );
const excessNumberAfter = resourceTimingSecondaryBuffer.length - numbersToPreserve; const excessNumberAfter = resourceTimingSecondaryBuffer.length - numbersToPreserve;
for (let idx = 0; idx < numbersToPreserve; idx++) { for (let idx = 0; idx < numbersToPreserve; idx++) {

View File

@ -37,7 +37,7 @@ const BufferToString = uncurryThis(Buffer.prototype.toString);
const kRelativeURLStringPattern = /^\.{0,2}\//; const kRelativeURLStringPattern = /^\.{0,2}\//;
const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('internal/options');
const shouldAbortOnUncaughtException = getOptionValue( const shouldAbortOnUncaughtException = getOptionValue(
'--abort-on-uncaught-exception' '--abort-on-uncaught-exception',
); );
const { exitCodes: { kGenericUserError } } = internalBinding('errors'); const { exitCodes: { kGenericUserError } } = internalBinding('errors');
@ -139,7 +139,7 @@ class DependencyMapperInstance {
if (!target) { if (!target) {
throw new ERR_MANIFEST_INVALID_SPECIFIER( throw new ERR_MANIFEST_INVALID_SPECIFIER(
this.href, this.href,
`${target}, pattern needs to have a single trailing "*" in target` `${target}, pattern needs to have a single trailing "*" in target`,
); );
} }
const prefix = target[1]; const prefix = target[1];
@ -193,7 +193,7 @@ class DependencyMapperInstance {
const to = searchDependencies( const to = searchDependencies(
this.href, this.href,
dependencies[normalizedSpecifier], dependencies[normalizedSpecifier],
conditions conditions,
); );
debug({ to }); debug({ to });
if (to === true) { if (to === true) {
@ -218,7 +218,7 @@ class DependencyMapperInstance {
if (parentDependencyMapper === undefined) { if (parentDependencyMapper === undefined) {
parentDependencyMapper = manifest.getScopeDependencyMapper( parentDependencyMapper = manifest.getScopeDependencyMapper(
this.href, this.href,
this.allowSameHREFScope this.allowSameHREFScope,
); );
this.#parentDependencyMapper = parentDependencyMapper; this.#parentDependencyMapper = parentDependencyMapper;
} }
@ -228,7 +228,7 @@ class DependencyMapperInstance {
return parentDependencyMapper._resolveAlreadyNormalized( return parentDependencyMapper._resolveAlreadyNormalized(
normalizedSpecifier, normalizedSpecifier,
conditions, conditions,
manifest manifest,
); );
} }
} }
@ -237,13 +237,13 @@ const kArbitraryDependencies = new DependencyMapperInstance(
'arbitrary dependencies', 'arbitrary dependencies',
kFallThrough, kFallThrough,
false, false,
true true,
); );
const kNoDependencies = new DependencyMapperInstance( const kNoDependencies = new DependencyMapperInstance(
'no dependencies', 'no dependencies',
null, null,
false, false,
true true,
); );
/** /**
* @param {string} href * @param {string} href
@ -257,7 +257,7 @@ const insertDependencyMap = (
dependencies, dependencies,
cascade, cascade,
allowSameHREFScope, allowSameHREFScope,
store store,
) => { ) => {
if (cascade !== undefined && typeof cascade !== 'boolean') { if (cascade !== undefined && typeof cascade !== 'boolean') {
throw new ERR_MANIFEST_INVALID_RESOURCE_FIELD(href, 'cascade'); throw new ERR_MANIFEST_INVALID_RESOURCE_FIELD(href, 'cascade');
@ -271,7 +271,7 @@ const insertDependencyMap = (
href, href,
cascade ? cascade ?
new DependencyMapperInstance(href, null, true, allowSameHREFScope) : new DependencyMapperInstance(href, null, true, allowSameHREFScope) :
kNoDependencies kNoDependencies,
); );
return; return;
} }
@ -282,8 +282,8 @@ const insertDependencyMap = (
href, href,
dependencies, dependencies,
cascade, cascade,
allowSameHREFScope allowSameHREFScope,
) ),
); );
return; return;
} }
@ -442,7 +442,7 @@ class Manifest {
this.#reaction = reaction; this.#reaction = reaction;
const jsonResourcesEntries = ObjectEntries( const jsonResourcesEntries = ObjectEntries(
obj.resources ?? { __proto__: null } obj.resources ?? { __proto__: null },
); );
const jsonScopesEntries = ObjectEntries(obj.scopes ?? { __proto__: null }); const jsonScopesEntries = ObjectEntries(obj.scopes ?? { __proto__: null });
const defaultDependencies = obj.dependencies ?? { __proto__: null }; const defaultDependencies = obj.dependencies ?? { __proto__: null };
@ -450,7 +450,7 @@ class Manifest {
this.#defaultDependencies = new DependencyMapperInstance( this.#defaultDependencies = new DependencyMapperInstance(
'default', 'default',
defaultDependencies === true ? kFallThrough : defaultDependencies, defaultDependencies === true ? kFallThrough : defaultDependencies,
false false,
); );
for (let i = 0; i < jsonResourcesEntries.length; i++) { for (let i = 0; i < jsonResourcesEntries.length; i++) {
@ -475,7 +475,7 @@ class Manifest {
dependencies, dependencies,
cascade, cascade,
true, true,
resourceDependencies resourceDependencies,
); );
} }
@ -519,12 +519,12 @@ class Manifest {
resolve: (specifier, conditions) => { resolve: (specifier, conditions) => {
const normalizedSpecifier = canonicalizeSpecifier( const normalizedSpecifier = canonicalizeSpecifier(
specifier, specifier,
requesterHREF requesterHREF,
); );
const result = instance._resolveAlreadyNormalized( const result = instance._resolveAlreadyNormalized(
normalizedSpecifier, normalizedSpecifier,
conditions, conditions,
this this,
); );
if (result === kFallThrough) return true; if (result === kFallThrough) return true;
return result; return result;
@ -640,7 +640,7 @@ class Manifest {
const scopeHREF = findScopeHREF( const scopeHREF = findScopeHREF(
href, href,
this.#scopeDependencies, this.#scopeDependencies,
allowSameHREFScope allowSameHREFScope,
); );
if (scopeHREF === null) return this.#defaultDependencies; if (scopeHREF === null) return this.#defaultDependencies;
return this.#scopeDependencies.get(scopeHREF); return this.#scopeDependencies.get(scopeHREF);
@ -694,7 +694,7 @@ const emptyOrProtocolOrResolve = (resourceHREF, base) => {
// eslint-disable-next-line // eslint-disable-next-line
/^[\x00-\x1F\x20]|\x09\x0A\x0D|[\x00-\x1F\x20]$/g, /^[\x00-\x1F\x20]|\x09\x0A\x0D|[\x00-\x1F\x20]$/g,
resourceHREF, resourceHREF,
'' '',
); );
if (RegExpPrototypeExec(/^[a-zA-Z][a-zA-Z+\-.]*:$/, resourceHREF) !== null) { if (RegExpPrototypeExec(/^[a-zA-Z][a-zA-Z+\-.]*:$/, resourceHREF) !== null) {
return resourceHREF; return resourceHREF;

View File

@ -99,7 +99,7 @@ exports.loadESM = async function loadESM(callback) {
} }
internalBinding('errors').triggerUncaughtException( internalBinding('errors').triggerUncaughtException(
err, err,
true /* fromPromise */ true, /* fromPromise */
); );
} }
}; };

View File

@ -371,7 +371,7 @@ function buildAllowedFlags() {
forEach(callback, thisArg = undefined) { forEach(callback, thisArg = undefined) {
ArrayPrototypeForEach( ArrayPrototypeForEach(
this[kInternal].array, this[kInternal].array,
(v) => ReflectApply(callback, thisArg, [v, v, this]) (v) => ReflectApply(callback, thisArg, [v, v, this]),
); );
} }
@ -399,7 +399,7 @@ function buildAllowedFlags() {
ObjectFreeze(NodeEnvironmentFlagsSet.prototype); ObjectFreeze(NodeEnvironmentFlagsSet.prototype);
return ObjectFreeze(new NodeEnvironmentFlagsSet( return ObjectFreeze(new NodeEnvironmentFlagsSet(
allowedNodeEnvironmentFlags allowedNodeEnvironmentFlags,
)); ));
} }

View File

@ -280,11 +280,11 @@ function setupWebCrypto() {
if (this !== globalThis && this != null) if (this !== globalThis && this != null)
throw new ERR_INVALID_THIS( throw new ERR_INVALID_THIS(
'nullish or must be the global object'); 'nullish or must be the global object');
} },
); );
exposeLazyInterfaces( exposeLazyInterfaces(
globalThis, 'internal/crypto/webcrypto', globalThis, 'internal/crypto/webcrypto',
['Crypto', 'CryptoKey', 'SubtleCrypto'] ['Crypto', 'CryptoKey', 'SubtleCrypto'],
); );
} else { } else {
ObjectDefineProperty(globalThis, 'crypto', ObjectDefineProperty(globalThis, 'crypto',

View File

@ -130,7 +130,7 @@ function promiseRejectHandler(type, promise, reason) {
const multipleResolvesDeprecate = deprecate( const multipleResolvesDeprecate = deprecate(
() => {}, () => {},
'The multipleResolves event has been deprecated.', 'The multipleResolves event has been deprecated.',
'DEP0160' 'DEP0160',
); );
function resolveError(type, promise, reason) { function resolveError(type, promise, reason) {
// We have to wrap this in a next tick. Otherwise the error could be caught by // We have to wrap this in a next tick. Otherwise the error could be caught by
@ -193,7 +193,7 @@ function emitUnhandledRejectionWarning(uid, reason) {
'To terminate the node process on unhandled promise ' + 'To terminate the node process on unhandled promise ' +
'rejection, use the CLI flag `--unhandled-rejections=strict` (see ' + 'rejection, use the CLI flag `--unhandled-rejections=strict` (see ' +
'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). ' + 'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). ' +
`(rejection id: ${uid})` `(rejection id: ${uid})`,
); );
try { try {
if (isErrorLike(reason)) { if (isErrorLike(reason)) {
@ -250,7 +250,7 @@ function processPromiseRejections() {
pushAsyncContext( pushAsyncContext(
promiseAsyncId, promiseAsyncId,
promiseTriggerAsyncId, promiseTriggerAsyncId,
promise promise,
); );
} }
try { try {
@ -264,7 +264,7 @@ function processPromiseRejections() {
pushAsyncContext( pushAsyncContext(
promise[kAsyncIdSymbol], promise[kAsyncIdSymbol],
promise[kTriggerAsyncIdSymbol], promise[kTriggerAsyncIdSymbol],
promise promise,
); );
} }
const handled = emit(reason, promise, promiseInfo); const handled = emit(reason, promise, promiseInfo);

View File

@ -151,7 +151,7 @@ function queueMicrotask(callback) {
const asyncResource = new AsyncResource( const asyncResource = new AsyncResource(
'Microtask', 'Microtask',
defaultMicrotaskResourceOpts defaultMicrotaskResourceOpts,
); );
asyncResource.callback = callback; asyncResource.callback = callback;

View File

@ -169,7 +169,7 @@ function InterfaceConstructor(input, output, completer, terminal) {
} else { } else {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'input.escapeCodeTimeout', 'input.escapeCodeTimeout',
this.escapeCodeTimeout this.escapeCodeTimeout,
); );
} }
} }
@ -625,7 +625,7 @@ class Interface extends InterfaceConstructor {
const end = StringPrototypeSlice( const end = StringPrototypeSlice(
this.line, this.line,
this.cursor, this.cursor,
this.line.length this.line.length,
); );
this.line = beg + c + end; this.line = beg + c + end;
this.cursor += c.length; this.cursor += c.length;
@ -668,7 +668,7 @@ class Interface extends InterfaceConstructor {
// If there is a common prefix to all matches, then apply that portion. // If there is a common prefix to all matches, then apply that portion.
const prefix = commonPrefix( const prefix = commonPrefix(
ArrayPrototypeFilter(completions, (e) => e !== '') ArrayPrototypeFilter(completions, (e) => e !== ''),
); );
if (StringPrototypeStartsWith(prefix, completeOn) && if (StringPrototypeStartsWith(prefix, completeOn) &&
prefix.length > completeOn.length) { prefix.length > completeOn.length) {
@ -695,7 +695,7 @@ class Interface extends InterfaceConstructor {
// Apply/show completions. // Apply/show completions.
const completionsWidth = ArrayPrototypeMap(completions, (e) => const completionsWidth = ArrayPrototypeMap(completions, (e) =>
getStringWidth(e) getStringWidth(e),
); );
const width = MathMaxApply(completionsWidth) + 2; // 2 space padding const width = MathMaxApply(completionsWidth) + 2; // 2 space padding
let maxColumns = MathFloor(this.columns / width) || 1; let maxColumns = MathFloor(this.columns / width) || 1;
@ -736,7 +736,7 @@ class Interface extends InterfaceConstructor {
const leading = StringPrototypeSlice(this.line, 0, this.cursor); const leading = StringPrototypeSlice(this.line, 0, this.cursor);
const reversed = ArrayPrototypeJoin( const reversed = ArrayPrototypeJoin(
ArrayPrototypeReverse(ArrayFrom(leading)), ArrayPrototypeReverse(ArrayFrom(leading)),
'' '',
); );
const match = RegExpPrototypeExec(/^\s*(?:[^\w\s]+|\w+)?/, reversed); const match = RegExpPrototypeExec(/^\s*(?:[^\w\s]+|\w+)?/, reversed);
this[kMoveCursor](-match[0].length); this[kMoveCursor](-match[0].length);
@ -775,7 +775,7 @@ class Interface extends InterfaceConstructor {
StringPrototypeSlice( StringPrototypeSlice(
this.line, this.line,
this.cursor + charSize, this.cursor + charSize,
this.line.length this.line.length,
); );
this[kRefreshLine](); this[kRefreshLine]();
} }
@ -789,13 +789,13 @@ class Interface extends InterfaceConstructor {
let leading = StringPrototypeSlice(this.line, 0, this.cursor); let leading = StringPrototypeSlice(this.line, 0, this.cursor);
const reversed = ArrayPrototypeJoin( const reversed = ArrayPrototypeJoin(
ArrayPrototypeReverse(ArrayFrom(leading)), ArrayPrototypeReverse(ArrayFrom(leading)),
'' '',
); );
const match = RegExpPrototypeExec(/^\s*(?:[^\w\s]+|\w+)?/, reversed); const match = RegExpPrototypeExec(/^\s*(?:[^\w\s]+|\w+)?/, reversed);
leading = StringPrototypeSlice( leading = StringPrototypeSlice(
leading, leading,
0, 0,
leading.length - match[0].length leading.length - match[0].length,
); );
this.line = this.line =
leading + leading +
@ -1073,7 +1073,7 @@ class Interface extends InterfaceConstructor {
this[kSubstringSearch] = StringPrototypeSlice( this[kSubstringSearch] = StringPrototypeSlice(
this.line, this.line,
0, 0,
this.cursor this.cursor,
); );
} }
} else if (this[kSubstringSearch] !== null) { } else if (this[kSubstringSearch] !== null) {

View File

@ -336,7 +336,7 @@ function* emitKeys(stream) {
} else if (!escaped && ch <= '\x1a') { } else if (!escaped && ch <= '\x1a') {
// ctrl+letter // ctrl+letter
key.name = StringFromCharCode( key.name = StringFromCharCode(
StringPrototypeCharCodeAt(ch) + StringPrototypeCharCodeAt('a') - 1 StringPrototypeCharCodeAt(ch) + StringPrototypeCharCodeAt('a') - 1,
); );
key.ctrl = true; key.ctrl = true;
} else if (RegExpPrototypeExec(/^[0-9A-Za-z]$/, ch) !== null) { } else if (RegExpPrototypeExec(/^[0-9A-Za-z]$/, ch) !== null) {

View File

@ -33,7 +33,7 @@ const visitorsWithoutAncestors = {
state.prepend(node, `${node.id.name}=`); state.prepend(node, `${node.id.name}=`);
ArrayPrototypePush( ArrayPrototypePush(
state.hoistedDeclarationStatements, state.hoistedDeclarationStatements,
`let ${node.id.name}; ` `let ${node.id.name}; `,
); );
} }
@ -49,7 +49,7 @@ const visitorsWithoutAncestors = {
state.prepend(node, `this.${node.id.name} = ${node.id.name}; `); state.prepend(node, `this.${node.id.name} = ${node.id.name}; `);
ArrayPrototypePush( ArrayPrototypePush(
state.hoistedDeclarationStatements, state.hoistedDeclarationStatements,
`var ${node.id.name}; ` `var ${node.id.name}; `,
); );
}, },
FunctionExpression: noop, FunctionExpression: noop,
@ -67,7 +67,7 @@ const visitorsWithoutAncestors = {
const variableKind = node.kind; const variableKind = node.kind;
const isIterableForDeclaration = ArrayPrototypeIncludes( const isIterableForDeclaration = ArrayPrototypeIncludes(
['ForOfStatement', 'ForInStatement'], ['ForOfStatement', 'ForInStatement'],
state.ancestors[state.ancestors.length - 2].type state.ancestors[state.ancestors.length - 2].type,
); );
if (variableKind === 'var' || isTopLevelDeclaration(state)) { if (variableKind === 'var' || isTopLevelDeclaration(state)) {
@ -76,7 +76,7 @@ const visitorsWithoutAncestors = {
node.start + variableKind.length + (isIterableForDeclaration ? 1 : 0), node.start + variableKind.length + (isIterableForDeclaration ? 1 : 0),
variableKind === 'var' && isIterableForDeclaration ? variableKind === 'var' && isIterableForDeclaration ?
'' : '' :
'void' + (node.declarations.length === 1 ? '' : ' (') 'void' + (node.declarations.length === 1 ? '' : ' ('),
); );
if (!isIterableForDeclaration) { if (!isIterableForDeclaration) {
@ -99,7 +99,7 @@ const visitorsWithoutAncestors = {
case 'Identifier': case 'Identifier':
ArrayPrototypePush( ArrayPrototypePush(
variableIdentifiersToHoist[variableKind === 'var' ? 0 : 1][1], variableIdentifiersToHoist[variableKind === 'var' ? 0 : 1][1],
node.name node.name,
); );
break; break;
case 'ObjectPattern': case 'ObjectPattern':
@ -125,10 +125,10 @@ const visitorsWithoutAncestors = {
if (identifiers.length > 0) { if (identifiers.length > 0) {
ArrayPrototypePush( ArrayPrototypePush(
state.hoistedDeclarationStatements, state.hoistedDeclarationStatements,
`${kind} ${ArrayPrototypeJoin(identifiers, ', ')}; ` `${kind} ${ArrayPrototypeJoin(identifiers, ', ')}; `,
); );
} }
} },
); );
} }

View File

@ -167,7 +167,7 @@ function _replHistoryMessage() {
this, this,
'\nPersistent history support disabled. ' + '\nPersistent history support disabled. ' +
'Set the NODE_REPL_HISTORY environment\nvariable to ' + 'Set the NODE_REPL_HISTORY environment\nvariable to ' +
'a valid, user-writable path to enable.\n' 'a valid, user-writable path to enable.\n',
); );
} }
this._historyPrev = Interface.prototype._historyPrev; this._historyPrev = Interface.prototype._historyPrev;

View File

@ -123,7 +123,7 @@ function isRecoverableError(e, code) {
super.raise(pos, message); super.raise(pos, message);
} }
}; };
} },
); );
// Try to parse the code with acorn. If the parse fails, ignore the acorn // Try to parse the code with acorn. If the parse fails, ignore the acorn
@ -291,7 +291,7 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) {
(e) => StringPrototypeReplaceAll( (e) => StringPrototypeReplaceAll(
StringPrototypeToLowerCase(e), StringPrototypeToLowerCase(e),
'_', '_',
'-' '-',
)), )),
'--use-strict'); '--use-strict');
} }

View File

@ -115,7 +115,7 @@ function getOriginalSymbolName(sourceMap, trace, curIndex) {
// First check for a symbol name associated with the enclosing function: // First check for a symbol name associated with the enclosing function:
const enclosingEntry = sourceMap.findEntry( const enclosingEntry = sourceMap.findEntry(
trace[curIndex].getEnclosingLineNumber() - 1, trace[curIndex].getEnclosingLineNumber() - 1,
trace[curIndex].getEnclosingColumnNumber() - 1 trace[curIndex].getEnclosingColumnNumber() - 1,
); );
if (enclosingEntry.name) return enclosingEntry.name; if (enclosingEntry.name) return enclosingEntry.name;
// Fallback to using the symbol name attached to the next stack frame: // Fallback to using the symbol name attached to the next stack frame:
@ -124,7 +124,7 @@ function getOriginalSymbolName(sourceMap, trace, curIndex) {
if (nextCallSite && currentFileName === nextCallSite.getFileName()) { if (nextCallSite && currentFileName === nextCallSite.getFileName()) {
const { name } = sourceMap.findEntry( const { name } = sourceMap.findEntry(
nextCallSite.getLineNumber() - 1, nextCallSite.getLineNumber() - 1,
nextCallSite.getColumnNumber() - 1 nextCallSite.getColumnNumber() - 1,
); );
return name; return name;
} }
@ -137,14 +137,14 @@ function getErrorSource(
sourceMap, sourceMap,
originalSourcePath, originalSourcePath,
originalLine, originalLine,
originalColumn originalColumn,
) { ) {
const originalSourcePathNoScheme = const originalSourcePathNoScheme =
StringPrototypeStartsWith(originalSourcePath, 'file://') ? StringPrototypeStartsWith(originalSourcePath, 'file://') ?
fileURLToPath(originalSourcePath) : originalSourcePath; fileURLToPath(originalSourcePath) : originalSourcePath;
const source = getOriginalSource( const source = getOriginalSource(
sourceMap.payload, sourceMap.payload,
originalSourcePath originalSourcePath,
); );
if (typeof source !== 'string') { if (typeof source !== 'string') {
return; return;

View File

@ -264,7 +264,7 @@ class SourceMap {
ArrayPrototypePush( ArrayPrototypePush(
this.#mappings, this.#mappings,
[lineNumber, columnNumber, sourceURL, sourceLineNumber, [lineNumber, columnNumber, sourceURL, sourceLineNumber,
sourceColumnNumber, name] sourceColumnNumber, name],
); );
} }
} }

View File

@ -45,14 +45,14 @@ module.exports = function compose(...streams) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
`streams[${n}]`, `streams[${n}]`,
orgStreams[n], orgStreams[n],
'must be readable' 'must be readable',
); );
} }
if (n > 0 && !isWritable(streams[n])) { if (n > 0 && !isWritable(streams[n])) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
`streams[${n}]`, `streams[${n}]`,
orgStreams[n], orgStreams[n],
'must be writable' 'must be writable',
); );
} }
} }

View File

@ -109,7 +109,7 @@ module.exports = function duplexify(body, name) {
}, },
(err) => { (err) => {
destroyer(d, err); destroyer(d, err);
} },
); );
return d = new Duplexify({ return d = new Duplexify({
@ -186,7 +186,7 @@ module.exports = function duplexify(body, name) {
}, },
(err) => { (err) => {
destroyer(d, err); destroyer(d, err);
} },
); );
return d = new Duplexify({ return d = new Duplexify({

View File

@ -288,7 +288,7 @@ function eosWeb(stream, options, callback) {
PromisePrototypeThen( PromisePrototypeThen(
stream[kIsClosedPromise].promise, stream[kIsClosedPromise].promise,
resolverFn, resolverFn,
resolverFn resolverFn,
); );
return nop; return nop;
} }

View File

@ -56,7 +56,7 @@ function compose(stream, options) {
// Not validating as we already validated before // Not validating as we already validated before
addAbortSignalNoValidate( addAbortSignalNoValidate(
options.signal, options.signal,
composedStream composedStream,
); );
} }

View File

@ -679,7 +679,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
if (!state.multiAwaitDrain) { if (!state.multiAwaitDrain) {
state.multiAwaitDrain = true; state.multiAwaitDrain = true;
state.awaitDrainWriters = new SafeSet( state.awaitDrainWriters = new SafeSet(
state.awaitDrainWriters ? [state.awaitDrainWriters] : [] state.awaitDrainWriters ? [state.awaitDrainWriters] : [],
); );
} }
} }

View File

@ -221,15 +221,15 @@ class TestCoverage {
coverageSummary.totals.coveredLinePercent = toPercentage( coverageSummary.totals.coveredLinePercent = toPercentage(
coverageSummary.totals.coveredLineCount, coverageSummary.totals.coveredLineCount,
coverageSummary.totals.totalLineCount coverageSummary.totals.totalLineCount,
); );
coverageSummary.totals.coveredBranchPercent = toPercentage( coverageSummary.totals.coveredBranchPercent = toPercentage(
coverageSummary.totals.coveredBranchCount, coverageSummary.totals.coveredBranchCount,
coverageSummary.totals.totalBranchCount coverageSummary.totals.totalBranchCount,
); );
coverageSummary.totals.coveredFunctionPercent = toPercentage( coverageSummary.totals.coveredFunctionPercent = toPercentage(
coverageSummary.totals.coveredFunctionCount, coverageSummary.totals.coveredFunctionCount,
coverageSummary.totals.totalFunctionCount coverageSummary.totals.totalFunctionCount,
); );
coverageSummary.files.sort(sortCoverageFiles); coverageSummary.files.sort(sortCoverageFiles);

View File

@ -161,7 +161,7 @@ class MockTracker {
if (setter && getter) { if (setter && getter) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'options.setter', setter, "cannot be used with 'options.getter'" 'options.setter', setter, "cannot be used with 'options.getter'",
); );
} }
const descriptor = findMethodOnPrototypeChain(objectOrFunction, methodName); const descriptor = findMethodOnPrototypeChain(objectOrFunction, methodName);
@ -178,7 +178,7 @@ class MockTracker {
if (typeof original !== 'function') { if (typeof original !== 'function') {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'methodName', original, 'must be a method' 'methodName', original, 'must be a method',
); );
} }
@ -213,7 +213,7 @@ class MockTracker {
object, object,
methodName, methodName,
implementation = kDefaultFunction, implementation = kDefaultFunction,
options = kEmptyObject options = kEmptyObject,
) { ) {
if (implementation !== null && typeof implementation === 'object') { if (implementation !== null && typeof implementation === 'object') {
options = implementation; options = implementation;
@ -226,7 +226,7 @@ class MockTracker {
if (getter === false) { if (getter === false) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'options.getter', getter, 'cannot be false' 'options.getter', getter, 'cannot be false',
); );
} }
@ -240,7 +240,7 @@ class MockTracker {
object, object,
methodName, methodName,
implementation = kDefaultFunction, implementation = kDefaultFunction,
options = kEmptyObject options = kEmptyObject,
) { ) {
if (implementation !== null && typeof implementation === 'object') { if (implementation !== null && typeof implementation === 'object') {
options = implementation; options = implementation;
@ -253,7 +253,7 @@ class MockTracker {
if (setter === false) { if (setter === false) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'options.setter', setter, 'cannot be false' 'options.setter', setter, 'cannot be false',
); );
} }

View File

@ -243,13 +243,13 @@ function jsToYaml(indent, name, value) {
const processed = RegExpPrototypeSymbolReplace( const processed = RegExpPrototypeSymbolReplace(
kFrameStartRegExp, kFrameStartRegExp,
frame, frame,
'' '',
); );
if (processed.length > 0 && processed.length !== frame.length) { if (processed.length > 0 && processed.length !== frame.length) {
ArrayPrototypePush(frames, processed); ArrayPrototypePush(frames, processed);
} }
} },
); );
if (frames.length > 0) { if (frames.length > 0) {

View File

@ -181,7 +181,7 @@ class FileTest extends Test {
node.id, node.id,
node.description, node.description,
YAMLToJs(node.diagnostics), YAMLToJs(node.diagnostics),
directive directive,
); );
} else { } else {
this.reporter.fail( this.reporter.fail(
@ -190,7 +190,7 @@ class FileTest extends Test {
node.id, node.id,
node.description, node.description,
YAMLToJs(node.diagnostics), YAMLToJs(node.diagnostics),
directive directive,
); );
} }
break; break;

View File

@ -24,7 +24,7 @@ class TAPValidationStrategy {
#validateVersion(ast) { #validateVersion(ast) {
const entry = ArrayPrototypeFind( const entry = ArrayPrototypeFind(
ast, ast,
(node) => node.kind === TokenKind.TAP_VERSION (node) => node.kind === TokenKind.TAP_VERSION,
); );
if (!entry) { if (!entry) {
@ -42,7 +42,7 @@ class TAPValidationStrategy {
#validatePlan(ast) { #validatePlan(ast) {
const entry = ArrayPrototypeFind( const entry = ArrayPrototypeFind(
ast, ast,
(node) => node.kind === TokenKind.TAP_PLAN (node) => node.kind === TokenKind.TAP_PLAN,
); );
if (!entry) { if (!entry) {
@ -64,7 +64,7 @@ class TAPValidationStrategy {
if (planEnd !== 0 && planStart > planEnd) { if (planEnd !== 0 && planStart > planEnd) {
throw new ERR_TAP_VALIDATION_ERROR( throw new ERR_TAP_VALIDATION_ERROR(
`plan start ${planStart} is greater than plan end ${planEnd}` `plan start ${planStart} is greater than plan end ${planEnd}`,
); );
} }
} }
@ -76,15 +76,15 @@ class TAPValidationStrategy {
#validateTestPoints(ast) { #validateTestPoints(ast) {
const bailoutEntry = ArrayPrototypeFind( const bailoutEntry = ArrayPrototypeFind(
ast, ast,
(node) => node.kind === TokenKind.TAP_BAIL_OUT (node) => node.kind === TokenKind.TAP_BAIL_OUT,
); );
const planEntry = ArrayPrototypeFind( const planEntry = ArrayPrototypeFind(
ast, ast,
(node) => node.kind === TokenKind.TAP_PLAN (node) => node.kind === TokenKind.TAP_PLAN,
); );
const testPointEntries = ArrayPrototypeFilter( const testPointEntries = ArrayPrototypeFilter(
ast, ast,
(node) => node.kind === TokenKind.TAP_TEST_POINT (node) => node.kind === TokenKind.TAP_TEST_POINT,
); );
const plan = planEntry.node; const plan = planEntry.node;
@ -96,7 +96,7 @@ class TAPValidationStrategy {
throw new ERR_TAP_VALIDATION_ERROR( throw new ERR_TAP_VALIDATION_ERROR(
`found ${testPointEntries.length} Test Point${ `found ${testPointEntries.length} Test Point${
testPointEntries.length > 1 ? 's' : '' testPointEntries.length > 1 ? 's' : ''
} but plan is ${planStart}..0` } but plan is ${planStart}..0`,
); );
} }
@ -107,7 +107,7 @@ class TAPValidationStrategy {
if (!bailoutEntry && testPointEntries.length !== planEnd) { if (!bailoutEntry && testPointEntries.length !== planEnd) {
throw new ERR_TAP_VALIDATION_ERROR( throw new ERR_TAP_VALIDATION_ERROR(
`test Points count ${testPointEntries.length} does not match plan count ${planEnd}` `test Points count ${testPointEntries.length} does not match plan count ${planEnd}`,
); );
} }
@ -117,7 +117,7 @@ class TAPValidationStrategy {
if (testId < planStart || testId > planEnd) { if (testId < planStart || testId > planEnd) {
throw new ERR_TAP_VALIDATION_ERROR( throw new ERR_TAP_VALIDATION_ERROR(
`test ${testId} is out of plan range ${planStart}..${planEnd}` `test ${testId} is out of plan range ${planStart}..${planEnd}`,
); );
} }
} }

View File

@ -200,7 +200,7 @@ class TapLexer {
throw new ERR_TAP_LEXER_ERROR( throw new ERR_TAP_LEXER_ERROR(
`Unexpected character: ${char} at line ${this.#line}, column ${ `Unexpected character: ${char} at line ${this.#line}, column ${
this.#column this.#column
}` }`,
); );
} }

View File

@ -141,7 +141,7 @@ class TapParser extends Transform {
// TODO(@manekinekko): when running in async mode, it doesn't make sense to // TODO(@manekinekko): when running in async mode, it doesn't make sense to
// validate the current chunk. Validation needs to whole AST to be available. // validate the current chunk. Validation needs to whole AST to be available.
throw new ERR_TAP_VALIDATION_ERROR( throw new ERR_TAP_VALIDATION_ERROR(
'TAP validation is not supported for async parsing' 'TAP validation is not supported for async parsing',
); );
} }
// ----------------------------------------------------------------------// // ----------------------------------------------------------------------//
@ -158,12 +158,12 @@ class TapParser extends Transform {
chunkAsString = StringPrototypeReplaceAll( chunkAsString = StringPrototypeReplaceAll(
chunkAsString, chunkAsString,
'[out] ', '[out] ',
'' '',
); );
chunkAsString = StringPrototypeReplaceAll( chunkAsString = StringPrototypeReplaceAll(
chunkAsString, chunkAsString,
'[err] ', '[err] ',
'' '',
); );
if (StringPrototypeEndsWith(chunkAsString, '\n')) { if (StringPrototypeEndsWith(chunkAsString, '\n')) {
chunkAsString = StringPrototypeSlice(chunkAsString, 0, -1); chunkAsString = StringPrototypeSlice(chunkAsString, 0, -1);
@ -303,7 +303,7 @@ class TapParser extends Transform {
message, message,
`, received "${token.value}" (${token.kind})`, `, received "${token.value}" (${token.kind})`,
token, token,
this.#input this.#input,
); );
} }
@ -356,7 +356,7 @@ class TapParser extends Transform {
TokenKind.WHITESPACE, TokenKind.WHITESPACE,
TokenKind.ESCAPE, TokenKind.ESCAPE,
], ],
nextToken.kind nextToken.kind,
) )
) { ) {
const word = this.#next(false).value; const word = this.#next(false).value;
@ -419,7 +419,7 @@ class TapParser extends Transform {
if (this.#bufferedComments.length > 0) { if (this.#bufferedComments.length > 0) {
currentNode.comments = ArrayPrototypeMap( currentNode.comments = ArrayPrototypeMap(
this.#bufferedComments, this.#bufferedComments,
(c) => c.node.comment (c) => c.node.comment,
); );
this.#bufferedComments = []; this.#bufferedComments = [];
} }
@ -496,7 +496,7 @@ class TapParser extends Transform {
// Buffer this node (and also add any pending comments to it) // Buffer this node (and also add any pending comments to it)
ArrayPrototypePush( ArrayPrototypePush(
this.#bufferedTestPoints, this.#bufferedTestPoints,
this.#addCommentsToCurrentNode(currentNode) this.#addCommentsToCurrentNode(currentNode),
); );
break; break;
@ -510,7 +510,7 @@ class TapParser extends Transform {
case TokenKind.TAP_YAML_END: case TokenKind.TAP_YAML_END:
// Emit either the last updated test point (w/ diagnostics) or the current diagnostics node alone // Emit either the last updated test point (w/ diagnostics) or the current diagnostics node alone
this.#emit( this.#emit(
this.#addDiagnosticsToLastTestPoint(currentNode) || currentNode this.#addDiagnosticsToLastTestPoint(currentNode) || currentNode,
); );
break; break;
@ -528,11 +528,11 @@ class TapParser extends Transform {
ArrayPrototypeFilter( ArrayPrototypeFilter(
chunk, chunk,
(token) => (token) =>
token.kind !== TokenKind.NEWLINE && token.kind !== TokenKind.EOF token.kind !== TokenKind.NEWLINE && token.kind !== TokenKind.EOF,
), ),
(token) => token.value (token) => token.value,
), ),
'' '',
); );
} }
@ -947,7 +947,7 @@ class TapParser extends Transform {
nextToken && nextToken &&
ArrayPrototypeIncludes( ArrayPrototypeIncludes(
[TokenKind.NEWLINE, TokenKind.EOF, TokenKind.EOL], [TokenKind.NEWLINE, TokenKind.EOF, TokenKind.EOL],
nextToken.kind nextToken.kind,
) === false ) === false
) { ) {
let isEnabled = true; let isEnabled = true;

View File

@ -71,7 +71,7 @@ const testNamePatternFlag = isTestRunner ? null :
const testNamePatterns = testNamePatternFlag?.length > 0 ? const testNamePatterns = testNamePatternFlag?.length > 0 ?
ArrayPrototypeMap( ArrayPrototypeMap(
testNamePatternFlag, testNamePatternFlag,
(re) => convertStringToRegExp(re, '--test-name-pattern') (re) => convertStringToRegExp(re, '--test-name-pattern'),
) : null; ) : null;
const kShouldAbort = Symbol('kShouldAbort'); const kShouldAbort = Symbol('kShouldAbort');
const kFilename = process.argv?.[1]; const kFilename = process.argv?.[1];
@ -88,7 +88,7 @@ function stopTest(timeout, signal) {
return PromisePrototypeThen(setTimeout(timeout, null, { ref: false, signal }), () => { return PromisePrototypeThen(setTimeout(timeout, null, { ref: false, signal }), () => {
throw new ERR_TEST_FAILURE( throw new ERR_TEST_FAILURE(
`test timed out after ${timeout}ms`, `test timed out after ${timeout}ms`,
kTestTimeoutFailure kTestTimeoutFailure,
); );
}); });
} }
@ -238,7 +238,7 @@ class Test extends AsyncResource {
// eslint-disable-next-line no-use-before-define // eslint-disable-next-line no-use-before-define
const match = this instanceof TestHook || ArrayPrototypeSome( const match = this instanceof TestHook || ArrayPrototypeSome(
testNamePatterns, testNamePatterns,
(re) => RegExpPrototypeExec(re, name) !== null (re) => RegExpPrototypeExec(re, name) !== null,
); );
if (!match) { if (!match) {
@ -380,8 +380,8 @@ class Test extends AsyncResource {
test.fail( test.fail(
new ERR_TEST_FAILURE( new ERR_TEST_FAILURE(
'test could not be started because its parent finished', 'test could not be started because its parent finished',
kParentAlreadyFinished kParentAlreadyFinished,
) ),
); );
} }
@ -401,8 +401,8 @@ class Test extends AsyncResource {
this.fail(error || this.fail(error ||
new ERR_TEST_FAILURE( new ERR_TEST_FAILURE(
'test did not finish before its parent and was cancelled', 'test did not finish before its parent and was cancelled',
kCancelledByParent kCancelledByParent,
) ),
); );
this.startTime = this.startTime || this.endTime; // If a test was canceled before it was started, e.g inside a hook this.startTime = this.startTime || this.endTime; // If a test was canceled before it was started, e.g inside a hook
this.cancelled = true; this.cancelled = true;
@ -538,7 +538,7 @@ class Test extends AsyncResource {
if (isPromise(ret)) { if (isPromise(ret)) {
this.fail(new ERR_TEST_FAILURE( this.fail(new ERR_TEST_FAILURE(
'passed a callback but also returned a Promise', 'passed a callback but also returned a Promise',
kCallbackAndPromisePresent kCallbackAndPromisePresent,
)); ));
await SafePromiseRace([ret, stopPromise]); await SafePromiseRace([ret, stopPromise]);
} else { } else {

View File

@ -47,7 +47,7 @@ function createDeferredCallback() {
if (calledCount === 2) { if (calledCount === 2) {
throw new ERR_TEST_FAILURE( throw new ERR_TEST_FAILURE(
'callback invoked multiple times', 'callback invoked multiple times',
kMultipleCallbackInvocations kMultipleCallbackInvocations,
); );
} }
@ -81,7 +81,7 @@ function convertStringToRegExp(str, name) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
name, name,
str, str,
`is an invalid regular expression.${msg ? ` ${msg}` : ''}` `is an invalid regular expression.${msg ? ` ${msg}` : ''}`,
); );
} }
} }

View File

@ -81,7 +81,7 @@ function validateKeyOrCertOption(name, value) {
'TypedArray', 'TypedArray',
'DataView', 'DataView',
], ],
value value,
); );
} }
} }

View File

@ -94,7 +94,7 @@ function warnOnDeactivatedColors(env) {
if (name !== '') { if (name !== '') {
process.emitWarning( process.emitWarning(
`The '${name}' env is ignored due to the 'FORCE_COLOR' env being set.`, `The '${name}' env is ignored due to the 'FORCE_COLOR' env being set.`,
'Warning' 'Warning',
); );
warned = true; warned = true;
} }

View File

@ -260,7 +260,7 @@ class URLSearchParams {
const length = ArrayPrototypeReduce( const length = ArrayPrototypeReduce(
output, output,
(prev, cur) => prev + removeColors(cur).length + separator.length, (prev, cur) => prev + removeColors(cur).length + separator.length,
-separator.length -separator.length,
); );
if (length > ctx.breakLength) { if (length > ctx.breakLength) {
return `${this.constructor.name} {\n` + return `${this.constructor.name} {\n` +
@ -1158,7 +1158,7 @@ defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', {
} }
return prev; return prev;
}, },
[] [],
); );
const breakLn = StringPrototypeIncludes(inspect(output, innerOpts), '\n'); const breakLn = StringPrototypeIncludes(inspect(output, innerOpts), '\n');
const outputStrs = ArrayPrototypeMap(output, (p) => inspect(p, innerOpts)); const outputStrs = ArrayPrototypeMap(output, (p) => inspect(p, innerOpts));
@ -1222,7 +1222,7 @@ function getPathFromURLWin32(url) {
if ((pathname[n + 1] === '2' && third === 102) || // 2f 2F / if ((pathname[n + 1] === '2' && third === 102) || // 2f 2F /
(pathname[n + 1] === '5' && third === 99)) { // 5c 5C \ (pathname[n + 1] === '5' && third === 99)) { // 5c 5C \
throw new ERR_INVALID_FILE_URL_PATH( throw new ERR_INVALID_FILE_URL_PATH(
'must not include encoded \\ or / characters' 'must not include encoded \\ or / characters',
); );
} }
} }
@ -1258,7 +1258,7 @@ function getPathFromURLPosix(url) {
const third = StringPrototypeCodePointAt(pathname, n + 2) | 0x20; const third = StringPrototypeCodePointAt(pathname, n + 2) | 0x20;
if (pathname[n + 1] === '2' && third === 102) { if (pathname[n + 1] === '2' && third === 102) {
throw new ERR_INVALID_FILE_URL_PATH( throw new ERR_INVALID_FILE_URL_PATH(
'must not include encoded / characters' 'must not include encoded / characters',
); );
} }
} }
@ -1317,14 +1317,14 @@ function pathToFileURL(filepath) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'filepath', 'filepath',
filepath, filepath,
'Missing UNC resource path' 'Missing UNC resource path',
); );
} }
if (hostnameEndIndex === 2) { if (hostnameEndIndex === 2) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'filepath', 'filepath',
filepath, filepath,
'Empty UNC servername' 'Empty UNC servername',
); );
} }
const hostname = StringPrototypeSlice(filepath, 2, hostnameEndIndex); const hostname = StringPrototypeSlice(filepath, 2, hostnameEndIndex);

View File

@ -259,7 +259,7 @@ function innerDeepEqual(val1, val2, strict, memos) {
function getEnumerables(val, keys) { function getEnumerables(val, keys) {
return ArrayPrototypeFilter( return ArrayPrototypeFilter(
keys, keys,
(k) => ObjectPrototypePropertyIsEnumerable(val, k) (k) => ObjectPrototypePropertyIsEnumerable(val, k),
); );
} }

View File

@ -167,8 +167,8 @@ function pathToFileUrlHref(filepath) {
const builtInObjects = new SafeSet( const builtInObjects = new SafeSet(
ArrayPrototypeFilter( ArrayPrototypeFilter(
ObjectGetOwnPropertyNames(globalThis), ObjectGetOwnPropertyNames(globalThis),
(e) => RegExpPrototypeExec(/^[A-Z][a-zA-Z0-9]+$/, e) !== null (e) => RegExpPrototypeExec(/^[A-Z][a-zA-Z0-9]+$/, e) !== null,
) ),
); );
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot // https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
@ -807,7 +807,7 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
context, context,
depth, depth,
getUserOptions(ctx, isCrossContext), getUserOptions(ctx, isCrossContext),
inspect inspect,
); );
// If the custom inspection method returned `this`, don't go into // If the custom inspection method returned `this`, don't go into
// infinite recursion. // infinite recursion.
@ -861,7 +861,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
(ctx.showHidden ? (ctx.showHidden ?
ObjectPrototypeHasOwnProperty : ObjectPrototypeHasOwnProperty :
ObjectPrototypePropertyIsEnumerable)( ObjectPrototypePropertyIsEnumerable)(
value, SymbolToStringTag value, SymbolToStringTag,
))) { ))) {
tag = ''; tag = '';
} }
@ -961,7 +961,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
} else if (isRegExp(value)) { } else if (isRegExp(value)) {
// Make RegExps say that they are RegExps // Make RegExps say that they are RegExps
base = RegExpPrototypeToString( base = RegExpPrototypeToString(
constructor !== null ? value : new RegExp(value) constructor !== null ? value : new RegExp(value),
); );
const prefix = getPrefix(constructor, tag, 'RegExp'); const prefix = getPrefix(constructor, tag, 'RegExp');
if (prefix !== 'RegExp ') if (prefix !== 'RegExp ')
@ -1468,8 +1468,8 @@ function groupArrayElements(ctx, output, value) {
// The added bias increases the columns for short entries. // The added bias increases the columns for short entries.
MathRound( MathRound(
MathSqrt( MathSqrt(
approxCharHeights * biasedMax * outputLength approxCharHeights * biasedMax * outputLength,
) / biasedMax ) / biasedMax,
), ),
// Do not exceed the breakLength. // Do not exceed the breakLength.
MathFloor((ctx.breakLength - ctx.indentationLvl) / actualMax), MathFloor((ctx.breakLength - ctx.indentationLvl) / actualMax),
@ -1477,7 +1477,7 @@ function groupArrayElements(ctx, output, value) {
// minimal grouping. // minimal grouping.
ctx.compact * 4, ctx.compact * 4,
// Limit the columns to a maximum of fifteen. // Limit the columns to a maximum of fifteen.
15 15,
); );
// Return with the original output if no grouping should happen. // Return with the original output if no grouping should happen.
if (columns <= 1) { if (columns <= 1) {
@ -1542,7 +1542,7 @@ function handleMaxCallStackSize(ctx, err, constructorName, indentationLvl) {
return ctx.stylize( return ctx.stylize(
`[${constructorName}: Inspection interrupted ` + `[${constructorName}: Inspection interrupted ` +
'prematurely. Maximum call stack size exceeded.]', 'prematurely. Maximum call stack size exceeded.]',
'special' 'special',
); );
} }
/* c8 ignore next */ /* c8 ignore next */
@ -1597,7 +1597,7 @@ function formatNumber(fn, number, numericSeparator) {
addNumericSeparator(string) addNumericSeparator(string)
}.${ }.${
addNumericSeparatorEnd( addNumericSeparatorEnd(
StringPrototypeSlice(String(number), string.length + 1) StringPrototypeSlice(String(number), string.length + 1),
) )
}`, 'number'); }`, 'number');
} }
@ -1978,7 +1978,7 @@ function formatProperty(ctx, value, recurseTimes, key, type, desc,
const tmp = RegExpPrototypeSymbolReplace( const tmp = RegExpPrototypeSymbolReplace(
strEscapeSequencesReplacer, strEscapeSequencesReplacer,
SymbolPrototypeToString(key), SymbolPrototypeToString(key),
escapeFn escapeFn,
); );
name = `[${ctx.stylize(tmp, 'symbol')}]`; name = `[${ctx.stylize(tmp, 'symbol')}]`;
} else if (key === '__proto__') { } else if (key === '__proto__') {
@ -2157,7 +2157,7 @@ function formatNumberNoColor(number, options) {
return formatNumber( return formatNumber(
stylizeNoColor, stylizeNoColor,
number, number,
options?.numericSeparator ?? inspectDefaultOptions.numericSeparator options?.numericSeparator ?? inspectDefaultOptions.numericSeparator,
); );
} }
@ -2165,7 +2165,7 @@ function formatBigIntNoColor(bigint, options) {
return formatBigInt( return formatBigInt(
stylizeNoColor, stylizeNoColor,
bigint, bigint,
options?.numericSeparator ?? inspectDefaultOptions.numericSeparator options?.numericSeparator ?? inspectDefaultOptions.numericSeparator,
); );
} }

View File

@ -87,7 +87,7 @@ function wrapConsole(consoleFromNode) {
consoleCall, consoleCall,
consoleFromNode, consoleFromNode,
consoleFromVM[key], consoleFromVM[key],
consoleFromNode[key] consoleFromNode[key],
); );
ObjectDefineProperty(consoleFromNode[key], 'name', { ObjectDefineProperty(consoleFromNode[key], 'name', {
__proto__: null, __proto__: null,

View File

@ -195,7 +195,7 @@ function argsToTokens(args, options) {
ArrayPrototypePushApply( ArrayPrototypePushApply(
tokens, ArrayPrototypeMap(remainingArgs, (arg) => { tokens, ArrayPrototypeMap(remainingArgs, (arg) => {
return { kind: 'positional', index: ++index, value: arg }; return { kind: 'positional', index: ++index, value: arg };
}) }),
); );
break; // Finished processing args, leave while loop. break; // Finished processing args, leave while loop.
} }
@ -321,7 +321,7 @@ const parseArgs = (config = kEmptyObject) => {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
`options.${longOption}.short`, `options.${longOption}.short`,
shortOption, shortOption,
'must be a single character' 'must be a single character',
); );
} }
} }
@ -345,7 +345,7 @@ const parseArgs = (config = kEmptyObject) => {
} }
validator(defaultValue, `options.${longOption}.default`); validator(defaultValue, `options.${longOption}.default`);
} }
} },
); );
// Phase 1: identify tokens // Phase 1: identify tokens

View File

@ -165,7 +165,7 @@ function findLongOptionForShort(shortOption, options) {
validateObject(options, 'options'); validateObject(options, 'options');
const longOptionEntry = ArrayPrototypeFind( const longOptionEntry = ArrayPrototypeFind(
ObjectEntries(options), ObjectEntries(options),
({ 1: optionConfig }) => objectGetOwn(optionConfig, 'short') === shortOption ({ 1: optionConfig }) => objectGetOwn(optionConfig, 'short') === shortOption,
); );
return longOptionEntry?.[0] ?? shortOption; return longOptionEntry?.[0] ?? shortOption;
} }

View File

@ -98,7 +98,7 @@ const validateInteger = hideStackFrames(
throw new ERR_OUT_OF_RANGE(name, 'an integer', value); throw new ERR_OUT_OF_RANGE(name, 'an integer', value);
if (value < min || value > max) if (value < min || value > max)
throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value); throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
} },
); );
/** /**
@ -123,7 +123,7 @@ const validateInt32 = hideStackFrames(
if (value < min || value > max) { if (value < min || value > max) {
throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value); throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
} }
} },
); );
/** /**
@ -473,7 +473,7 @@ function validateLinkHeaderFormat(value, name) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
name, name,
value, value,
'must be an array or string of format "</styles.css>; rel=preload; as=style"' 'must be an array or string of format "</styles.css>; rel=preload; as=style"',
); );
} }
} }
@ -516,7 +516,7 @@ function validateLinkHeaderValue(hints) {
throw new ERR_INVALID_ARG_VALUE( throw new ERR_INVALID_ARG_VALUE(
'hints', 'hints',
hints, hints,
'must be an array or string of format "</styles.css>; rel=preload; as=style"' 'must be an array or string of format "</styles.css>; rel=preload; as=style"',
); );
} }

View File

@ -60,7 +60,7 @@ function internalCompileFunction(code, params, options) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'options.parsingContext', 'options.parsingContext',
'Context', 'Context',
parsingContext parsingContext,
); );
} }
} }
@ -79,7 +79,7 @@ function internalCompileFunction(code, params, options) {
produceCachedData, produceCachedData,
parsingContext, parsingContext,
contextExtensions, contextExtensions,
params params,
); );
if (produceCachedData) { if (produceCachedData) {

View File

@ -219,7 +219,7 @@ class Module {
status !== kEvaluated && status !== kEvaluated &&
status !== kErrored) { status !== kErrored) {
throw new ERR_VM_MODULE_STATUS( throw new ERR_VM_MODULE_STATUS(
'must be one of linked, evaluated, or errored' 'must be one of linked, evaluated, or errored',
); );
} }
await this[kWrap].evaluate(timeout, breakOnSigint); await this[kWrap].evaluate(timeout, breakOnSigint);

View File

@ -111,7 +111,7 @@ function newWritableStreamFromStreamWritable(streamWritable) {
throw new ERR_INVALID_ARG_TYPE( throw new ERR_INVALID_ARG_TYPE(
'streamWritable', 'streamWritable',
'stream.Writable', 'stream.Writable',
streamWritable streamWritable,
); );
} }

View File

@ -52,7 +52,7 @@ const nameDescriptor = { __proto__: null, value: 'size' };
const byteSizeFunction = ObjectDefineProperty( const byteSizeFunction = ObjectDefineProperty(
(chunk) => chunk.byteLength, (chunk) => chunk.byteLength,
'name', 'name',
nameDescriptor nameDescriptor,
); );
const countSizeFunction = ObjectDefineProperty(() => 1, 'name', nameDescriptor); const countSizeFunction = ObjectDefineProperty(() => 1, 'name', nameDescriptor);

View File

@ -756,7 +756,7 @@ function createReadableStreamBYOBRequest(controller, view) {
}; };
}, },
[], [],
ReadableStreamBYOBRequest ReadableStreamBYOBRequest,
); );
} }
@ -1592,7 +1592,7 @@ function readableByteStreamTee(stream) {
if (!canceled1 || !canceled2) { if (!canceled1 || !canceled2) {
cancelDeferred.resolve(); cancelDeferred.resolve();
} }
} },
); );
} }
@ -1617,11 +1617,11 @@ function readableByteStreamTee(stream) {
} catch (error) { } catch (error) {
readableByteStreamControllerError( readableByteStreamControllerError(
branch1[kState].controller, branch1[kState].controller,
error error,
); );
readableByteStreamControllerError( readableByteStreamControllerError(
branch2[kState].controller, branch2[kState].controller,
error error,
); );
cancelDeferred.resolve(readableStreamCancel(stream, error)); cancelDeferred.resolve(readableStreamCancel(stream, error));
return; return;
@ -1630,13 +1630,13 @@ function readableByteStreamTee(stream) {
if (!canceled1) { if (!canceled1) {
readableByteStreamControllerEnqueue( readableByteStreamControllerEnqueue(
branch1[kState].controller, branch1[kState].controller,
chunk1 chunk1,
); );
} }
if (!canceled2) { if (!canceled2) {
readableByteStreamControllerEnqueue( readableByteStreamControllerEnqueue(
branch2[kState].controller, branch2[kState].controller,
chunk2 chunk2,
); );
} }
reading = false; reading = false;
@ -1700,11 +1700,11 @@ function readableByteStreamTee(stream) {
} catch (error) { } catch (error) {
readableByteStreamControllerError( readableByteStreamControllerError(
byobBranch[kState].controller, byobBranch[kState].controller,
error error,
); );
readableByteStreamControllerError( readableByteStreamControllerError(
otherBranch[kState].controller, otherBranch[kState].controller,
error error,
); );
cancelDeferred.resolve(readableStreamCancel(stream, error)); cancelDeferred.resolve(readableStreamCancel(stream, error));
return; return;
@ -1712,18 +1712,18 @@ function readableByteStreamTee(stream) {
if (!byobCanceled) { if (!byobCanceled) {
readableByteStreamControllerRespondWithNewView( readableByteStreamControllerRespondWithNewView(
byobBranch[kState].controller, byobBranch[kState].controller,
chunk chunk,
); );
} }
readableByteStreamControllerEnqueue( readableByteStreamControllerEnqueue(
otherBranch[kState].controller, otherBranch[kState].controller,
clonedChunk clonedChunk,
); );
} else if (!byobCanceled) { } else if (!byobCanceled) {
readableByteStreamControllerRespondWithNewView( readableByteStreamControllerRespondWithNewView(
byobBranch[kState].controller, byobBranch[kState].controller,
chunk chunk,
); );
} }
reading = false; reading = false;
@ -1751,7 +1751,7 @@ function readableByteStreamTee(stream) {
if (!byobCanceled) { if (!byobCanceled) {
readableByteStreamControllerRespondWithNewView( readableByteStreamControllerRespondWithNewView(
byobBranch[kState].controller, byobBranch[kState].controller,
chunk chunk,
); );
} }
if ( if (
@ -1760,7 +1760,7 @@ function readableByteStreamTee(stream) {
) { ) {
readableByteStreamControllerRespond( readableByteStreamControllerRespond(
otherBranch[kState].controller, otherBranch[kState].controller,
0 0,
); );
} }
} }
@ -2673,13 +2673,13 @@ function readableByteStreamControllerEnqueue(controller, chunk) {
readableByteStreamControllerInvalidateBYOBRequest(controller); readableByteStreamControllerInvalidateBYOBRequest(controller);
firstPendingPullInto.buffer = transferArrayBuffer( firstPendingPullInto.buffer = transferArrayBuffer(
firstPendingPullInto.buffer firstPendingPullInto.buffer,
); );
if (firstPendingPullInto.type === 'none') { if (firstPendingPullInto.type === 'none') {
readableByteStreamControllerEnqueueDetachedPullIntoToQueue( readableByteStreamControllerEnqueueDetachedPullIntoToQueue(
controller, controller,
firstPendingPullInto firstPendingPullInto,
); );
} }
} }
@ -2725,14 +2725,14 @@ function readableByteStreamControllerEnqueueClonedChunkToQueue(
controller, controller,
buffer, buffer,
byteOffset, byteOffset,
byteLength byteLength,
) { ) {
let cloneResult; let cloneResult;
try { try {
cloneResult = ArrayBufferPrototypeSlice( cloneResult = ArrayBufferPrototypeSlice(
buffer, buffer,
byteOffset, byteOffset,
byteOffset + byteLength byteOffset + byteLength,
); );
} catch (error) { } catch (error) {
readableByteStreamControllerError(controller, error); readableByteStreamControllerError(controller, error);
@ -2742,7 +2742,7 @@ function readableByteStreamControllerEnqueueClonedChunkToQueue(
controller, controller,
cloneResult, cloneResult,
0, 0,
byteLength byteLength,
); );
} }
@ -2763,7 +2763,7 @@ function readableByteStreamControllerEnqueueChunkToQueue(
function readableByteStreamControllerEnqueueDetachedPullIntoToQueue( function readableByteStreamControllerEnqueueDetachedPullIntoToQueue(
controller, controller,
desc desc,
) { ) {
const { const {
buffer, buffer,
@ -2778,7 +2778,7 @@ function readableByteStreamControllerEnqueueDetachedPullIntoToQueue(
controller, controller,
buffer, buffer,
byteOffset, byteOffset,
bytesFilled bytesFilled,
); );
} }
readableByteStreamControllerShiftPendingPullInto(controller); readableByteStreamControllerShiftPendingPullInto(controller);
@ -2893,10 +2893,10 @@ function readableByteStreamControllerRespondInReadableState(
if (type === 'none') { if (type === 'none') {
readableByteStreamControllerEnqueueDetachedPullIntoToQueue( readableByteStreamControllerEnqueueDetachedPullIntoToQueue(
controller, controller,
desc desc,
); );
readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue( readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(
controller controller,
); );
return; return;
} }
@ -3068,7 +3068,7 @@ function readableByteStreamControllerPullSteps(controller, readRequest) {
assert(!readableStreamGetNumReadRequests(stream)); assert(!readableStreamGetNumReadRequests(stream));
readableByteStreamControllerFillReadRequestFromQueue( readableByteStreamControllerFillReadRequestFromQueue(
controller, controller,
readRequest readRequest,
); );
return; return;
} }

Some files were not shown because too many files have changed in this diff Show More