Skip to content

Commit 36e080c

Browse files
aduh95danielleadams
authored andcommitted
lib: enforce use of trailing commas for functions
PR-URL: #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>
1 parent f7c4796 commit 36e080c

105 files changed

Lines changed: 380 additions & 380 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎lib/.eslintrc.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ rules:
55
comma-dangle: [error, {
66
arrays: always-multiline,
77
exports: always-multiline,
8-
functions: only-multiline,
8+
functions: always-multiline,
99
imports: always-multiline,
1010
objects: only-multiline,
1111
}]

‎lib/_http_agent.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ function installListeners(agent, s, options) {
395395
// TODO(ronag): Always destroy, even if not in free list.
396396
constsockets=agent.freeSockets;
397397
if(ArrayPrototypeSome(ObjectKeys(sockets),(name)=>
398-
ArrayPrototypeIncludes(sockets[name],s)
398+
ArrayPrototypeIncludes(sockets[name],s),
399399
)){
400400
returns.destroy();
401401
}

‎lib/_http_server.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ function checkConnections() {
604604

605605
functionconnectionListener(socket){
606606
defaultTriggerAsyncIdScope(
607-
getOrSetAsyncId(socket),connectionListenerInternal,this,socket
607+
getOrSetAsyncId(socket),connectionListenerInternal,this,socket,
608608
);
609609
}
610610

@@ -807,15 +807,15 @@ function onParserTimeout(server, socket) {
807807
constnoop=()=>{};
808808
constbadRequestResponse=Buffer.from(
809809
`HTTP/1.1 400 ${STATUS_CODES[400]}\r\n`+
810-
'Connection: close\r\n\r\n','ascii'
810+
'Connection: close\r\n\r\n','ascii',
811811
);
812812
constrequestTimeoutResponse=Buffer.from(
813813
`HTTP/1.1 408 ${STATUS_CODES[408]}\r\n`+
814-
'Connection: close\r\n\r\n','ascii'
814+
'Connection: close\r\n\r\n','ascii',
815815
);
816816
constrequestHeaderFieldsTooLargeResponse=Buffer.from(
817817
`HTTP/1.1 431 ${STATUS_CODES[431]}\r\n`+
818-
'Connection: close\r\n\r\n','ascii'
818+
'Connection: close\r\n\r\n','ascii',
819819
);
820820
functionsocketOnError(e){
821821
// Ignore further errors

‎lib/_tls_wrap.js‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function onhandshakedone() {
171171
functionloadSession(hello){
172172
debug('server onclienthello',
173173
'sessionid.len',hello.sessionId.length,
174-
'ticket?',hello.tlsTicket
174+
'ticket?',hello.tlsTicket,
175175
);
176176
constowner=this[owner_symbol];
177177

@@ -350,7 +350,7 @@ function onPskServerCallback(identity, maxPskLen) {
350350
thrownewERR_INVALID_ARG_TYPE(
351351
'ret',
352352
['Object','Buffer','TypedArray','DataView'],
353-
ret
353+
ret,
354354
);
355355
}
356356
psk=ret.psk;
@@ -361,7 +361,7 @@ function onPskServerCallback(identity, maxPskLen) {
361361
thrownewERR_INVALID_ARG_VALUE(
362362
'psk',
363363
psk,
364-
`Pre-shared key exceeds ${maxPskLen} bytes`
364+
`Pre-shared key exceeds ${maxPskLen} bytes`,
365365
);
366366
}
367367

@@ -381,7 +381,7 @@ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
381381
thrownewERR_INVALID_ARG_VALUE(
382382
'psk',
383383
ret.psk,
384-
`Pre-shared key exceeds ${maxPskLen} bytes`
384+
`Pre-shared key exceeds ${maxPskLen} bytes`,
385385
);
386386
}
387387

@@ -390,7 +390,7 @@ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
390390
thrownewERR_INVALID_ARG_VALUE(
391391
'identity',
392392
ret.identity,
393-
`PSK identity exceeds ${maxIdentityLen} bytes`
393+
`PSK identity exceeds ${maxIdentityLen} bytes`,
394394
);
395395
}
396396

@@ -447,7 +447,7 @@ function initRead(tlsSocket, socket) {
447447
debug('%s initRead',
448448
tlsSocket._tlsOptions.isServer ? 'server' : 'client',
449449
'handle?',!!tlsSocket._handle,
450-
'buffered?',!!socket&&socket.readableLength
450+
'buffered?',!!socket&&socket.readableLength,
451451
);
452452
// If we were destroyed already don't bother reading
453453
if(!tlsSocket._handle)
@@ -689,7 +689,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
689689

690690
debug('%s _init',
691691
options.isServer ? 'server' : 'client',
692-
'handle?',!!ssl
692+
'handle?',!!ssl,
693693
);
694694

695695
// Clients (!isServer) always request a cert, servers request a client cert
@@ -846,7 +846,7 @@ TLSSocket.prototype.renegotiate = function(options, callback) {
846846

847847
debug('%s renegotiate()',
848848
this._tlsOptions.isServer ? 'server' : 'client',
849-
'destroyed?',this.destroyed
849+
'destroyed?',this.destroyed,
850850
);
851851

852852
if(this.destroyed)
@@ -1456,7 +1456,7 @@ Server.prototype.addContext = function(servername, context) {
14561456

14571457
constre=newRegExp('^'+StringPrototypeReplaceAll(
14581458
RegExpPrototypeSymbolReplace(/([.^$+?\-\\[\]{}])/g,servername,'\\$1'),
1459-
'*','[^.]*'
1459+
'*','[^.]*',
14601460
)+'$');
14611461
ArrayPrototypePush(this._contexts,
14621462
[re,tls.createSecureContext(context).context]);
@@ -1680,7 +1680,7 @@ exports.connect = function connect(...args) {
16801680
'Setting the TLS ServerName to an IP address is not permitted by '+
16811681
'RFC 6066. This will be ignored in a future version.',
16821682
'DeprecationWarning',
1683-
'DEP0123'
1683+
'DEP0123',
16841684
);
16851685
ipServernameWarned=true;
16861686
}

‎lib/assert.js‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function fail(actual, expected, message, operator, stackStartFn) {
148148
'assert.fail() with more than one argument is deprecated. '+
149149
'Please use assert.strictEqual() instead or only pass a message.',
150150
'DeprecationWarning',
151-
'DEP0094'
151+
'DEP0094',
152152
);
153153
}
154154
if(argsLen===2)
@@ -807,13 +807,13 @@ function expectsError(stackStartFn, actual, error, message) {
807807
if(actual.message===error){
808808
thrownewERR_AMBIGUOUS_ARGUMENT(
809809
'error/message',
810-
`The error message "${actual.message}" is identical to the message.`
810+
`The error message "${actual.message}" is identical to the message.`,
811811
);
812812
}
813813
}elseif(actual===error){
814814
thrownewERR_AMBIGUOUS_ARGUMENT(
815815
'error/message',
816-
`The error "${actual}" is identical to the message.`
816+
`The error "${actual}" is identical to the message.`,
817817
);
818818
}
819819
message=error;
@@ -855,7 +855,7 @@ function hasMatchingError(actual, expected) {
855855
returnRegExpPrototypeExec(expected,str)!==null;
856856
}
857857
thrownewERR_INVALID_ARG_TYPE(
858-
'expected',['Function','RegExp'],expected
858+
'expected',['Function','RegExp'],expected,
859859
);
860860
}
861861
// Guard instanceof against arrow functions as they don't have a prototype.
@@ -970,7 +970,7 @@ assert.ifError = function ifError(err) {
970970
if(origStackStart!==-1){
971971
constoriginalFrames=StringPrototypeSplit(
972972
StringPrototypeSlice(origStack,origStackStart+1),
973-
'\n'
973+
'\n',
974974
);
975975
// Filter all frames existing in err.stack.
976976
letnewFrames=StringPrototypeSplit(newErr.stack,'\n');
@@ -996,7 +996,7 @@ assert.ifError = function ifError(err) {
996996
functioninternalMatch(string,regexp,message,fn){
997997
if(!isRegExp(regexp)){
998998
thrownewERR_INVALID_ARG_TYPE(
999-
'regexp','RegExp',regexp
999+
'regexp','RegExp',regexp,
10001000
);
10011001
}
10021002
constmatch=fn===assert.match;

‎lib/buffer.js‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ Buffer.from = function from(value, encodingOrOffset, length) {
335335
thrownewERR_INVALID_ARG_TYPE(
336336
'first argument',
337337
['string','Buffer','ArrayBuffer','Array','Array-like Object'],
338-
value
338+
value,
339339
);
340340
};
341341

@@ -745,7 +745,7 @@ function byteLength(string, encoding) {
745745
}
746746

747747
thrownewERR_INVALID_ARG_TYPE(
748-
'string',['string','Buffer','ArrayBuffer'],string
748+
'string',['string','Buffer','ArrayBuffer'],string,
749749
);
750750
}
751751

@@ -966,7 +966,7 @@ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
966966
}
967967

968968
thrownewERR_INVALID_ARG_TYPE(
969-
'value',['number','string','Buffer','Uint8Array'],val
969+
'value',['number','string','Buffer','Uint8Array'],val,
970970
);
971971
}
972972

@@ -1222,7 +1222,7 @@ if (internalBinding('config').hasIntl) {
12221222
constcode=icuErrName(result);
12231223
consterr=genericNodeError(
12241224
`Unable to transcode Buffer [${code}]`,
1225-
{code: code,errno: result}
1225+
{code: code,errno: result},
12261226
);
12271227
throwerr;
12281228
};

‎lib/child_process.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ let debug = require('internal/util/debuglog').debuglog(
5656
'child_process',
5757
(fn)=>{
5858
debug=fn;
59-
}
59+
},
6060
);
6161
const{ Buffer }=require('buffer');
6262
const{ Pipe,constants: PipeConstants}=internalBinding('pipe_wrap');
@@ -686,7 +686,7 @@ function normalizeSpawnArguments(file, args, options) {
686686
}
687687
sawKey.add(uppercaseKey);
688688
returntrue;
689-
}
689+
},
690690
);
691691
}
692692

