Skip to content

Commit 6205e29

Browse files
Trotttargos
authored andcommitted
doc,lib: prepare for stricter multi-line array linting
We're about to turn on a requirement for dangling commas. PR-URL: #37088 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent b634469 commit 6205e29

35 files changed

+59
-59
lines changed

doc/api/child_process.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ const subprocess = spawn(
12251225
'-c',
12261226
`node -e "setInterval(() => {
12271227
console.log(process.pid, 'is alive')
1228-
}, 500);"`
1228+
}, 500);"`,
12291229
], {
12301230
stdio: ['inherit', 'inherit', 'inherit']
12311231
}
@@ -1558,7 +1558,7 @@ const subprocess = child_process.spawn('ls', {
15581558
stdio: [
15591559
0, // Use parent's stdin for child.
15601560
'pipe', // Pipe child's stdout to parent.
1561-
fs.openSync('err.out', 'w') // Direct child's stderr to a file.
1561+
fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
15621562
]
15631563
});
15641564

doc/api/dns.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ section if a custom port is used.
155155
'4.4.4.4',
156156
'2001:4860:4860::8888',
157157
'4.4.4.4:1053',
158-
'[2001:4860:4860::8888]:1053'
158+
'[2001:4860:4860::8888]:1053',
159159
]
160160
```
161161

@@ -645,7 +645,7 @@ dns.setServers([
645645
'4.4.4.4',
646646
'[2001:4860:4860::8888]',
647647
'4.4.4.4:1053',
648-
'[2001:4860:4860::8888]:1053'
648+
'[2001:4860:4860::8888]:1053',
649649
]);
650650
```
651651

@@ -755,7 +755,7 @@ section if a custom port is used.
755755
'4.4.4.4',
756756
'2001:4860:4860::8888',
757757
'4.4.4.4:1053',
758-
'[2001:4860:4860::8888]:1053'
758+
'[2001:4860:4860::8888]:1053',
759759
]
760760
```
761761

@@ -1148,7 +1148,7 @@ dnsPromises.setServers([
11481148
'4.4.4.4',
11491149
'[2001:4860:4860::8888]',
11501150
'4.4.4.4:1053',
1151-
'[2001:4860:4860::8888]:1053'
1151+
'[2001:4860:4860::8888]:1053',
11521152
]);
11531153
```
11541154

doc/api/os.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ The properties included on each object include:
115115
idle: 1070905480,
116116
irq: 20
117117
}
118-
}
118+
},
119119
]
120120
```
121121

doc/api/url.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ with [`JSON.stringify()`][].
566566
```js
567567
const myURLs = [
568568
new URL('https://www.example.com'),
569-
new URL('https://test.example.org')
569+
new URL('https://test.example.org'),
570570
];
571571
console.log(JSON.stringify(myURLs));
572572
// Prints ["https://www.example.com/","https://test.example.org/"]
@@ -703,7 +703,7 @@ let params;
703703
params = new URLSearchParams([
704704
['user', 'abc'],
705705
['query', 'first'],
706-
['query', 'second']
706+
['query', 'second'],
707707
]);
708708
console.log(params.toString());
709709
// Prints 'user=abc&query=first&query=second'
@@ -728,7 +728,7 @@ console.log(params.toString());
728728

729729
// Each key-value pair must have exactly two elements
730730
new URLSearchParams([
731-
['user', 'abc', 'error']
731+
['user', 'abc', 'error'],
732732
]);
733733
// Throws TypeError [ERR_INVALID_TUPLE]:
734734
// Each query pair must be an iterable [name, value] tuple

doc/api/webcrypto.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ const { subtle } = require('crypto').webcrypto;
187187
async function generateAndWrapHmacKey(format = 'jwk', hash = 'SHA-512') {
188188
const [
189189
key,
190-
wrappingKey
190+
wrappingKey,
191191
] = await Promise.all([
192192
subtle.generateKey({
193193
name: 'HMAC', hash
194194
}, true, ['sign', 'verify']),
195195
subtle.generateKey({
196196
name: 'AES-KW',
197197
length: 256
198-
}, true, ['wrapKey', 'unwrapKey'])
198+
}, true, ['wrapKey', 'unwrapKey']),
199199
]);
200200

201201
const wrappedKey = await subtle.wrapKey(format, key, wrappingKey, 'AES-KW');

lib/assert.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const meta = [
9595
'\\u000f', '\\u0010', '\\u0011', '\\u0012', '\\u0013',
9696
'\\u0014', '\\u0015', '\\u0016', '\\u0017', '\\u0018',
9797
'\\u0019', '\\u001a', '\\u001b', '\\u001c', '\\u001d',
98-
'\\u001e', '\\u001f'
98+
'\\u001e', '\\u001f',
9999
];
100100

