Skip to content

Commit ab89428

Browse files
committed
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 5790965 commit ab89428

Some content is hidden

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

65 files changed

+246
-280
lines changed

lib/.eslintrc.yaml

Lines changed: 0 additions & 34 deletions
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

Lines changed: 5 additions & 5 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ internalBinding('async_wrap').setupHooks(nativeHooks);
209209

210210
const {
211211
setupTaskQueue,
212-
queueMicrotask
212+
queueMicrotask,
213213
} = require('internal/process/task_queues');
214214

215215
// Non-standard extensions:
@@ -248,11 +248,11 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', {
248248
value,
249249
configurable: true,
250250
enumerable: true,
251-
writable: true
251+
writable: true,
252252
});
253253
},
254254
enumerable: true,
255-
configurable: true
255+
configurable: true,
256256
});
257257

258258
// process.assert
@@ -277,22 +277,22 @@ const features = {
277277
// code cache even if the binary is built with embedded code cache.
278278
get cached_builtins() {
279279
return binding.hasCachedBuiltins();
280-
}
280+
},
281281
};
282282

283283
ObjectDefineProperty(process, 'features', {
284284
__proto__: null,
285285
enumerable: true,
286286
writable: false,
287287
configurable: false,
288-
value: features
288+
value: features,
289289
});
290290

291291
{
292292
const {
293293
onGlobalUncaughtException,
294294
setUncaughtExceptionCaptureCallback,
295-
hasUncaughtExceptionCaptureCallback
295+
hasUncaughtExceptionCaptureCallback,
296296
} = require('internal/process/execution');
297297

298298
// For legacy reasons this is still called `_fatalException`, even
@@ -339,14 +339,14 @@ process.emitWarning = emitWarning;
339339
function setupPrepareStackTrace() {
340340
const {
341341
setEnhanceStackForFatalException,
342-
setPrepareStackTraceCallback
342+
setPrepareStackTraceCallback,
343343
} = internalBinding('errors');
344344
const {
345345
prepareStackTrace,
346346
fatalExceptionStackEnhancers: {
347347
beforeInspector,
348-
afterInspector
349-
}
348+
afterInspector,
349+
},
350350
} = require('internal/errors');
351351
// Tell our PrepareStackTraceCallback passed to the V8 API
352352
// to call prepareStackTrace().
@@ -365,7 +365,7 @@ function setupProcessObject() {
365365
enumerable: false,
366366
writable: true,
367367
configurable: false,
368-
value: 'process'
368+
value: 'process',
369369
});
370370

371371
// Create global.process as getters so that we have a
@@ -391,7 +391,7 @@ function setupGlobalProxy() {
391391
value: 'global',
392392
writable: false,
393393
enumerable: false,
394-
configurable: true
394+
configurable: true,
395395
});
396396
globalThis.global = globalThis;
397397
}

lib/internal/bootstrap/switches/does_not_own_process_state.js

Lines changed: 1 addition & 1 deletion
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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 8 additions & 8 deletions
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

Lines changed: 3 additions & 3 deletions
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)