‎lib/crypto.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ function getRandomBytesAlias(key) {
307307
configurable: true,
308308
writable: true,
309309
value: value
310-
}
310+
},
311311
);
312312
returnvalue;
313313
},
@@ -321,7 +321,7 @@ function getRandomBytesAlias(key) {
321321
configurable: true,
322322
writable: true,
323323
value
324-
}
324+
},
325325
);
326326
}
327327
};

‎lib/dgram.js‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ function _connect(port, address, callback) {
412412
defaultTriggerAsyncIdScope(
413413
this[async_id_symbol],
414414
doConnect,
415-
ex,this,ip,address,port,callback
415+
ex,this,ip,address,port,callback,
416416
);
417417
};
418418

@@ -662,7 +662,7 @@ Socket.prototype.send = function(buffer,
662662
defaultTriggerAsyncIdScope(
663663
this[async_id_symbol],
664664
doSend,
665-
ex,this,ip,list,address,port,callback
665+
ex,this,ip,list,address,port,callback,
666666
);
667667
};
668668

@@ -1066,7 +1066,7 @@ module.exports = {
10661066
_createSocketHandle: deprecate(
10671067
_createSocketHandle,
10681068
'dgram._createSocketHandle() is deprecated',
1069-
'DEP0112'
1069+
'DEP0112',
10701070
),
10711071
createSocket,
10721072
Socket

‎lib/dns.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ function lookup(hostname, options, callback) {
219219
req.oncomplete=all ? onlookupall : onlookup;
220220

221221
consterr=cares.getaddrinfo(
222-
req,toASCII(hostname),family,hints,verbatim
222+
req,toASCII(hostname),family,hints,verbatim,
223223
);
224224
if(err){
225225
process.nextTick(callback,dnsException(err,'getaddrinfo',hostname));

0 commit comments

Comments
 (0)