101101
const escapeFn = (str) => meta[StringPrototypeCharCodeAt(str, 0)];
@@ -276,7 +276,7 @@ function parseCode(code, offset) {
276276
node.node.start,
277277
StringPrototypeReplace(StringPrototypeSlice(code,
278278
node.node.start, node.node.end),
279-
escapeSequencesRegExp, escapeFn)
279+
escapeSequencesRegExp, escapeFn),
280280
];
281281
}
282282

lib/internal/bootstrap/loaders.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const internalBindingAllowlist = new SafeSet([
102102
'util',
103103
'uv',
104104
'v8',
105-
'zlib'
105+
'zlib',
106106
]);
107107

108108
// Set up process.binding() and process._linkedBinding().

lib/internal/bootstrap/pre_execution.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ function initializeDeprecations() {
263263
'isSetIterator',
264264
'isTypedArray',
265265
'isUint8Array',
266-
'isAnyArrayBuffer'
266+
'isAnyArrayBuffer',
267267
]) {
268268
utilBinding[name] = pendingDeprecation ?
269269
deprecate(types[name],

lib/internal/child_process/serialization.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const advanced = {
8484
sizeBuffer.writeUInt32BE(serializedMessage.length);
8585
return channel.writeBuffer(req, Buffer.concat([
8686
sizeBuffer,
87-
serializedMessage
87+
serializedMessage,
8888
]), handle);
8989
},
9090
};

lib/internal/console/constructor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ const consoleMethods = {
532532
}
533533
}
534534
return final([
535-
iterKey, keyKey, valuesKey
535+
iterKey, keyKey, valuesKey,
536536
], [
537537
getIndexArray(length),
538538
keys,

lib/internal/crypto/hkdf.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ function prepareKey(key) {
9595
'ArrayBuffer',
9696
'TypedArray',
9797
'DataView',
98-
'Buffer'
98+
'Buffer',
9999
],
100100
key);
101101
}

lib/internal/crypto/keygen.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function parseKeyEncoding(keyType, options = {}) {
150150
privateFormat,
151151
privateType,
152152
cipher,
153-
passphrase
153+
passphrase,
154154
];
155155
}
156156

