0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 13:09:21 +01:00

lib: add trailing commas to all public core modules

PR-URL: https://github.com/nodejs/node/pull/46848
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
Antoine du Hamel 2023-02-12 19:26:21 +01:00
parent 1101713cc2
commit 9dbb1623ff
No known key found for this signature in database
GPG Key ID: 21D900FFDB233756
30 changed files with 212 additions and 243 deletions

View File

@ -264,58 +264,27 @@ globals:
overrides:
- files:
- ./*/*.js
- ./_*.js
- ./child_process.js
- ./cluster.js
- ./console.js
- ./constants.js
- ./events.js
- ./fs.js
- ./internal/assert.js
- ./internal/child_process.js
- ./*.js
- ./internal/child_process/*.js
- ./internal/cli_table.js
- ./internal/cluster/*.js
- ./internal/debugger/*.js
- ./internal/event_target.js
- ./internal/events/*.js
- ./internal/fixed_queue.js
- ./internal/freelist.js
- ./internal/fs/*.js
- ./internal/heap_utils.js
- ./internal/http.js
- ./internal/idna.js
- ./internal/js_stream_socket.js
- ./internal/mime.js
- ./internal/modules/*.js
- ./internal/per_context/*.js
- ./internal/perf/*.js
- ./internal/policy/*.js
- ./internal/priority_queue.js
- ./internal/process/*.js
- ./internal/readline/*.js
- ./internal/readme.md
- ./internal/repl.js
- ./internal/repl/*.js
- ./internal/source_map/*.js
- ./internal/streams/*.js
- ./internal/structured_clone.js
- ./internal/test/*.js
- ./internal/test_runner/**/*.js
- ./internal/tls/*.js
- ./internal/util/parse_args/*.js
- ./internal/v8_prof_processor.js
- ./internal/vm.js
- ./internal/watch_mode/*.js
- ./internal/webidl.js
- ./internal/webstreams/*.js
- ./module.js
- ./process.js
- ./punycode.js
- ./repl.js
- ./sys.js
- ./test.js
- ./tls.js
- ./url.js
rules:
comma-dangle: [error, always-multiline]

View File

@ -163,7 +163,7 @@ function fail(actual, expected, message, operator, stackStartFn) {
expected,
operator: operator === undefined ? 'fail' : operator,
stackStartFn: stackStartFn || fail,
message
message,
};
const err = new AssertionError(errArgs);
if (internalMessage) {
@ -393,7 +393,7 @@ function innerOk(fn, argLen, value, message) {
expected: true,
message,
operator: '==',
stackStartFn: fn
stackStartFn: fn,
});
err.generatedMessage = generatedMessage;
throw err;
@ -430,7 +430,7 @@ assert.equal = function equal(actual, expected, message) {
expected,
message,
operator: '==',
stackStartFn: equal
stackStartFn: equal,
});
}
};
@ -454,7 +454,7 @@ assert.notEqual = function notEqual(actual, expected, message) {
expected,
message,
operator: '!=',
stackStartFn: notEqual
stackStartFn: notEqual,
});
}
};
@ -477,7 +477,7 @@ assert.deepEqual = function deepEqual(actual, expected, message) {
expected,
message,
operator: 'deepEqual',
stackStartFn: deepEqual
stackStartFn: deepEqual,
});
}
};
@ -500,7 +500,7 @@ assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
expected,
message,
operator: 'notDeepEqual',
stackStartFn: notDeepEqual
stackStartFn: notDeepEqual,
});
}
};
@ -525,7 +525,7 @@ assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
expected,
message,
operator: 'deepStrictEqual',
stackStartFn: deepStrictEqual
stackStartFn: deepStrictEqual,
});
}
};
@ -550,7 +550,7 @@ function notDeepStrictEqual(actual, expected, message) {
expected,
message,
operator: 'notDeepStrictEqual',
stackStartFn: notDeepStrictEqual
stackStartFn: notDeepStrictEqual,
});
}
}
@ -572,7 +572,7 @@ assert.strictEqual = function strictEqual(actual, expected, message) {
expected,
message,
operator: 'strictEqual',
stackStartFn: strictEqual
stackStartFn: strictEqual,
});
}
};
@ -594,7 +594,7 @@ assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
expected,
message,
operator: 'notStrictEqual',
stackStartFn: notStrictEqual
stackStartFn: notStrictEqual,
});
}
};
@ -627,7 +627,7 @@ function compareExceptionKey(actual, expected, key, message, keys, fn) {
actual: a,
expected: b,
operator: 'deepStrictEqual',
stackStartFn: fn
stackStartFn: fn,
});
err.actual = actual;
err.expected = expected;
@ -639,7 +639,7 @@ function compareExceptionKey(actual, expected, key, message, keys, fn) {
expected,
message,
operator: fn.name,
stackStartFn: fn
stackStartFn: fn,
});
}
}
@ -668,7 +668,7 @@ function expectedException(actual, expected, message, fn) {
expected,
message,
operator: 'deepStrictEqual',
stackStartFn: fn
stackStartFn: fn,
});
err.operator = fn.name;
throw err;
@ -743,7 +743,7 @@ function expectedException(actual, expected, message, fn) {
expected,
message,
operator: fn.name,
stackStartFn: fn
stackStartFn: fn,
});
err.generatedMessage = generatedMessage;
throw err;
@ -837,7 +837,7 @@ function expectsError(stackStartFn, actual, error, message) {
expected: error,
operator: stackStartFn.name,
message: `Missing expected ${fnType}${details}`,
stackStartFn
stackStartFn,
});
}
@ -886,7 +886,7 @@ function expectsNoError(stackStartFn, actual, error, message) {
operator: stackStartFn.name,
message: `Got unwanted ${fnType}${details}\n` +
`Actual message: "${actual && actual.message}"`,
stackStartFn
stackStartFn,
});
}
throw actual;
@ -955,7 +955,7 @@ assert.ifError = function ifError(err) {
expected: null,
operator: 'ifError',
message,
stackStartFn: ifError
stackStartFn: ifError,
});
// Make sure we actually have a stack trace!
@ -1020,7 +1020,7 @@ function internalMatch(string, regexp, message, fn) {
expected: regexp,
message,
operator: fn.name,
stackStartFn: fn
stackStartFn: fn,
});
err.generatedMessage = generatedMessage;
throw err;
@ -1064,7 +1064,7 @@ assert.strict = ObjectAssign(strict, assert, {
equal: assert.strictEqual,
deepEqual: assert.deepStrictEqual,
notEqual: assert.notStrictEqual,
notDeepEqual: assert.notDeepStrictEqual
notDeepEqual: assert.notDeepStrictEqual,
});
assert.strict.strict = assert.strict;

View File

@ -18,7 +18,7 @@ const {
const {
ERR_ASYNC_CALLBACK,
ERR_ASYNC_TYPE,
ERR_INVALID_ASYNC_ID
ERR_INVALID_ASYNC_ID,
} = require('internal/errors').codes;
const {
deprecate,
@ -61,7 +61,7 @@ const {
const {
async_id_symbol, trigger_async_id_symbol,
init_symbol, before_symbol, after_symbol, destroy_symbol,
promise_resolve_symbol
promise_resolve_symbol,
} = internal_async_hooks.symbols;
// Get constants
@ -259,7 +259,7 @@ class AsyncResource {
set: deprecate(function(val) {
self = val;
}, 'The asyncResource property on bound functions is deprecated', 'DEP0172'),
}
},
});
return bound;
}
@ -278,7 +278,7 @@ const storageHook = createHook({
for (let i = 0; i < storageList.length; ++i) {
storageList[i]._propagate(resource, currentResource, type);
}
}
},
});
class AsyncLocalStorage {

View File

@ -69,7 +69,7 @@ const {
swap32: _swap32,
swap64: _swap64,
kMaxLength,
kStringMaxLength
kStringMaxLength,
} = internalBinding('buffer');
const {
constants: {
@ -93,7 +93,7 @@ const {
isTypedArray,
} = require('internal/util/types');
const {
inspect: utilInspect
inspect: utilInspect,
} = require('internal/util/inspect');
const { encodings } = internalBinding('string_decoder');
@ -105,7 +105,7 @@ const {
ERR_INVALID_BUFFER_SIZE,
ERR_OUT_OF_RANGE,
ERR_MISSING_ARGS,
ERR_UNKNOWN_ENCODING
ERR_UNKNOWN_ENCODING,
},
genericNodeError,
hideStackFrames,
@ -125,7 +125,7 @@ const {
FastBuffer,
markAsUntransferable,
addBufferPrototypeMethods,
createUnsafeBuffer
createUnsafeBuffer,
} = require('internal/buffer');
FastBuffer.prototype.constructor = Buffer;
@ -137,14 +137,14 @@ const constants = ObjectDefineProperties({}, {
__proto__: null,
value: kMaxLength,
writable: false,
enumerable: true
enumerable: true,
},
MAX_STRING_LENGTH: {
__proto__: null,
value: kStringMaxLength,
writable: false,
enumerable: true
}
enumerable: true,
},
});
Buffer.poolSize = 8 * 1024;
@ -289,7 +289,7 @@ ObjectDefineProperty(Buffer, SymbolSpecies, {
__proto__: null,
enumerable: false,
configurable: true,
get() { return FastBuffer; }
get() { return FastBuffer; },
});
/**
@ -639,7 +639,7 @@ const encodingOps = {
write: (buf, string, offset, len) => buf.utf8Write(string, offset, len),
slice: (buf, start, end) => buf.utf8Slice(start, end),
indexOf: (buf, val, byteOffset, dir) =>
indexOfString(buf, val, byteOffset, encodingsMap.utf8, dir)
indexOfString(buf, val, byteOffset, encodingsMap.utf8, dir),
},
ucs2: {
encoding: 'ucs2',
@ -648,7 +648,7 @@ const encodingOps = {
write: (buf, string, offset, len) => buf.ucs2Write(string, offset, len),
slice: (buf, start, end) => buf.ucs2Slice(start, end),
indexOf: (buf, val, byteOffset, dir) =>
indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir)
indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir),
},
utf16le: {
encoding: 'utf16le',
@ -657,7 +657,7 @@ const encodingOps = {
write: (buf, string, offset, len) => buf.ucs2Write(string, offset, len),
slice: (buf, start, end) => buf.ucs2Slice(start, end),
indexOf: (buf, val, byteOffset, dir) =>
indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir)
indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir),
},
latin1: {
encoding: 'latin1',
@ -666,7 +666,7 @@ const encodingOps = {
write: (buf, string, offset, len) => buf.latin1Write(string, offset, len),
slice: (buf, start, end) => buf.latin1Slice(start, end),
indexOf: (buf, val, byteOffset, dir) =>
indexOfString(buf, val, byteOffset, encodingsMap.latin1, dir)
indexOfString(buf, val, byteOffset, encodingsMap.latin1, dir),
},
ascii: {
encoding: 'ascii',
@ -679,7 +679,7 @@ const encodingOps = {
fromStringFast(val, encodingOps.ascii),
byteOffset,
encodingsMap.ascii,
dir)
dir),
},
base64: {
encoding: 'base64',
@ -692,7 +692,7 @@ const encodingOps = {
fromStringFast(val, encodingOps.base64),
byteOffset,
encodingsMap.base64,
dir)
dir),
},
base64url: {
encoding: 'base64url',
@ -706,7 +706,7 @@ const encodingOps = {
fromStringFast(val, encodingOps.base64url),
byteOffset,
encodingsMap.base64url,
dir)
dir),
},
hex: {
encoding: 'hex',
@ -719,8 +719,8 @@ const encodingOps = {
fromStringFast(val, encodingOps.hex),
byteOffset,
encodingsMap.hex,
dir)
}
dir),
},
};
function getEncodingOps(encoding) {
encoding += '';
@ -806,7 +806,7 @@ ObjectDefineProperty(Buffer.prototype, 'parent', {
if (!(this instanceof Buffer))
return undefined;
return this.buffer;
}
},
});
ObjectDefineProperty(Buffer.prototype, 'offset', {
__proto__: null,
@ -815,7 +815,7 @@ ObjectDefineProperty(Buffer.prototype, 'offset', {
if (!(this instanceof Buffer))
return undefined;
return this.byteOffset;
}
},
});
Buffer.prototype.copy =
@ -902,7 +902,7 @@ Buffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) {
str += StringPrototypeSlice(utilInspect(obj, {
...ctx,
breakLength: Infinity,
compact: true
compact: true,
}), 27, -2);
}
}
@ -1235,7 +1235,7 @@ let transcode;
if (internalBinding('config').hasIntl) {
const {
icuErrName,
transcode: _transcode
transcode: _transcode,
} = internalBinding('icu');
// Transcodes the Buffer from one encoding to another, returning a new
@ -1394,15 +1394,15 @@ ObjectDefineProperties(module.exports, {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
value: constants,
},
INSPECT_MAX_BYTES: {
__proto__: null,
configurable: true,
enumerable: true,
get() { return INSPECT_MAX_BYTES; },
set(val) { INSPECT_MAX_BYTES = val; }
}
set(val) { INSPECT_MAX_BYTES = val; },
},
});
defineLazyProperties(

View File

@ -31,7 +31,7 @@ const {
const {
assertCrypto,
deprecate
deprecate,
} = require('internal/util');
assertCrypto();
@ -59,15 +59,15 @@ const {
} = require('internal/crypto/random');
const {
pbkdf2,
pbkdf2Sync
pbkdf2Sync,
} = require('internal/crypto/pbkdf2');
const {
scrypt,
scryptSync
scryptSync,
} = require('internal/crypto/scrypt');
const {
hkdf,
hkdfSync
hkdfSync,
} = require('internal/crypto/hkdf');
const {
generateKeyPair,
@ -85,7 +85,7 @@ const {
DiffieHellman,
DiffieHellmanGroup,
ECDH,
diffieHellman
diffieHellman,
} = require('internal/crypto/diffiehellman');
const {
Cipher,
@ -102,14 +102,14 @@ const {
Sign,
signOneShot,
Verify,
verifyOneShot
verifyOneShot,
} = require('internal/crypto/sig');
const {
Hash,
Hmac
Hmac,
} = require('internal/crypto/hash');
const {
X509Certificate
X509Certificate,
} = require('internal/crypto/x509');
const {
getCiphers,
@ -277,7 +277,7 @@ ObjectDefineProperty(constants, 'defaultCipherList', {
writable: true,
configurable: true,
enumerable: true,
value
value,
});
return value;
},
@ -287,7 +287,7 @@ ObjectDefineProperty(constants, 'defaultCipherList', {
writable: true,
configurable: true,
enumerable: true,
value: val
value: val,
});
},
configurable: true,
@ -316,7 +316,7 @@ function getRandomBytesAlias(key) {
enumerable: false,
configurable: true,
writable: true,
value: value
value: value,
},
);
return value;
@ -330,10 +330,10 @@ function getRandomBytesAlias(key) {
enumerable: true,
configurable: true,
writable: true,
value
value,
},
);
}
},
};
}
@ -342,13 +342,13 @@ ObjectDefineProperties(module.exports, {
__proto__: null,
enumerable: false,
value: deprecate(createCipher,
'crypto.createCipher is deprecated.', 'DEP0106')
'crypto.createCipher is deprecated.', 'DEP0106'),
},
createDecipher: {
__proto__: null,
enumerable: false,
value: deprecate(createDecipher,
'crypto.createDecipher is deprecated.', 'DEP0106')
'crypto.createDecipher is deprecated.', 'DEP0106'),
},
// crypto.fips is deprecated. DEP0093. Use crypto.getFips()/crypto.setFips()
fips: {
@ -363,13 +363,13 @@ ObjectDefineProperties(module.exports, {
get: deprecate(getDefaultEncoding,
'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'),
set: deprecate(setDefaultEncoding,
'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091')
'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'),
},
constants: {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
value: constants,
},
webcrypto: {
@ -400,5 +400,5 @@ ObjectDefineProperties(module.exports, {
// The ecosystem needs those to exist for backwards compatibility.
prng: getRandomBytesAlias('prng'),
pseudoRandomBytes: getRandomBytesAlias('pseudoRandomBytes'),
rng: getRandomBytesAlias('rng')
rng: getRandomBytesAlias('rng'),
});

View File

@ -49,7 +49,7 @@ const {
ERR_SOCKET_DGRAM_IS_CONNECTED,
ERR_SOCKET_DGRAM_NOT_CONNECTED,
ERR_SOCKET_DGRAM_NOT_RUNNING,
ERR_INVALID_FD_TYPE
ERR_INVALID_FD_TYPE,
} = errors.codes;
const {
isInt32,
@ -64,14 +64,14 @@ const { isArrayBufferView } = require('internal/util/types');
const EventEmitter = require('events');
const {
defaultTriggerAsyncIdScope,
symbols: { async_id_symbol, owner_symbol }
symbols: { async_id_symbol, owner_symbol },
} = require('internal/async_hooks');
const { UV_UDP_REUSEADDR } = internalBinding('constants').os;
const {
constants: { UV_UDP_IPV6ONLY },
UDP,
SendWrap
SendWrap,
} = internalBinding('udp_wrap');
const dc = require('diagnostics_channel');
@ -132,7 +132,7 @@ function Socket(type, listener) {
reuseAddr: options && options.reuseAddr, // Use UV_UDP_REUSEADDR if true.
ipv6Only: options && options.ipv6Only,
recvBufferSize,
sendBufferSize
sendBufferSize,
};
if (options?.signal !== undefined) {
@ -282,7 +282,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
port: null,
addressType: this.type,
fd,
flags: null
flags: null,
}, (err) => {
// Callback to handle error.
const ex = errnoException(err, 'open');
@ -346,7 +346,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
port: port,
addressType: this.type,
fd: -1,
flags: flags
flags: flags,
}, (err) => {
// Callback to handle error.
const ex = exceptionWithHostPort(err, 'bind', ip, port);
@ -995,7 +995,7 @@ ObjectDefineProperty(Socket.prototype, '_handle', {
}, 'Socket.prototype._handle is deprecated', 'DEP0112'),
set: deprecate(function(val) {
this[kStateSymbol].handle = val;
}, 'Socket.prototype._handle is deprecated', 'DEP0112')
}, 'Socket.prototype._handle is deprecated', 'DEP0112'),
});
@ -1006,7 +1006,7 @@ ObjectDefineProperty(Socket.prototype, '_receiving', {
}, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
set: deprecate(function(val) {
this[kStateSymbol].receiving = val;
}, 'Socket.prototype._receiving is deprecated', 'DEP0112')
}, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
});
@ -1017,7 +1017,7 @@ ObjectDefineProperty(Socket.prototype, '_bindState', {
}, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
set: deprecate(function(val) {
this[kStateSymbol].bindState = val;
}, 'Socket.prototype._bindState is deprecated', 'DEP0112')
}, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
});
@ -1028,7 +1028,7 @@ ObjectDefineProperty(Socket.prototype, '_queue', {
}, 'Socket.prototype._queue is deprecated', 'DEP0112'),
set: deprecate(function(val) {
this[kStateSymbol].queue = val;
}, 'Socket.prototype._queue is deprecated', 'DEP0112')
}, 'Socket.prototype._queue is deprecated', 'DEP0112'),
});
@ -1039,7 +1039,7 @@ ObjectDefineProperty(Socket.prototype, '_reuseAddr', {
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
set: deprecate(function(val) {
this[kStateSymbol].reuseAddr = val;
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112')
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
});
@ -1058,7 +1058,7 @@ Socket.prototype._stopReceiving = deprecate(function() {
ObjectDefineProperty(UDP.prototype, 'owner', {
__proto__: null,
get() { return this[owner_symbol]; },
set(v) { return this[owner_symbol] = v; }
set(v) { return this[owner_symbol] = v; },
});
@ -1069,5 +1069,5 @@ module.exports = {
'DEP0112',
),
createSocket,
Socket
Socket,
};

View File

@ -12,7 +12,7 @@ const {
const {
codes: {
ERR_INVALID_ARG_TYPE,
}
},
} = require('internal/errors');
const {
validateFunction,
@ -143,5 +143,5 @@ module.exports = {
hasSubscribers,
subscribe,
unsubscribe,
Channel
Channel,
};

View File

@ -42,7 +42,7 @@ const {
errorCodes: dnsErrorCodes,
} = require('internal/dns/utils');
const {
Resolver
Resolver,
} = require('internal/dns/callback_resolver');
const {
NODATA,
@ -123,7 +123,7 @@ function onlookupall(err, addresses) {
const addr = addresses[i];
addresses[i] = {
address: addr,
family: family || isIP(addr)
family: family || isIP(addr),
};
}
@ -352,6 +352,6 @@ ObjectDefineProperties(module.exports, {
promises = require('internal/dns/promises');
}
return promises;
}
}
},
},
});

View File

@ -47,7 +47,7 @@ const EventEmitter = require('events');
const {
ERR_DOMAIN_CALLBACK_NOT_AVAILABLE,
ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE,
ERR_UNHANDLED_ERROR
ERR_UNHANDLED_ERROR,
} = require('internal/errors').codes;
const { createHook } = require('async_hooks');
const { useDomainTrampoline } = require('internal/async_hooks');
@ -67,7 +67,7 @@ ObjectDefineProperty(process, 'domain', {
},
set: function(arg) {
return _domain[0] = arg;
}
},
});
const vmPromises = new SafeWeakMap();
@ -85,7 +85,7 @@ const asyncHook = createHook({
configurable: true,
enumerable: false,
value: process.domain,
writable: true
writable: true,
});
// Because promises from other contexts don't get a domain field,
// the domain needs to be held alive another way. Stuffing it in a
@ -116,7 +116,7 @@ const asyncHook = createHook({
},
destroy(asyncId) {
pairing.delete(asyncId); // cleaning up
}
},
});
// When domains are in use, they claim full ownership of the
@ -244,7 +244,7 @@ Domain.prototype._errorHandler = function(er) {
configurable: true,
enumerable: false,
value: this,
writable: true
writable: true,
});
er.domainThrown = true;
}
@ -370,7 +370,7 @@ Domain.prototype.add = function(ee) {
configurable: true,
enumerable: false,
value: this,
writable: true
writable: true,
});
ArrayPrototypePush(this.members, ee);
};
@ -403,7 +403,7 @@ function intercepted(_this, self, cb, fnargs) {
configurable: true,
enumerable: false,
value: self,
writable: true
writable: true,
});
self.emit('error', er);
return;
@ -449,7 +449,7 @@ Domain.prototype.bind = function(cb) {
configurable: true,
enumerable: false,
value: this,
writable: true
writable: true,
});
return runBound;
@ -465,7 +465,7 @@ EventEmitter.init = function(opts) {
configurable: true,
enumerable: false,
value: null,
writable: true
writable: true,
});
if (exports.active && !(this instanceof exports.Domain)) {
this.domain = exports.active;
@ -500,7 +500,7 @@ EventEmitter.prototype.emit = function emit(...args) {
configurable: true,
enumerable: false,
value: domain,
writable: true
writable: true,
});
er.domainThrown = false;
}

View File

@ -35,13 +35,13 @@ const { IncomingMessage } = require('_http_incoming');
const {
validateHeaderName,
validateHeaderValue,
OutgoingMessage
OutgoingMessage,
} = require('_http_outgoing');
const {
_connectionListener,
STATUS_CODES,
Server,
ServerResponse
ServerResponse,
} = require('_http_server');
let maxHeaderSize;
@ -130,7 +130,7 @@ module.exports = {
setMaxIdleHTTPParsers(max) {
validateInteger(max, 'max', 1);
parsers.max = max;
}
},
};
ObjectDefineProperty(module.exports, 'maxHeaderSize', {
@ -144,7 +144,7 @@ ObjectDefineProperty(module.exports, 'maxHeaderSize', {
}
return maxHeaderSize;
}
},
});
ObjectDefineProperty(module.exports, 'globalAgent', {
@ -156,5 +156,5 @@ ObjectDefineProperty(module.exports, 'globalAgent', {
},
set(value) {
httpAgent.globalAgent = value;
}
},
});

View File

@ -10,7 +10,7 @@ const {
getUnpackedSettings,
sensitiveHeaders,
Http2ServerRequest,
Http2ServerResponse
Http2ServerResponse,
} = require('internal/http2/core');
module.exports = {
@ -23,5 +23,5 @@ module.exports = {
getUnpackedSettings,
sensitiveHeaders,
Http2ServerRequest,
Http2ServerResponse
Http2ServerResponse,
};

View File

@ -148,7 +148,7 @@ function createConnection(port, host, options) {
debug('reuse session for %j', options._agentKey);
options = {
session,
...options
...options,
};
}
}
@ -199,7 +199,7 @@ function Agent(options) {
this._sessionCache = {
map: {},
list: []
list: [],
};
}
ObjectSetPrototypeOf(Agent.prototype, HttpAgent.prototype);
@ -408,5 +408,5 @@ module.exports = {
Server,
createServer,
get,
request
request,
};

View File

@ -200,5 +200,5 @@ module.exports = {
url,
waitForDebugger: inspectorWaitForDebugger,
console,
Session
Session,
};

View File

@ -47,14 +47,14 @@ const {
isIPv4,
isIPv6,
normalizedArgsSymbol,
makeSyncWrite
makeSyncWrite,
} = require('internal/net');
const assert = require('internal/assert');
const {
UV_EADDRINUSE,
UV_EINVAL,
UV_ENOTCONN,
UV_ECANCELED
UV_ECANCELED,
} = internalBinding('uv');
const { Buffer } = require('buffer');
@ -63,17 +63,17 @@ const { ShutdownWrap } = internalBinding('stream_wrap');
const {
TCP,
TCPConnectWrap,
constants: TCPConstants
constants: TCPConstants,
} = internalBinding('tcp_wrap');
const {
Pipe,
PipeConnectWrap,
constants: PipeConstants
constants: PipeConstants,
} = internalBinding('pipe_wrap');
const {
newAsyncId,
defaultTriggerAsyncIdScope,
symbols: { async_id_symbol, owner_symbol }
symbols: { async_id_symbol, owner_symbol },
} = require('internal/async_hooks');
const {
writevGeneric,
@ -85,7 +85,7 @@ const {
setStreamTimeout,
kBuffer,
kBufferCb,
kBufferGen
kBufferGen,
} = require('internal/stream_base_commons');
const {
codes: {
@ -117,7 +117,7 @@ const {
validateInt32,
validateNumber,
validatePort,
validateString
validateString,
} = require('internal/validators');
const kLastWriteQueueSize = Symbol('lastWriteQueueSize');
const { getOptionValue } = require('internal/options');
@ -438,7 +438,7 @@ function Socket(options) {
// property.
ObjectDefineProperty(this._handle, 'bytesWritten', {
__proto__: null,
value: 0, writable: true
value: 0, writable: true,
});
}
}
@ -637,7 +637,7 @@ ObjectDefineProperty(Socket.prototype, '_connecting', {
__proto__: null,
get: function() {
return this.connecting;
}
},
});
ObjectDefineProperty(Socket.prototype, 'pending', {
@ -645,7 +645,7 @@ ObjectDefineProperty(Socket.prototype, 'pending', {
get() {
return !this._handle || this.connecting;
},
configurable: true
configurable: true,
});
@ -662,7 +662,7 @@ ObjectDefineProperty(Socket.prototype, 'readyState', {
return 'writeOnly';
}
return 'closed';
}
},
});
@ -672,14 +672,14 @@ ObjectDefineProperty(Socket.prototype, 'bufferSize', {
if (this._handle) {
return this.writableLength;
}
}
},
});
ObjectDefineProperty(Socket.prototype, kUpdateTimer, {
__proto__: null,
get: function() {
return this._unrefTimer;
}
},
});
@ -859,7 +859,7 @@ function protoGetter(name, callback) {
__proto__: null,
configurable: false,
enumerable: true,
get: callback
get: callback,
});
}
@ -1294,7 +1294,7 @@ function lookupAndConnect(self, options) {
if (dns === undefined) dns = require('dns');
const dnsopts = {
family: socketToDnsFamily(options.family),
hints: options.hints || 0
hints: options.hints || 0,
};
if (!isWindows &&
@ -1980,7 +1980,7 @@ ObjectDefineProperty(Server.prototype, 'listening', {
return !!this._handle;
},
configurable: true,
enumerable: true
enumerable: true,
});
Server.prototype.address = function() {
@ -2038,7 +2038,7 @@ function onconnection(err, clientHandle) {
allowHalfOpen: self.allowHalfOpen,
pauseOnCreate: self.pauseOnConnect,
readable: true,
writable: true
writable: true,
});
if (self.noDelay && clientHandle.setNoDelay) {
@ -2185,13 +2185,13 @@ Server.prototype[EventEmitter.captureRejectionSymbol] = function(
ObjectDefineProperty(TCP.prototype, 'owner', {
__proto__: null,
get() { return this[owner_symbol]; },
set(v) { return this[owner_symbol] = v; }
set(v) { return this[owner_symbol] = v; },
});
ObjectDefineProperty(Socket.prototype, '_handle', {
__proto__: null,
get() { return this[kHandle]; },
set(v) { return this[kHandle] = v; }
set(v) { return this[kHandle] = v; },
});
Server.prototype._setupWorker = function(socketList) {

View File

@ -37,9 +37,9 @@ const isWindows = process.platform === 'win32';
const {
codes: {
ERR_SYSTEM_ERROR
ERR_SYSTEM_ERROR,
},
hideStackFrames
hideStackFrames,
} = require('internal/errors');
const { validateInt32 } = require('internal/validators');
@ -57,7 +57,7 @@ const {
getUserInfo,
getUptime: _getUptime,
isBigEndian,
setPriority: _setPriority
setPriority: _setPriority,
} = internalBinding('os');
function getCheckedFunction(fn) {
@ -153,8 +153,8 @@ function cpus() {
nice: data[i++],
sys: data[i++],
idle: data[i++],
irq: data[i++]
}
irq: data[i++],
},
});
}
return result;
@ -288,7 +288,7 @@ function networkInterfaces() {
family: data[i + 3],
mac: data[i + 4],
internal: data[i + 5],
cidr: getCIDR(data[i + 1], data[i + 2], data[i + 3])
cidr: getCIDR(data[i + 1], data[i + 2], data[i + 3]),
};
const scopeid = data[i + 6];
if (scopeid !== -1)
@ -401,7 +401,7 @@ ObjectDefineProperties(module.exports, {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
value: constants,
},
EOL: {
@ -409,7 +409,7 @@ ObjectDefineProperties(module.exports, {
configurable: true,
enumerable: true,
writable: false,
value: isWindows ? '\r\n' : '\n'
value: isWindows ? '\r\n' : '\n',
},
devNull: {
@ -417,6 +417,6 @@ ObjectDefineProperties(module.exports, {
configurable: true,
enumerable: true,
writable: false,
value: isWindows ? '\\\\.\\nul' : '/dev/null'
}
value: isWindows ? '\\\\.\\nul' : '/dev/null',
},
});

View File

@ -1068,7 +1068,7 @@ const win32 = {
sep: '\\',
delimiter: ';',
win32: null,
posix: null
posix: null,
};
const posixCwd = (() => {
@ -1534,7 +1534,7 @@ const posix = {
sep: '/',
delimiter: ':',
win32: null,
posix: null
posix: null,
};
posix.win32 = win32.win32 = win32;

View File

@ -24,7 +24,7 @@ const {
} = require('internal/perf/performance');
const {
createHistogram
createHistogram,
} = require('internal/histogram');
const monitorEventLoopDelay = require('internal/perf/event_loop_delay');
@ -46,5 +46,5 @@ ObjectDefineProperty(module.exports, 'constants', {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
value: constants,
});

View File

@ -40,7 +40,7 @@ const { Buffer } = require('buffer');
const {
encodeStr,
hexTable,
isHexTable
isHexTable,
} = require('internal/querystring');
const QueryString = module.exports = {
unescapeBuffer,
@ -54,7 +54,7 @@ const QueryString = module.exports = {
encode: stringify,
parse,
decode: parse
decode: parse,
};
const unhexTable = new Int8Array([

View File

@ -218,133 +218,133 @@ ObjectDefineProperties(Interface.prototype, {
__proto__: null,
get() {
return this._setRawMode;
}
},
},
[kOnLine]: {
__proto__: null,
get() {
return this._onLine;
}
},
},
[kWriteToOutput]: {
__proto__: null,
get() {
return this._writeToOutput;
}
},
},
[kAddHistory]: {
__proto__: null,
get() {
return this._addHistory;
}
},
},
[kRefreshLine]: {
__proto__: null,
get() {
return this._refreshLine;
}
},
},
[kNormalWrite]: {
__proto__: null,
get() {
return this._normalWrite;
}
},
},
[kInsertString]: {
__proto__: null,
get() {
return this._insertString;
}
},
},
[kTabComplete]: {
__proto__: null,
get() {
return this._tabComplete;
}
},
},
[kWordLeft]: {
__proto__: null,
get() {
return this._wordLeft;
}
},
},
[kWordRight]: {
__proto__: null,
get() {
return this._wordRight;
}
},
},
[kDeleteLeft]: {
__proto__: null,
get() {
return this._deleteLeft;
}
},
},
[kDeleteRight]: {
__proto__: null,
get() {
return this._deleteRight;
}
},
},
[kDeleteWordLeft]: {
__proto__: null,
get() {
return this._deleteWordLeft;
}
},
},
[kDeleteWordRight]: {
__proto__: null,
get() {
return this._deleteWordRight;
}
},
},
[kDeleteLineLeft]: {
__proto__: null,
get() {
return this._deleteLineLeft;
}
},
},
[kDeleteLineRight]: {
__proto__: null,
get() {
return this._deleteLineRight;
}
},
},
[kLine]: {
__proto__: null,
get() {
return this._line;
}
},
},
[kHistoryNext]: {
__proto__: null,
get() {
return this._historyNext;
}
},
},
[kHistoryPrev]: {
__proto__: null,
get() {
return this._historyPrev;
}
},
},
[kGetDisplayPos]: {
__proto__: null,
get() {
return this._getDisplayPos;
}
},
},
[kMoveCursor]: {
__proto__: null,
get() {
return this._moveCursor;
}
},
},
[kTtyWrite]: {
__proto__: null,
get() {
return this._ttyWrite;
}
},
},
// Defining proxies for the internal instance properties for backward

View File

@ -108,7 +108,7 @@ ObjectDefineProperty(Stream, 'promises', {
enumerable: true,
get() {
return promises;
}
},
});
ObjectDefineProperty(pipeline, customPromisify, {
@ -116,7 +116,7 @@ ObjectDefineProperty(pipeline, customPromisify, {
enumerable: true,
get() {
return promises.pipeline;
}
},
});
ObjectDefineProperty(eos, customPromisify, {
@ -124,7 +124,7 @@ ObjectDefineProperty(eos, customPromisify, {
enumerable: true,
get() {
return promises.finished;
}
},
});
// Backwards-compat with node 0.4.x

View File

@ -38,13 +38,13 @@ const {
kSize,
decode,
flush,
encodings
encodings,
} = internalBinding('string_decoder');
const internalUtil = require('internal/util');
const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_THIS,
ERR_UNKNOWN_ENCODING
ERR_UNKNOWN_ENCODING,
} = require('internal/errors').codes;
const isEncoding = Buffer[internalUtil.kIsEncodingSymbol];
@ -147,7 +147,7 @@ ObjectDefineProperties(StringDecoder.prototype, {
return TypedArrayPrototypeSubarray(this[kNativeDecoder],
kIncompleteCharactersStart,
kIncompleteCharactersEnd);
}
},
},
lastNeed: {
__proto__: null,
@ -155,7 +155,7 @@ ObjectDefineProperties(StringDecoder.prototype, {
enumerable: true,
get() {
return this[kNativeDecoder][kMissingBytes];
}
},
},
lastTotal: {
__proto__: null,
@ -164,8 +164,8 @@ ObjectDefineProperties(StringDecoder.prototype, {
get() {
return this[kNativeDecoder][kBufferedBytes] +
this[kNativeDecoder][kMissingBytes];
}
}
},
},
});
exports.StringDecoder = StringDecoder;

View File

@ -24,7 +24,7 @@
const {
MathTrunc,
ObjectDefineProperty,
SymbolToPrimitive
SymbolToPrimitive,
} = primordials;
const binding = internalBinding('timers');
@ -39,7 +39,7 @@ const {
decRefCount,
immediateInfoFields: {
kCount,
kRefCount
kRefCount,
},
kRefed,
kHasPrimitive,
@ -49,11 +49,11 @@ const {
immediateQueue,
active,
unrefActive,
insert
insert,
} = require('internal/timers');
const {
promisify: { custom: customPromisify },
deprecate
deprecate,
} = require('internal/util');
let debug = require('internal/util/debuglog').debuglog('timer', (fn) => {
debug = fn;
@ -65,7 +65,7 @@ let timersPromises;
const {
destroyHooksExist,
// The needed emit*() functions.
emitDestroy
emitDestroy,
} = require('internal/async_hooks');
// This stores all the known timer async ids to allow users to clearTimeout and
@ -173,7 +173,7 @@ ObjectDefineProperty(setTimeout, customPromisify, {
if (!timersPromises)
timersPromises = require('timers/promises');
return timersPromises.setTimeout;
}
},
});
/**
@ -308,7 +308,7 @@ ObjectDefineProperty(setImmediate, customPromisify, {
if (!timersPromises)
timersPromises = require('timers/promises');
return timersPromises.setImmediate;
}
},
});
/**
@ -361,5 +361,5 @@ module.exports = {
enroll: deprecate(
enroll,
'timers.enroll() is deprecated. Please use setTimeout instead.',
'DEP0095')
'DEP0095'),
};

View File

@ -75,7 +75,7 @@ class Tracing {
const obj = {
enabled: this.enabled,
categories: this.categories
categories: this.categories,
};
return `Tracing ${format(obj)}`;
}
@ -93,5 +93,5 @@ function createTracing(options) {
module.exports = {
createTracing,
getEnabledCategories
getEnabledCategories,
};

View File

@ -33,7 +33,7 @@ const errors = require('internal/errors');
const { ERR_INVALID_FD, ERR_TTY_INIT_FAILED } = errors.codes;
const {
getColorDepth,
hasColors
hasColors,
} = require('internal/tty');
// Lazy loaded for startup performance.
@ -60,7 +60,7 @@ function ReadStream(fd, options) {
readableHighWaterMark: 0,
handle: tty,
manualStart: true,
...options
...options,
});
this.isRaw = false;
@ -96,7 +96,7 @@ function WriteStream(fd) {
net.Socket.call(this, {
readableHighWaterMark: 0,
handle: tty,
manualStart: true
manualStart: true,
});
// Prevents interleaved or dropped stdout/stderr output for terminals.

View File

@ -49,11 +49,11 @@ const {
codes: {
ERR_FALSY_VALUE_REJECTION,
ERR_INVALID_ARG_TYPE,
ERR_OUT_OF_RANGE
ERR_OUT_OF_RANGE,
},
errnoException,
exceptionWithHostPort,
hideStackFrames
hideStackFrames,
} = require('internal/errors');
const {
format,
@ -254,7 +254,7 @@ function inherits(ctor, superCtor) {
__proto__: null,
value: superCtor,
writable: true,
configurable: true
configurable: true,
});
ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype);
}
@ -396,7 +396,7 @@ module.exports = {
get aborted() {
return lazyAbortController().aborted;
},
types
types,
};
defineLazyProperties(

View File

@ -36,10 +36,10 @@ const { Buffer } = require('buffer');
const { validateString, validateUint32 } = require('internal/validators');
const {
Serializer,
Deserializer
Deserializer,
} = internalBinding('serdes');
const {
namespace: startupSnapshot
namespace: startupSnapshot,
} = require('internal/v8/startup_snapshot');
let profiler = {};
@ -55,11 +55,11 @@ const { getValidatedPath } = require('internal/fs/utils');
const { toNamespacedPath } = require('path');
const {
createHeapSnapshotStream,
triggerHeapSnapshot
triggerHeapSnapshot,
} = internalBinding('heap_utils');
const {
HeapSnapshotStream,
getHeapSnapshotOptions
getHeapSnapshotOptions,
} = require('internal/heap_utils');
const promiseHooks = require('internal/promise_hooks');
const { getOptionValue } = require('internal/options');
@ -188,7 +188,7 @@ function getHeapStatistics() {
number_of_detached_contexts: buffer[kNumberOfDetachedContextsIndex],
total_global_handles_size: buffer[kTotalGlobalHandlesSizeIndex],
used_global_handles_size: buffer[kUsedGlobalHandlesSizeIndex],
external_memory: buffer[kExternalMemoryIndex]
external_memory: buffer[kExternalMemoryIndex],
};
}
@ -213,7 +213,7 @@ function getHeapSpaceStatistics() {
space_size: buffer[kSpaceSizeIndex],
space_used_size: buffer[kSpaceUsedSizeIndex],
space_available_size: buffer[kSpaceAvailableSizeIndex],
physical_space_size: buffer[kPhysicalSpaceSizeIndex]
physical_space_size: buffer[kPhysicalSpaceSizeIndex],
};
}

View File

@ -218,7 +218,7 @@ function createContext(contextObject = {}, options = kEmptyObject) {
name = `VM Context ${defaultContextNameIndex++}`,
origin,
codeGeneration,
microtaskMode
microtaskMode,
} = options;
validateString(name, 'options.name');
@ -275,7 +275,7 @@ function runInContext(code, contextifiedObject, options) {
if (typeof options === 'string') {
options = {
filename: options,
[kParsingContext]: contextifiedObject
[kParsingContext]: contextifiedObject,
};
} else {
options = { ...options, [kParsingContext]: contextifiedObject };

View File

@ -11,7 +11,7 @@ const {
const {
ERR_INVALID_ARG_VALUE,
ERR_WASI_ALREADY_STARTED
ERR_WASI_ALREADY_STARTED,
} = require('internal/errors').codes;
const {
emitExperimentalWarning,

View File

@ -7,7 +7,7 @@ const {
setEnvironmentData,
getEnvironmentData,
threadId,
Worker
Worker,
} = require('internal/worker');
const {

View File

@ -55,7 +55,7 @@ const {
} = require('internal/errors');
const { Transform, finished } = require('stream');
const {
deprecate
deprecate,
} = require('internal/util');
const {
isArrayBufferView,
@ -66,7 +66,7 @@ const binding = internalBinding('zlib');
const assert = require('internal/assert');
const {
Buffer,
kMaxLength
kMaxLength,
} = require('buffer');
const { owner_symbol } = require('internal/async_hooks').symbols;
const {
@ -103,7 +103,7 @@ const codes = {
Z_DATA_ERROR: constants.Z_DATA_ERROR,
Z_MEM_ERROR: constants.Z_MEM_ERROR,
Z_BUF_ERROR: constants.Z_BUF_ERROR,
Z_VERSION_ERROR: constants.Z_VERSION_ERROR
Z_VERSION_ERROR: constants.Z_VERSION_ERROR,
};
for (const ckey of ObjectKeys(codes)) {
@ -313,7 +313,7 @@ ObjectDefineProperty(ZlibBase.prototype, '_closed', {
enumerable: true,
get() {
return !this._handle;
}
},
});
// `bytesRead` made sense as a name when looking from the zlib engine's
@ -331,7 +331,7 @@ ObjectDefineProperty(ZlibBase.prototype, 'bytesRead', {
set: deprecate(function(value) {
this.bytesWritten = value;
}, 'Setting zlib.bytesRead is deprecated. ' +
'This feature will be removed in the future.', 'DEP0108')
'This feature will be removed in the future.', 'DEP0108'),
});
ZlibBase.prototype.reset = function() {
@ -625,7 +625,7 @@ function _close(engine) {
const zlibDefaultOpts = {
flush: Z_NO_FLUSH,
finishFlush: Z_FINISH,
fullFlush: Z_FULL_FLUSH
fullFlush: Z_FULL_FLUSH,
};
// Base class for all streams actually backed by zlib and using zlib-specific
// parameters.
@ -813,7 +813,7 @@ const brotliInitParamsArray = new Uint32Array(kMaxBrotliParam + 1);
const brotliDefaultOpts = {
flush: BROTLI_OPERATION_PROCESS,
finishFlush: BROTLI_OPERATION_FINISH,
fullFlush: BROTLI_OPERATION_FLUSH
fullFlush: BROTLI_OPERATION_FLUSH,
};
function Brotli(opts, mode) {
assert(mode === BROTLI_DECODE || mode === BROTLI_ENCODE);
@ -878,7 +878,7 @@ function createProperty(ctor) {
enumerable: true,
value: function(options) {
return new ctor(options);
}
},
};
}
@ -887,7 +887,7 @@ function createProperty(ctor) {
ObjectDefineProperty(binding.Zlib.prototype, 'jsref', {
__proto__: null,
get() { return this[owner_symbol]; },
set(v) { return this[owner_symbol] = v; }
set(v) { return this[owner_symbol] = v; },
});
module.exports = {
@ -937,14 +937,14 @@ ObjectDefineProperties(module.exports, {
__proto__: null,
configurable: false,
enumerable: true,
value: constants
value: constants,
},
codes: {
__proto__: null,
enumerable: true,
writable: false,
value: ObjectFreeze(codes)
}
value: ObjectFreeze(codes),
},
});
// These should be considered deprecated
@ -953,6 +953,6 @@ for (const bkey of ObjectKeys(constants)) {
if (StringPrototypeStartsWith(bkey, 'BROTLI')) continue;
ObjectDefineProperty(module.exports, bkey, {
__proto__: null,
enumerable: false, value: constants[bkey], writable: false
enumerable: false, value: constants[bkey], writable: false,
});
}