Skip to content

Commit

Permalink
lib: add trailing commas in internal/process
Browse files Browse the repository at this point in the history
PR-URL: #46687
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
aduh95 authored and MylesBorins committed Feb 18, 2023
1 parent 014028f commit 53fe480
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 43 deletions.
1 change: 1 addition & 0 deletions lib/.eslintrc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ overrides:
- ./internal/per_context/messageport.js
- ./internal/policy/*.js
- ./internal/priority_queue.js
- ./internal/process/*.js
- ./internal/readline/*.js
- ./internal/readme.md
- ./internal/repl/history.js
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/process/execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) {
importModuleDynamically(specifier, _, importAssertions) {
const loader = asyncESM.esmLoader;
return loader.import(specifier, baseUrl, importAssertions);
}
},
}));
if (print) {
const { log } = require('internal/console/global');
Expand All @@ -106,7 +106,7 @@ function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) {

const exceptionHandlerState = {
captureFn: null,
reportFlag: false
reportFlag: false,
};

function setUncaughtExceptionCaptureCallback(fn) {
Expand Down Expand Up @@ -213,5 +213,5 @@ module.exports = {
evalScript,
onGlobalUncaughtException: createOnGlobalUncaughtException(),
setUncaughtExceptionCaptureCallback,
hasUncaughtExceptionCaptureCallback
hasUncaughtExceptionCaptureCallback,
};
16 changes: 8 additions & 8 deletions lib/internal/process/per_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_OUT_OF_RANGE,
ERR_UNKNOWN_SIGNAL
}
ERR_UNKNOWN_SIGNAL,
},
} = require('internal/errors');
const format = require('internal/util/inspect').format;
const {
Expand Down Expand Up @@ -111,7 +111,7 @@ function wrapProcessMethods(binding) {
cpuUsage: _cpuUsage,
memoryUsage: _memoryUsage,
rss,
resourceUsage: _resourceUsage
resourceUsage: _resourceUsage,
} = binding;

function _rawDebug(...args) {
Expand Down Expand Up @@ -148,14 +148,14 @@ function wrapProcessMethods(binding) {
if (prevValue) {
return {
user: cpuValues[0] - prevValue.user,
system: cpuValues[1] - prevValue.system
system: cpuValues[1] - prevValue.system,
};
}

// If no previous value passed in, return current value.
return {
user: cpuValues[0],
system: cpuValues[1]
system: cpuValues[1],
};
}

Expand All @@ -175,7 +175,7 @@ function wrapProcessMethods(binding) {
heapTotal: memValues[1],
heapUsed: memValues[2],
external: memValues[3],
arrayBuffers: memValues[4]
arrayBuffers: memValues[4],
};
}

Expand Down Expand Up @@ -271,7 +271,7 @@ function wrapProcessMethods(binding) {
ipcReceived: resourceValues[12],
signalsCount: resourceValues[13],
voluntaryContextSwitches: resourceValues[14],
involuntaryContextSwitches: resourceValues[15]
involuntaryContextSwitches: resourceValues[15],
};
}

Expand All @@ -282,7 +282,7 @@ function wrapProcessMethods(binding) {
resourceUsage,
memoryUsage,
kill,
exit
exit,
};
}

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/process/policy.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ module.exports = ObjectFreeze({

assertIntegrity(moduleURL, content) {
this.manifest.assertIntegrity(moduleURL, content);
}
},
});
28 changes: 14 additions & 14 deletions lib/internal/process/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ function prepareMainThreadExecution(expandArgv1 = false, initializeModules = tru
prepareExecution({
expandArgv1,
initializeModules,
isMainThread: true
isMainThread: true,
});
}

function prepareWorkerThreadExecution() {
prepareExecution({
expandArgv1: false,
initializeModules: false, // Will need to initialize it after policy setup
isMainThread: false
isMainThread: false,
});
}

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

process.exitCode = undefined;
Expand Down Expand Up @@ -188,15 +188,15 @@ function addReadOnlyProcessAlias(name, option, enumerable = true) {
writable: false,
configurable: true,
enumerable,
value
value,
});
}
}

function setupWarningHandler() {
const {
onWarning,
resetForSerialization
resetForSerialization,
} = require('internal/process/warning');
if (getOptionValue('--warnings') &&
process.env.NODE_NO_WARNINGS !== '1') {
Expand Down Expand Up @@ -245,7 +245,7 @@ function setupFetch() {
},
set(value) {
exposeInterface(globalThis, name, value);
}
},
};
}

Expand Down Expand Up @@ -291,7 +291,7 @@ function setupWebCrypto() {
{ __proto__: null, ...ObjectGetOwnPropertyDescriptor({
get crypto() {
throw new ERR_NO_CRYPTO();
}
},
}, 'crypto') });

}
Expand Down Expand Up @@ -339,7 +339,7 @@ function initializeReport() {
get() {
const { report } = require('internal/process/report');
return report;
}
},
});
}

Expand Down Expand Up @@ -400,7 +400,7 @@ function setupInspectorHooks() {
if (internalBinding('config').hasInspector) {
const {
enable,
disable
disable,
} = require('internal/inspector_async_hook');
internalBinding('inspector').registerAsyncHook(enable, disable);
}
Expand Down Expand Up @@ -455,7 +455,7 @@ function initializeDeprecations() {
writable: false,
enumerable: true,
configurable: true,
value: noBrowserGlobals
value: noBrowserGlobals,
});
}

Expand Down Expand Up @@ -526,7 +526,7 @@ function readPolicyFromDisk() {
for (let i = 0; i < integrityEntries.length; i++) {
const {
algorithm,
value: expected
value: expected,
} = integrityEntries[i];
const hash = createHash(algorithm);
hash.update(src);
Expand All @@ -543,7 +543,7 @@ function readPolicyFromDisk() {
}
}
return {
manifestSrc: src, manifestURL: manifestURL.href
manifestSrc: src, manifestURL: manifestURL.href,
};
}
}
Expand Down Expand Up @@ -599,7 +599,7 @@ function loadPreloadModules() {
if (preloadModules && preloadModules.length > 0) {
const {
Module: {
_preloadModules
_preloadModules,
},
} = require('internal/modules/cjs/loader');
_preloadModules(preloadModules);
Expand All @@ -614,5 +614,5 @@ module.exports = {
setupUserModules,
prepareMainThreadExecution,
prepareWorkerThreadExecution,
markBootstrapComplete
markBootstrapComplete,
};
10 changes: 5 additions & 5 deletions lib/internal/process/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const {
kPromiseRejectWithNoHandler,
kPromiseHandlerAddedAfterReject,
kPromiseResolveAfterResolved,
kPromiseRejectAfterResolved
kPromiseRejectAfterResolved,
},
setPromiseRejectCallback
setPromiseRejectCallback,
} = internalBinding('task_queue');

const { deprecate } = require('internal/util');
Expand All @@ -33,8 +33,8 @@ const {
popAsyncContext,
symbols: {
async_id_symbol: kAsyncIdSymbol,
trigger_async_id_symbol: kTriggerAsyncIdSymbol
}
trigger_async_id_symbol: kTriggerAsyncIdSymbol,
},
} = require('internal/async_hooks');
const { isErrorStackTraceLimitWritable } = require('internal/errors');

Expand Down Expand Up @@ -155,7 +155,7 @@ function unhandledRejection(promise, reason) {
uid: ++lastPromiseId,
warned: false,
domain: process.domain,
emit
emit,
});
// This causes the promise to be referenced at least for one tick.
ArrayPrototypePush(pendingUnhandledRejections, promise);
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/process/report.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
const {
ERR_SYNTHETIC
ERR_SYNTHETIC,
} = require('internal/errors').codes;
const {
validateBoolean,
Expand Down Expand Up @@ -92,7 +92,7 @@ const report = {
validateBoolean(trigger, 'trigger');

nr.setReportOnUncaughtException(trigger);
}
},
};

function addSignalHandler(sig) {
Expand All @@ -117,5 +117,5 @@ function signalHandler(sig) {

module.exports = {
addSignalHandler,
report
report,
};
2 changes: 1 addition & 1 deletion lib/internal/process/signal.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,5 +50,5 @@ function stopListeningIfSignal(type) {

module.exports = {
startListeningIfSignal,
stopListeningIfSignal
stopListeningIfSignal,
};
12 changes: 6 additions & 6 deletions lib/internal/process/task_queues.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ const {
// Used to run V8's micro task queue.
runMicrotasks,
setTickCallback,
enqueueMicrotask
enqueueMicrotask,
} = internalBinding('task_queue');

const {
setHasRejectionToWarn,
hasRejectionToWarn,
listenForRejections,
processPromiseRejections
processPromiseRejections,
} = require('internal/process/promises');

const {
Expand All @@ -31,7 +31,7 @@ const {
emitBefore,
emitAfter,
emitDestroy,
symbols: { async_id_symbol, trigger_async_id_symbol }
symbols: { async_id_symbol, trigger_async_id_symbol },
} = require('internal/async_hooks');
const FixedQueue = require('internal/fixed_queue');

Expand Down Expand Up @@ -126,7 +126,7 @@ function nextTick(callback) {
[async_id_symbol]: asyncId,
[trigger_async_id_symbol]: triggerAsyncId,
callback,
args
args,
};
if (initHooksExist())
emitInit(asyncId, 'TickObject', triggerAsyncId, tickObject);
Expand Down Expand Up @@ -166,8 +166,8 @@ module.exports = {
setTickCallback(processTicksAndRejections);
return {
nextTick,
runNextTicks
runNextTicks,
};
},
queueMicrotask
queueMicrotask,
};
4 changes: 2 additions & 2 deletions lib/internal/process/worker_thread_only.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// run in the worker thread.

const {
codes: { ERR_WORKER_UNSUPPORTED_OPERATION }
codes: { ERR_WORKER_UNSUPPORTED_OPERATION },
} = require('internal/errors');

function unavailable(name) {
Expand All @@ -17,5 +17,5 @@ function unavailable(name) {
}

module.exports = {
unavailable
unavailable,
};

0 comments on commit 53fe480

Please sign in to comment.