Skip to content

Commit 05614f8

Browse files
aduh95targos
authored andcommitted
lib: enforce use of trailing commas
PR-URL: #46881 Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Jacob Smith <jacob@frende.me>
1 parent debc0ad commit 05614f8

Some content is hidden

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

67 files changed

+251
-285
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:
@@ -261,30 +254,3 @@ globals:
261254
module: false
262255
internalBinding: false
263256
primordials: false
264-
overrides:
265-
- files:
266-
- ./*/*.js
267-
- ./*.js
268-
- ./internal/child_process/*.js
269-
- ./internal/cluster/*.js
270-
- ./internal/debugger/*.js
271-
- ./internal/events/*.js
272-
- ./internal/fs/*.js
273-
- ./internal/modules/*.js
274-
- ./internal/per_context/*.js
275-
- ./internal/perf/*.js
276-
- ./internal/policy/*.js
277-
- ./internal/process/*.js
278-
- ./internal/readline/*.js
279-
- ./internal/readme.md
280-
- ./internal/repl/*.js
281-
- ./internal/source_map/*.js
282-
- ./internal/streams/*.js
283-
- ./internal/test/*.js
284-
- ./internal/test_runner/**/*.js
285-
- ./internal/tls/*.js
286-
- ./internal/util/parse_args/*.js
287-
- ./internal/watch_mode/*.js
288-
- ./internal/webstreams/*.js
289-
rules:
290-
comma-dangle: [error, always-multiline]

lib/internal/assert/assertion_error.js

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

4444
// Comparing short primitives should just show === / !== instead of using the
@@ -330,11 +330,11 @@ class AssertionError extends Error {
330330
stackStartFn,
331331
details,
332332
// Compatibility with older versions.
333-
stackStartFunction
333+
stackStartFunction,
334334
} = options;
335335
let {
336336
actual,
337-
expected
337+
expected,
338338
} = options;
339339

340340
const limit = Error.stackTraceLimit;
@@ -429,7 +429,7 @@ class AssertionError extends Error {
429429
value: 'AssertionError [ERR_ASSERTION]',
430430
enumerable: false,
431431
writable: true,
432-
configurable: true
432+
configurable: true,
433433
});
434434
this.code = 'ERR_ASSERTION';
435435
if (details) {
@@ -478,7 +478,7 @@ class AssertionError extends Error {
478478
const result = inspect(this, {
479479
...ctx,
480480
customInspect: false,
481-
depth: 0
481+
depth: 0,
482482
});
483483

484484
// 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

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function exposeNamespace(target, name, namespaceObject) {
9494
writable: true,
9595
enumerable: false,
9696
configurable: true,
97-
value: namespaceObject
97+
value: namespaceObject,
9898
});
9999
}
100100

lib/internal/bootstrap/loaders.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ObjectDefineProperty(process, 'moduleLoadList', {
6868
value: moduleLoadList,
6969
configurable: true,
7070
enumerable: true,
71-
writable: false
71+
writable: false,
7272
});
7373

7474

@@ -181,7 +181,7 @@ let internalBinding;
181181
const loaderId = 'internal/bootstrap/loaders';
182182
const {
183183
builtinIds,
184-
compileFunction
184+
compileFunction,
185185
} = internalBinding('builtins');
186186

187187
const getOwn = (target, property, receiver) => {
@@ -349,7 +349,7 @@ class BuiltinModule {
349349
const loaderExports = {
350350
internalBinding,
351351
BuiltinModule,
352-
require: requireBuiltin
352+
require: requireBuiltin,
353353
};
354354

355355
function requireBuiltin(id) {

lib/internal/bootstrap/node.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ internalBinding('async_wrap').setupHooks(nativeHooks);
197197

198198
const {
199199
setupTaskQueue,
200-
queueMicrotask
200+
queueMicrotask,
201201
} = require('internal/process/task_queues');
202202

203203
// Non-standard extensions:
@@ -236,11 +236,11 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', {
236236
value,
237237
configurable: true,
238238
enumerable: true,
239-
writable: true
239+
writable: true,
240240
});
241241
},
242242
enumerable: true,
243-
configurable: true
243+
configurable: true,
244244
});
245245

246246
// process.assert
@@ -265,22 +265,22 @@ const features = {
265265
// code cache even if the binary is built with embedded code cache.
266266
get cached_builtins() {
267267
return binding.hasCachedBuiltins();
268-
}
268+
},
269269
};
270270

271271
ObjectDefineProperty(process, 'features', {
272272
__proto__: null,
273273
enumerable: true,
274274
writable: false,
275275
configurable: false,
276-
value: features
276+
value: features,
277277
});
278278

279279
{
280280
const {
281281
onGlobalUncaughtException,
282282
setUncaughtExceptionCaptureCallback,
283-
hasUncaughtExceptionCaptureCallback
283+
hasUncaughtExceptionCaptureCallback,
284284
} = require('internal/process/execution');
285285

286286
// For legacy reasons this is still called `_fatalException`, even
@@ -327,14 +327,14 @@ process.emitWarning = emitWarning;
327327
function setupPrepareStackTrace() {
328328
const {
329329
setEnhanceStackForFatalException,
330-
setPrepareStackTraceCallback
330+
setPrepareStackTraceCallback,
331331
} = internalBinding('errors');
332332
const {
333333
prepareStackTrace,
334334
fatalExceptionStackEnhancers: {
335335
beforeInspector,
336-
afterInspector
337-
}
336+
afterInspector,
337+
},
338338
} = require('internal/errors');
339339
// Tell our PrepareStackTraceCallback passed to the V8 API
340340
// to call prepareStackTrace().
@@ -353,7 +353,7 @@ function setupProcessObject() {
353353
enumerable: false,
354354
writable: true,
355355
configurable: false,
356-
value: 'process'
356+
value: 'process',
357357
});
358358

359359
// Create global.process as getters so that we have a
@@ -379,7 +379,7 @@ function setupGlobalProxy() {
379379
value: 'global',
380380
writable: false,
381381
enumerable: false,
382-
configurable: true
382+
configurable: true,
383383
});
384384
globalThis.global = globalThis;
385385
}

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
@@ -5,7 +5,7 @@ const rawMethods = internalBinding('process_methods');
55
const {
66
namespace: {
77
addSerializeCallback,
8-
isBuildingSnapshot
8+
isBuildingSnapshot,
99
},
1010
} = require('internal/v8/startup_snapshot');
1111
// TODO(joyeecheung): deprecate and remove these underscore methods
@@ -23,7 +23,7 @@ function defineStream(name, getter) {
2323
__proto__: null,
2424
configurable: true,
2525
enumerable: true,
26-
get: getter
26+
get: getter,
2727
});
2828
}
2929

@@ -34,7 +34,7 @@ defineStream('stderr', getStderr);
3434
// Worker threads don't receive signals.
3535
const {
3636
startListeningIfSignal,
37-
stopListeningIfSignal
37+
stopListeningIfSignal,
3838
} = require('internal/process/signal');
3939
process.on('newListener', startListeningIfSignal);
4040
process.on('removeListener', stopListeningIfSignal);
@@ -74,13 +74,13 @@ function createWritableStdioStream(fd) {
7474
stream = new net.Socket({
7575
handle: process[kChannelHandle],
7676
readable: false,
77-
writable: true
77+
writable: true,
7878
});
7979
} else {
8080
stream = new net.Socket({
8181
fd,
8282
readable: false,
83-
writable: true
83+
writable: true,
8484
});
8585
}
8686

@@ -95,7 +95,7 @@ function createWritableStdioStream(fd) {
9595
stream = new Writable({
9696
write(buf, enc, cb) {
9797
cb();
98-
}
98+
},
9999
});
100100
}
101101
}
@@ -218,14 +218,14 @@ function getStdin() {
218218
handle: process.channel,
219219
readable: true,
220220
writable: false,
221-
manualStart: true
221+
manualStart: true,
222222
});
223223
} else {
224224
stdin = new net.Socket({
225225
fd: fd,
226226
readable: true,
227227
writable: false,
228-
manualStart: true
228+
manualStart: true,
229229
});
230230
}
231231
// 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)