Skip to content

Commit fa600fe

Browse files
aduh95MylesBorins
authored andcommitted
lib: add trailing commas in internal/process
PR-URL: #46687 Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Darshan Sen <[email protected]>
1 parent 7756438 commit fa600fe

10 files changed

+45
-44
lines changed

lib/.eslintrc.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ overrides:
286286
- ./internal/per_context/messageport.js
287287
- ./internal/policy/*.js
288288
- ./internal/priority_queue.js
289+
- ./internal/process/*.js
289290
- ./internal/readline/*.js
290291
- ./internal/readme.md
291292
- ./internal/repl/history.js

lib/internal/process/execution.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) {
8787
importModuleDynamically(specifier, _, importAssertions) {
8888
const loader = asyncESM.esmLoader;
8989
return loader.import(specifier, baseUrl, importAssertions);
90-
}
90+
},
9191
}));
9292
if (print) {
9393
const { log } = require('internal/console/global');
@@ -106,7 +106,7 @@ function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) {
106106

107107
const exceptionHandlerState = {
108108
captureFn: null,
109-
reportFlag: false
109+
reportFlag: false,
110110
};
111111

112112
function setUncaughtExceptionCaptureCallback(fn) {
@@ -213,5 +213,5 @@ module.exports = {
213213
evalScript,
214214
onGlobalUncaughtException: createOnGlobalUncaughtException(),
215215
setUncaughtExceptionCaptureCallback,
216-
hasUncaughtExceptionCaptureCallback
216+
hasUncaughtExceptionCaptureCallback,
217217
};

lib/internal/process/per_thread.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ const {
4141
ERR_INVALID_ARG_TYPE,
4242
ERR_INVALID_ARG_VALUE,
4343
ERR_OUT_OF_RANGE,
44-
ERR_UNKNOWN_SIGNAL
45-
}
44+
ERR_UNKNOWN_SIGNAL,
45+
},
4646
} = require('internal/errors');
4747
const format = require('internal/util/inspect').format;
4848
const {
@@ -111,7 +111,7 @@ function wrapProcessMethods(binding) {
111111
cpuUsage: _cpuUsage,
112112
memoryUsage: _memoryUsage,
113113
rss,
114-
resourceUsage: _resourceUsage
114+
resourceUsage: _resourceUsage,
115115
} = binding;
116116

117117
function _rawDebug(...args) {
@@ -148,14 +148,14 @@ function wrapProcessMethods(binding) {
148148
if (prevValue) {
149149
return {
150150
user: cpuValues[0] - prevValue.user,
151-
system: cpuValues[1] - prevValue.system
151+
system: cpuValues[1] - prevValue.system,
152152
};
153153
}
154154

155155
// If no previous value passed in, return current value.
156156
return {
157157
user: cpuValues[0],
158-
system: cpuValues[1]
158+
system: cpuValues[1],
159159
};
160160
}
161161

@@ -175,7 +175,7 @@ function wrapProcessMethods(binding) {
175175
heapTotal: memValues[1],
176176
heapUsed: memValues[2],
177177
external: memValues[3],
178-
arrayBuffers: memValues[4]
178+
arrayBuffers: memValues[4],
179179
};
180180
}
181181

@@ -186,7 +186,7 @@ function wrapProcessMethods(binding) {
186186
() => {},
187187
'Implicit coercion to integer for exit code is deprecated.',
188188
'DEP0164',
189-
true
189+
true,
190190
);
191191

192192
function exit(code) {
@@ -271,7 +271,7 @@ function wrapProcessMethods(binding) {
271271
ipcReceived: resourceValues[12],
272272
signalsCount: resourceValues[13],
273273
voluntaryContextSwitches: resourceValues[14],
274-
involuntaryContextSwitches: resourceValues[15]
274+
involuntaryContextSwitches: resourceValues[15],
275275
};
276276
}
277277

@@ -282,7 +282,7 @@ function wrapProcessMethods(binding) {
282282
resourceUsage,
283283
memoryUsage,
284284
kill,
285-
exit
285+
exit,
286286
};
287287
}
288288

lib/internal/process/policy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,5 @@ module.exports = ObjectFreeze({
5757

5858
assertIntegrity(moduleURL, content) {
5959
this.manifest.assertIntegrity(moduleURL, content);
60-
}
60+
},
6161
});

lib/internal/process/pre_execution.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ function prepareMainThreadExecution(expandArgv1 = false, initializeModules = tru
4040
prepareExecution({
4141
expandArgv1,
4242
initializeModules,
43-
isMainThread: true
43+
isMainThread: true,
4444
});
4545
}
4646

4747
function prepareWorkerThreadExecution() {
4848
prepareExecution({
4949
expandArgv1: false,
5050
initializeModules: false, // Will need to initialize it after policy setup
51-
isMainThread: false
51+
isMainThread: false,
5252
});
5353
}
5454

@@ -139,7 +139,7 @@ function patchProcessObject(expandArgv1) {
139139
enumerable: true,
140140
// Only set it to true during snapshot building.
141141
configurable: getOptionValue('--build-snapshot'),
142-
value: process.argv[0]
142+
value: process.argv[0],
143143
});
144144

145145
process.exitCode = undefined;
@@ -188,15 +188,15 @@ function addReadOnlyProcessAlias(name, option, enumerable = true) {
188188
writable: false,
189189
configurable: true,
190190
enumerable,
191-
value
191+
value,
192192
});
193193
}
194194
}
195195

196196
function setupWarningHandler() {
197197
const {
198198
onWarning,
199-
resetForSerialization
199+
resetForSerialization,
200200
} = require('internal/process/warning');
201201
if (getOptionValue('--warnings') &&
202202
process.env.NODE_NO_WARNINGS !== '1') {
@@ -245,7 +245,7 @@ function setupFetch() {
245245
},
246246
set(value) {
247247
exposeInterface(globalThis, name, value);
248-
}
248+
},
249249
};
250250
}
251251

@@ -291,7 +291,7 @@ function setupWebCrypto() {
291291
{ __proto__: null, ...ObjectGetOwnPropertyDescriptor({
292292
get crypto() {
293293
throw new ERR_NO_CRYPTO();
294-
}
294+
},
295295
}, 'crypto') });
296296

297297
}
@@ -339,7 +339,7 @@ function initializeReport() {
339339
get() {
340340
const { report } = require('internal/process/report');
341341
return report;
342-
}
342+
},
343343
});
344344
}
345345

@@ -400,7 +400,7 @@ function setupInspectorHooks() {
400400
if (internalBinding('config').hasInspector) {
401401
const {
402402
enable,
403-
disable
403+
disable,
404404
} = require('internal/inspector_async_hook');
405405
internalBinding('inspector').registerAsyncHook(enable, disable);
406406
}
@@ -455,7 +455,7 @@ function initializeDeprecations() {
455455
writable: false,
456456
enumerable: true,
457457
configurable: true,
458-
value: noBrowserGlobals
458+
value: noBrowserGlobals,
459459
});
460460
}
461461

@@ -526,7 +526,7 @@ function readPolicyFromDisk() {
526526
for (let i = 0; i < integrityEntries.length; i++) {
527527
const {
528528
algorithm,
529-
value: expected
529+
value: expected,
530530
} = integrityEntries[i];
531531
const hash = createHash(algorithm);
532532
hash.update(src);
@@ -543,7 +543,7 @@ function readPolicyFromDisk() {
543543
}
544544
}
545545
return {
546-
manifestSrc: src, manifestURL: manifestURL.href
546+
manifestSrc: src, manifestURL: manifestURL.href,
547547
};
548548
}
549549
}
@@ -599,7 +599,7 @@ function loadPreloadModules() {
599599
if (preloadModules && preloadModules.length > 0) {
600600
const {
601601
Module: {
602-
_preloadModules
602+
_preloadModules,
603603
},
604604
} = require('internal/modules/cjs/loader');
605605
_preloadModules(preloadModules);
@@ -614,5 +614,5 @@ module.exports = {
614614
setupUserModules,
615615
prepareMainThreadExecution,
616616
prepareWorkerThreadExecution,
617-
markBootstrapComplete
617+
markBootstrapComplete,
618618
};

lib/internal/process/promises.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ const {
1515
kPromiseRejectWithNoHandler,
1616
kPromiseHandlerAddedAfterReject,
1717
kPromiseResolveAfterResolved,
18-
kPromiseRejectAfterResolved
18+
kPromiseRejectAfterResolved,
1919
},
20-
setPromiseRejectCallback
20+
setPromiseRejectCallback,
2121
} = internalBinding('task_queue');
2222

2323
const { deprecate } = require('internal/util');
@@ -33,8 +33,8 @@ const {
3333
popAsyncContext,
3434
symbols: {
3535
async_id_symbol: kAsyncIdSymbol,
36-
trigger_async_id_symbol: kTriggerAsyncIdSymbol
37-
}
36+
trigger_async_id_symbol: kTriggerAsyncIdSymbol,
37+
},
3838
} = require('internal/async_hooks');
3939
const { isErrorStackTraceLimitWritable } = require('internal/errors');
4040

@@ -155,7 +155,7 @@ function unhandledRejection(promise, reason) {
155155
uid: ++lastPromiseId,
156156
warned: false,
157157
domain: process.domain,
158-
emit
158+
emit,
159159
});
160160
// This causes the promise to be referenced at least for one tick.
161161
ArrayPrototypePush(pendingUnhandledRejections, promise);

lib/internal/process/report.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
const {
3-
ERR_SYNTHETIC
3+
ERR_SYNTHETIC,
44
} = require('internal/errors').codes;
55
const {
66
validateBoolean,
@@ -92,7 +92,7 @@ const report = {
9292
validateBoolean(trigger, 'trigger');
9393

9494
nr.setReportOnUncaughtException(trigger);
95-
}
95+
},
9696
};
9797

9898
function addSignalHandler(sig) {
@@ -117,5 +117,5 @@ function signalHandler(sig) {
117117

118118
module.exports = {
119119
addSignalHandler,
120-
report
120+
report,
121121
};

lib/internal/process/signal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,5 @@ function stopListeningIfSignal(type) {
5050

5151
module.exports = {
5252
startListeningIfSignal,
53-
stopListeningIfSignal
53+
stopListeningIfSignal,
5454
};

lib/internal/process/task_queues.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ const {
1212
// Used to run V8's micro task queue.
1313
runMicrotasks,
1414
setTickCallback,
15-
enqueueMicrotask
15+
enqueueMicrotask,
1616
} = internalBinding('task_queue');
1717

1818
const {
1919
setHasRejectionToWarn,
2020
hasRejectionToWarn,
2121
listenForRejections,
22-
processPromiseRejections
22+
processPromiseRejections,
2323
} = require('internal/process/promises');
2424

2525
const {
@@ -31,7 +31,7 @@ const {
3131
emitBefore,
3232
emitAfter,
3333
emitDestroy,
34-
symbols: { async_id_symbol, trigger_async_id_symbol }
34+
symbols: { async_id_symbol, trigger_async_id_symbol },
3535
} = require('internal/async_hooks');
3636
const FixedQueue = require('internal/fixed_queue');
3737

@@ -126,7 +126,7 @@ function nextTick(callback) {
126126
[async_id_symbol]: asyncId,
127127
[trigger_async_id_symbol]: triggerAsyncId,
128128
callback,
129-
args
129+
args,
130130
};
131131
if (initHooksExist())
132132
emitInit(asyncId, 'TickObject', triggerAsyncId, tickObject);
@@ -166,8 +166,8 @@ module.exports = {
166166
setTickCallback(processTicksAndRejections);
167167
return {
168168
nextTick,
169-
runNextTicks
169+
runNextTicks,
170170
};
171171
},
172-
queueMicrotask
172+
queueMicrotask,
173173
};

lib/internal/process/worker_thread_only.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// run in the worker thread.
55

66
const {
7-
codes: { ERR_WORKER_UNSUPPORTED_OPERATION }
7+
codes: { ERR_WORKER_UNSUPPORTED_OPERATION },
88
} = require('internal/errors');
99

1010
function unavailable(name) {
@@ -17,5 +17,5 @@ function unavailable(name) {
1717
}
1818

1919
module.exports = {
20-
unavailable
20+
unavailable,
2121
};

0 commit comments

Comments
 (0)