lib/internal/crypto/keys.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ const [
9090
KeyObject,
9191
SecretKeyObject,
9292
PublicKeyObject,
93-
PrivateKeyObject
93+
PrivateKeyObject,
9494
] = createNativeKeyObjectClass((NativeKeyObject) => {
9595
// Publicly visible KeyObject class.
9696
class KeyObject extends NativeKeyObject {

lib/internal/crypto/random.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function getRandomValues(data) {
296296

297297
const kHexDigits = [
298298
48, 49, 50, 51, 52, 53, 54, 55,
299-
56, 57, 97, 98, 99, 100, 101, 102
299+
56, 57, 97, 98, 99, 100, 101, 102,
300300
];
301301

302302
const kBatchSize = 128;

lib/internal/crypto/util.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ const getArrayBufferOrView = hideStackFrames((buffer, name, encoding) => {
133133
'ArrayBuffer',
134134
'Buffer',
135135
'TypedArray',
136-
'DataView'
136+
'DataView',
137137
],
138138
buffer
139139
);
@@ -200,7 +200,7 @@ const kHashTypes = [
200200
'SHA-1',
201201
'SHA-256',
202202
'SHA-384',
203-
'SHA-512'
203+
'SHA-512',
204204
];
205205

206206
function validateMaxBufferLength(data, name) {
@@ -278,7 +278,7 @@ const validateByteSource = hideStackFrames((val, name) => {
278278
'ArrayBuffer',
279279
'TypedArray',
280280
'DataView',
281-
'Buffer'
281+
'Buffer',
282282
],
283283
val);
284284
});

lib/internal/encoding.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ const encodings = new SafeMap([
285285
['windows-949', 'euc-kr'],
286286
['utf-16be', 'utf-16be'],
287287
['utf-16le', 'utf-16le'],
288-
['utf-16', 'utf-16le']
288+
['utf-16', 'utf-16le'],
289289
]);
290290

291291
// Unfortunately, String.prototype.trim also removes non-ascii whitespace,

lib/internal/errors.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const kTypes = [
7070
'Object',
7171
'boolean',
7272
'bigint',
73-
'symbol'
73+
'symbol',
7474
];
7575

7676
const MainContextError = Error;

lib/internal/freeze_intrinsics.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ module.exports = function() {
203203
WebAssembly.CompileError.prototype,
204204
WebAssembly.LinkError.prototype,
205205
WebAssembly.RuntimeError.prototype,
206-
SharedArrayBuffer.prototype
206+
SharedArrayBuffer.prototype,
207207
];
208208
const intrinsics = [
209209
// Anonymous Intrinsics
@@ -317,7 +317,7 @@ module.exports = function() {
317317
BigInt,
318318
Atomics,
319319
WebAssembly,
320-
SharedArrayBuffer
320+
SharedArrayBuffer,
321321
];
322322

323323
if (typeof Intl !== 'undefined') {

lib/internal/http2/util.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const kValidPseudoHeaders = new SafeSet([
108108
HTTP2_HEADER_AUTHORITY,
109109
HTTP2_HEADER_SCHEME,
110110
HTTP2_HEADER_PATH,
111-
HTTP2_HEADER_PROTOCOL
111+
HTTP2_HEADER_PROTOCOL,
112112
]);
113113

114114
// This set contains headers that are permitted to have only a single
@@ -153,7 +153,7 @@ const kSingleValueHeaders = new SafeSet([
153153
HTTP2_HEADER_TK,
154154
HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS,
155155
HTTP2_HEADER_USER_AGENT,
156-
HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS
156+
HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS,
157157
]);
158158

159159
// The HTTP methods in this set are specifically defined as assigning no
@@ -163,7 +163,7 @@ const kSingleValueHeaders = new SafeSet([
163163
const kNoPayloadMethods = new SafeSet([
164164
HTTP2_METHOD_DELETE,
165165
HTTP2_METHOD_GET,
166-
HTTP2_METHOD_HEAD
166+
HTTP2_METHOD_HEAD,
167167
]);
168168

169169
// The following ArrayBuffer instances are used to share memory more efficiently

lib/internal/main/print_help.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ const envVars = new SafeMap(ArrayPrototypeConcat([
5555
['NODE_V8_COVERAGE', { helpText: 'directory to output v8 coverage JSON ' +
5656
'to' }],
5757
['UV_THREADPOOL_SIZE', { helpText: 'sets the number of threads used in ' +
58-
'libuv\'s threadpool' }]
58+
'libuv\'s threadpool' }],
5959
], hasIntl ? [
6060
['NODE_ICU_DATA', { helpText: 'data path for ICU (Intl object) data' +
61-
hasSmallICU ? '' : ' (will extend linked-in data)' }]
61+
hasSmallICU ? '' : ' (will extend linked-in data)' }],
6262
] : []), (hasNodeOptions ? [
6363
['NODE_OPTIONS', { helpText: 'set CLI options in the environment via a ' +
64-
'space-separated list' }]
64+
'space-separated list' }],
6565
] : []), hasCrypto ? [
6666
['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }],
6767
['SSL_CERT_DIR', { helpText: 'sets OpenSSL\'s directory of trusted ' +
@@ -108,7 +108,7 @@ function format(
108108
let maxFirstColumnUsed = 0;
109109

110110
for (const [
111-
name, { helpText, type, value }
111+
name, { helpText, type, value },
112112
] of ArrayPrototypeSort([...options.entries()])) {
113113
if (!helpText) continue;
114114

lib/internal/modules/cjs/loader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ let wrap = function(script) {
195195

196196
const wrapper = [
197197
'(function (exports, require, module, __filename, __dirname) { ',
198-
'\n});'
198+
'\n});',
199199
];
200200

201201
let wrapperProxy = new Proxy(wrapper, {

lib/internal/per_context/primordials.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ function copyPrototype(src, dest, prefix) {
145145
[
146146
'JSON',
147147
'Math',
148-
'Reflect'
148+
'Reflect',
149149
].forEach((name) => {
150150
copyPropsRenamed(global[name], primordials, name);
151151
});

lib/internal/process/per_thread.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function getFastAPIs(binding) {
7272

7373
return [
7474
hrValues[0] * 0x100000000 + hrValues[1],
75-
hrValues[2]
75+
hrValues[2],
7676
];
7777
}
7878

lib/internal/querystring.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const isHexTable = new Int8Array([
3333
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3434
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
3535
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
36-
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // ... 256
36+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // ... 256
3737
]);
3838

3939
function encodeStr(str, noEscapeTable, hexTable) {

lib/internal/streams/pipeline.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ function pipeline(...streams) {
237237
pt.end(val);
238238
}, (err) => {
239239
pt.destroy(err);
240-
}
240+
},
241241
]);
242242
} else if (isIterable(ret, true)) {
243243
finishCount++;

lib/internal/tty.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ const TERM_ENVS_REG_EXP = [
7777
/^rxvt/,
7878
/^screen/,
7979
/^xterm/,
80-
/^vt100/
80+
/^vt100/,
8181
];
8282

8383
let warned = false;

lib/internal/url.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1088,7 +1088,7 @@ const noEscape = new Int8Array([
10881088
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 0x4F
10891089
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 0x50 - 0x5F
10901090
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 0x6F
1091-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 // 0x70 - 0x7F
1091+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, // 0x70 - 0x7F
10921092
]);
10931093

10941094
// Special version of hexTable that uses `+` for U+0020 SPACE.

0 commit comments

Comments
 (0)