Skip to content

Commit c463f13

Browse files
aduh95danielleadams
authored andcommitted
lib: enforce use of trailing commas
PR-URL: #46881 Reviewed-By: Debadree Chatterjee <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Jacob Smith <[email protected]>
1 parent 413493c commit c463f13

Some content is hidden

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

68 files changed

+367
-295
lines changed

lib/.eslintrc.yaml

-34
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,6 @@ env:
22
es6: true
33

44
rules:
5-
comma-dangle: [error, {
6-
arrays: always-multiline,
7-
exports: always-multiline,
8-
functions: always-multiline,
9-
imports: always-multiline,
10-
objects: only-multiline,
11-
}]
125
prefer-object-spread: error
136
no-buffer-constructor: error
147
no-mixed-operators:
@@ -249,30 +242,3 @@ globals:
249242
module: false
250243
internalBinding: false
251244
primordials: false
252-
overrides:
253-
- files:
254-
- ./*/*.js
255-
- ./*.js
256-
- ./internal/child_process/*.js
257-
- ./internal/cluster/*.js
258-
- ./internal/debugger/*.js
259-
- ./internal/events/*.js
260-
- ./internal/fs/*.js
261-
- ./internal/modules/*.js
262-
- ./internal/per_context/*.js
263-
- ./internal/perf/*.js
264-
- ./internal/policy/*.js
265-
- ./internal/process/*.js
266-
- ./internal/readline/*.js
267-
- ./internal/readme.md
268-
- ./internal/repl/*.js
269-
- ./internal/source_map/*.js
270-
- ./internal/streams/*.js
271-
- ./internal/test/*.js
272-
- ./internal/test_runner/**/*.js
273-
- ./internal/tls/*.js
274-
- ./internal/util/parse_args/*.js
275-
- ./internal/watch_mode/*.js
276-
- ./internal/webstreams/*.js
277-
rules:
278-
comma-dangle: [error, always-multiline]

lib/internal/assert/assertion_error.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const kReadableOperator = {
3939
'Expected "actual" not to be reference-equal to "expected":',
4040
notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
4141
notIdentical: 'Values have same structure but are not reference-equal:',
42-
notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:'
42+
notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:',
4343
};
4444

4545
// Comparing short primitives should just show === / !== instead of using the
@@ -331,11 +331,11 @@ class AssertionError extends Error {
331331
stackStartFn,
332332
details,
333333
// Compatibility with older versions.
334-
stackStartFunction
334+
stackStartFunction,
335335
} = options;
336336
let {
337337
actual,
338-
expected
338+
expected,
339339
} = options;
340340

341341
const limit = Error.stackTraceLimit;
@@ -430,7 +430,7 @@ class AssertionError extends Error {
430430
value: 'AssertionError [ERR_ASSERTION]',
431431
enumerable: false,
432432
writable: true,
433-
configurable: true
433+
configurable: true,
434434
});
435435
this.code = 'ERR_ASSERTION';
436436
if (details) {
@@ -479,7 +479,7 @@ class AssertionError extends Error {
479479
const result = inspect(this, {
480480
...ctx,
481481
customInspect: false,
482-
depth: 0
482+
depth: 0,
483483
});
484484

485485
// Reset the properties after inspection.

lib/internal/assert/calltracker.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class CallTrackerContext {
6363
actual: this.#calls.length,
6464
expected: this.#expected,
6565
operator: this.#name,
66-
stack: this.#stackTrace
66+
stack: this.#stackTrace,
6767
};
6868
}
6969
}
@@ -110,7 +110,7 @@ class CallTracker {
110110
expected,
111111
// eslint-disable-next-line no-restricted-syntax
112112
stackTrace: new Error(),
113-
name: fn.name || 'calls'
113+
name: fn.name || 'calls',
114114
});
115115
const tracked = new Proxy(fn, {
116116
__proto__: null,

lib/internal/bootstrap/browser.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ exposeGetterAndSetter(globalThis,
2929
});
3030

3131
const {
32-
TextEncoder, TextDecoder
32+
TextEncoder,
33+
TextDecoder,
3334
} = require('internal/encoding');
3435
// https://encoding.spec.whatwg.org/#textencoder
3536
exposeInterface(globalThis, 'TextEncoder', TextEncoder);
@@ -100,7 +101,7 @@ function exposeNamespace(target, name, namespaceObject) {
100101
writable: true,
101102
enumerable: false,
102103
configurable: true,
103-
value: namespaceObject
104+
value: namespaceObject,
104105
});
105106
}
106107

lib/internal/bootstrap/loaders.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ ObjectDefineProperty(process, 'moduleLoadList', {
6969
value: moduleLoadList,
7070
configurable: true,
7171
enumerable: true,
72-
writable: false
72+
writable: false,
7373
});
7474

7575

@@ -182,7 +182,7 @@ let internalBinding;
182182
const loaderId = 'internal/bootstrap/loaders';
183183
const {
184184
builtinIds,
185-
compileFunction
185+
compileFunction,
186186
} = internalBinding('builtins');
187187

188188
const getOwn = (target, property, receiver) => {
@@ -350,7 +350,7 @@ class BuiltinModule {
350350
const loaderExports = {
351351
internalBinding,
352352
BuiltinModule,
353-
require: requireBuiltin
353+
require: requireBuiltin,
354354
};
355355

356356
function requireBuiltin(id) {

lib/internal/bootstrap/node.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ const deprecationHandler = {
153153
setPrototypeOf(target, proto) {
154154
this.maybeWarn();
155155
return ObjectSetPrototypeOf(target, proto);
156-
}
156+
},
157157
};
158158

159159
// process.config is serialized config.gypi
@@ -172,7 +172,7 @@ ObjectDefineProperty(process, 'config', {
172172
set(value) {
173173
deprecationHandler.maybeWarn();
174174
processConfig = value;
175-
}
175+
},
176176
});
177177

178178
require('internal/worker/js_transferable').setup();
@@ -231,7 +231,7 @@ internalBinding('async_wrap').setupHooks(nativeHooks);
231231

232232
const {
233233
setupTaskQueue,
234-
queueMicrotask
234+
queueMicrotask,
235235
} = require('internal/process/task_queues');
236236

237237
// Non-standard extensions:
@@ -272,11 +272,11 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', {
272272
value,
273273
configurable: true,
274274
enumerable: true,
275-
writable: true
275+
writable: true,
276276
});
277277
},
278278
enumerable: true,
279-
configurable: true
279+
configurable: true,
280280
});
281281

282282
// process.assert
@@ -301,22 +301,22 @@ const features = {
301301
// code cache even if the binary is built with embedded code cache.
302302
get cached_builtins() {
303303
return binding.hasCachedBuiltins();
304-
}
304+
},
305305
};
306306

307307
ObjectDefineProperty(process, 'features', {
308308
__proto__: null,
309309
enumerable: true,
310310
writable: false,
311311
configurable: false,
312-
value: features
312+
value: features,
313313
});
314314

315315
{
316316
const {
317317
onGlobalUncaughtException,
318318
setUncaughtExceptionCaptureCallback,
319-
hasUncaughtExceptionCaptureCallback
319+
hasUncaughtExceptionCaptureCallback,
320320
} = require('internal/process/execution');
321321

322322
// For legacy reasons this is still called `_fatalException`, even
@@ -373,14 +373,14 @@ if (config.hasOpenSSL) {
373373
function setupPrepareStackTrace() {
374374
const {
375375
setEnhanceStackForFatalException,
376-
setPrepareStackTraceCallback
376+
setPrepareStackTraceCallback,
377377
} = internalBinding('errors');
378378
const {
379379
prepareStackTrace,
380380
fatalExceptionStackEnhancers: {
381381
beforeInspector,
382-
afterInspector
383-
}
382+
afterInspector,
383+
},
384384
} = require('internal/errors');
385385
// Tell our PrepareStackTraceCallback passed to the V8 API
386386
// to call prepareStackTrace().
@@ -399,7 +399,7 @@ function setupProcessObject() {
399399
enumerable: false,
400400
writable: true,
401401
configurable: false,
402-
value: 'process'
402+
value: 'process',
403403
});
404404

405405
// Create global.process as getters so that we have a
@@ -425,7 +425,7 @@ function setupGlobalProxy() {
425425
value: 'global',
426426
writable: false,
427427
enumerable: false,
428-
configurable: true
428+
configurable: true,
429429
});
430430
globalThis.global = globalThis;
431431
}

lib/internal/bootstrap/switches/does_not_own_process_state.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ if (credentials.implementsPosixCredentials) {
2323
// ---- compare the setups side-by-side -----
2424

2525
const {
26-
codes: { ERR_WORKER_UNSUPPORTED_OPERATION }
26+
codes: { ERR_WORKER_UNSUPPORTED_OPERATION },
2727
} = require('internal/errors');
2828

2929
function wrappedUmask(mask) {

lib/internal/bootstrap/switches/does_own_process_state.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,18 @@ if (credentials.implementsPosixCredentials) {
2525
const {
2626
parseFileMode,
2727
validateArray,
28-
validateString
28+
validateString,
2929
} = require('internal/validators');
3030

3131
function wrapPosixCredentialSetters(credentials) {
3232
const {
3333
codes: {
3434
ERR_INVALID_ARG_TYPE,
35-
ERR_UNKNOWN_CREDENTIAL
36-
}
35+
ERR_UNKNOWN_CREDENTIAL,
36+
},
3737
} = require('internal/errors');
3838
const {
39-
validateUint32
39+
validateUint32,
4040
} = require('internal/validators');
4141

4242
const {
@@ -45,7 +45,7 @@ function wrapPosixCredentialSetters(credentials) {
4545
setegid: _setegid,
4646
seteuid: _seteuid,
4747
setgid: _setgid,
48-
setuid: _setuid
48+
setuid: _setuid,
4949
} = credentials;
5050

5151
function initgroups(user, extraGroup) {
@@ -99,7 +99,7 @@ function wrapPosixCredentialSetters(credentials) {
9999
setegid: wrapIdSetter('Group', _setegid),
100100
seteuid: wrapIdSetter('User', _seteuid),
101101
setgid: wrapIdSetter('Group', _setgid),
102-
setuid: wrapIdSetter('User', _setuid)
102+
setuid: wrapIdSetter('User', _setuid),
103103
};
104104
}
105105

lib/internal/bootstrap/switches/is_main_thread.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const { ObjectDefineProperty } = primordials;
44
const rawMethods = internalBinding('process_methods');
55
const {
66
addSerializeCallback,
7-
isBuildingSnapshot
7+
isBuildingSnapshot,
88
} = require('v8').startupSnapshot;
99
// TODO(joyeecheung): deprecate and remove these underscore methods
1010
process._debugProcess = rawMethods._debugProcess;
@@ -21,7 +21,7 @@ function defineStream(name, getter) {
2121
__proto__: null,
2222
configurable: true,
2323
enumerable: true,
24-
get: getter
24+
get: getter,
2525
});
2626
}
2727

@@ -32,7 +32,7 @@ defineStream('stderr', getStderr);
3232
// Worker threads don't receive signals.
3333
const {
3434
startListeningIfSignal,
35-
stopListeningIfSignal
35+
stopListeningIfSignal,
3636
} = require('internal/process/signal');
3737
process.on('newListener', startListeningIfSignal);
3838
process.on('removeListener', stopListeningIfSignal);
@@ -72,13 +72,13 @@ function createWritableStdioStream(fd) {
7272
stream = new net.Socket({
7373
handle: process[kChannelHandle],
7474
readable: false,
75-
writable: true
75+
writable: true,
7676
});
7777
} else {
7878
stream = new net.Socket({
7979
fd,
8080
readable: false,
81-
writable: true
81+
writable: true,
8282
});
8383
}
8484

@@ -93,7 +93,7 @@ function createWritableStdioStream(fd) {
9393
stream = new Writable({
9494
write(buf, enc, cb) {
9595
cb();
96-
}
96+
},
9797
});
9898
}
9999
}
@@ -216,14 +216,14 @@ function getStdin() {
216216
handle: process.channel,
217217
readable: true,
218218
writable: false,
219-
manualStart: true
219+
manualStart: true,
220220
});
221221
} else {
222222
stdin = new net.Socket({
223223
fd: fd,
224224
readable: true,
225225
writable: false,
226-
manualStart: true
226+
manualStart: true,
227227
});
228228
}
229229
// Make sure the stdin can't be `.end()`-ed

lib/internal/bootstrap/switches/is_not_main_thread.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function defineStream(name, getter) {
1010
__proto__: null,
1111
configurable: true,
1212
enumerable: true,
13-
get: getter
13+
get: getter,
1414
});
1515
}
1616

@@ -21,7 +21,7 @@ defineStream('stderr', getStderr);
2121
// Worker threads don't receive signals.
2222
const {
2323
startListeningIfSignal,
24-
stopListeningIfSignal
24+
stopListeningIfSignal,
2525
} = require('internal/process/signal');
2626
process.removeListener('newListener', startListeningIfSignal);
2727
process.removeListener('removeListener', stopListeningIfSignal);
@@ -30,7 +30,7 @@ process.removeListener('removeListener', stopListeningIfSignal);
3030
// ---- compare the setups side-by-side -----
3131

3232
const {
33-
createWorkerStdio
33+
createWorkerStdio,
3434
} = require('internal/worker/io');
3535

3636
let workerStdio;

0 commit comments

Comments
 (0)