Skip to content

Commit d56e826

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 <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent 9db3304 commit d56e826

28 files changed

+48
-48
lines changed

doc/api/child_process.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,7 @@ const subprocess = spawn(
13261326
'-c',
13271327
`node -e "setInterval(() => {
13281328
console.log(process.pid, 'is alive')
1329-
}, 500);"`
1329+
}, 500);"`,
13301330
], {
13311331
stdio: ['inherit', 'inherit', 'inherit']
13321332
}
@@ -1661,7 +1661,7 @@ const subprocess = child_process.spawn('ls', {
16611661
stdio: [
16621662
0, // Use parent's stdin for child.
16631663
'pipe', // Pipe child's stdout to parent.
1664-
fs.openSync('err.out', 'w') // Direct child's stderr to a file.
1664+
fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
16651665
]
16661666
});
16671667

doc/api/dns.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ section if a custom port is used.
160160
'4.4.4.4',
161161
'2001:4860:4860::8888',
162162
'4.4.4.4:1053',
163-
'[2001:4860:4860::8888]:1053'
163+
'[2001:4860:4860::8888]:1053',
164164
]
165165
```
166166

@@ -666,7 +666,7 @@ dns.setServers([
666666
'4.4.4.4',
667667
'[2001:4860:4860::8888]',
668668
'4.4.4.4:1053',
669-
'[2001:4860:4860::8888]:1053'
669+
'[2001:4860:4860::8888]:1053',
670670
]);
671671
```
672672

@@ -773,7 +773,7 @@ section if a custom port is used.
773773
'4.4.4.4',
774774
'2001:4860:4860::8888',
775775
'4.4.4.4:1053',
776-
'[2001:4860:4860::8888]:1053'
776+
'[2001:4860:4860::8888]:1053',
777777
]
778778
```
779779

@@ -1184,7 +1184,7 @@ dnsPromises.setServers([
11841184
'4.4.4.4',
11851185
'[2001:4860:4860::8888]',
11861186
'4.4.4.4:1053',
1187-
'[2001:4860:4860::8888]:1053'
1187+
'[2001:4860:4860::8888]:1053',
11881188
]);
11891189
```
11901190

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
@@ -573,7 +573,7 @@ with [`JSON.stringify()`][].
573573
```js
574574
const myURLs = [
575575
new URL('https://www.example.com'),
576-
new URL('https://test.example.org')
576+
new URL('https://test.example.org'),
577577
];
578578
console.log(JSON.stringify(myURLs));
579579
// Prints ["https://www.example.com/","https://test.example.org/"]
@@ -710,7 +710,7 @@ let params;
710710
params = new URLSearchParams([
711711
['user', 'abc'],
712712
['query', 'first'],
713-
['query', 'second']
713+
['query', 'second'],
714714
]);
715715
console.log(params.toString());
716716
// Prints 'user=abc&query=first&query=second'
@@ -735,7 +735,7 @@ console.log(params.toString());
735735

736736
// Each key-value pair must have exactly two elements
737737
new URLSearchParams([
738-
['user', 'abc', 'error']
738+
['user', 'abc', 'error'],
739739
]);
740740
// Throws TypeError [ERR_INVALID_TUPLE]:
741741
// Each query pair must be an iterable [name, value] tuple

lib/assert.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const meta = [
9191
'\\u000f', '\\u0010', '\\u0011', '\\u0012', '\\u0013',
9292
'\\u0014', '\\u0015', '\\u0016', '\\u0017', '\\u0018',
9393
'\\u0019', '\\u001a', '\\u001b', '\\u001c', '\\u001d',
94-
'\\u001e', '\\u001f'
94+
'\\u001e', '\\u001f',
9595
];
9696

9797
const escapeFn = (str) => meta[StringPrototypeCharCodeAt(str, 0)];
@@ -268,7 +268,7 @@ function parseCode(code, offset) {
268268
node.node.start,
269269
StringPrototypeReplace(StringPrototypeSlice(code,
270270
node.node.start, node.node.end),
271-
escapeSequencesRegExp, escapeFn)
271+
escapeSequencesRegExp, escapeFn),
272272
];
273273
}
274274

lib/internal/bootstrap/loaders.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const internalBindingAllowlist = new SafeSet([
103103
'util',
104104
'uv',
105105
'v8',
106-
'zlib'
106+
'zlib',
107107
]);
108108

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

lib/internal/bootstrap/pre_execution.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ function initializeDeprecations() {
252252
'isSetIterator',
253253
'isTypedArray',
254254
'isUint8Array',
255-
'isAnyArrayBuffer'
255+
'isAnyArrayBuffer',
256256
]) {
257257
utilBinding[name] = pendingDeprecation ?
258258
deprecate(types[name],

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/random.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ function handleError(ex, buf) {
223223

224224
const kHexDigits = [
225225
48, 49, 50, 51, 52, 53, 54, 55,
226-
56, 57, 97, 98, 99, 100, 101, 102
226+
56, 57, 97, 98, 99, 100, 101, 102,
227227
];
228228

229229
const kBatchSize = 128;

lib/internal/encoding.js

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

292292
// 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
@@ -212,7 +212,7 @@ module.exports = function() {
212212
WebAssembly.CompileError.prototype,
213213
WebAssembly.LinkError.prototype,
214214
WebAssembly.RuntimeError.prototype,
215-
SharedArrayBuffer.prototype
215+
SharedArrayBuffer.prototype,
216216
];
217217
const intrinsics = [
218218
// Anonymous Intrinsics
@@ -326,7 +326,7 @@ module.exports = function() {
326326
BigInt,
327327
Atomics,
328328
WebAssembly,
329-
SharedArrayBuffer
329+
SharedArrayBuffer,
330330
];
331331

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

lib/internal/http2/util.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const kValidPseudoHeaders = new Set([
103103
HTTP2_HEADER_AUTHORITY,
104104
HTTP2_HEADER_SCHEME,
105105
HTTP2_HEADER_PATH,
106-
HTTP2_HEADER_PROTOCOL
106+
HTTP2_HEADER_PROTOCOL,
107107
]);
108108

109109
// This set contains headers that are permitted to have only a single
@@ -147,7 +147,7 @@ const kSingleValueHeaders = new Set([
147147
HTTP2_HEADER_TK,
148148
HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS,
149149
HTTP2_HEADER_USER_AGENT,
150-
HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS
150+
HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS,
151151
]);
152152

153153
// The HTTP methods in this set are specifically defined as assigning no
@@ -157,7 +157,7 @@ const kSingleValueHeaders = new Set([
157157
const kNoPayloadMethods = new Set([
158158
HTTP2_METHOD_DELETE,
159159
HTTP2_METHOD_GET,
160-
HTTP2_METHOD_HEAD
160+
HTTP2_METHOD_HEAD,
161161
]);
162162

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

lib/internal/main/print_help.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ const envVars = new SafeMap(ArrayPrototypeConcat([
6060
['NODE_V8_COVERAGE', { helpText: 'directory to output v8 coverage JSON ' +
6161
'to' }],
6262
['UV_THREADPOOL_SIZE', { helpText: 'sets the number of threads used in ' +
63-
'libuv\'s threadpool' }]
63+
'libuv\'s threadpool' }],
6464
], hasIntl ? [
6565
['NODE_ICU_DATA', { helpText: 'data path for ICU (Intl object) data' +
66-
hasSmallICU ? '' : ' (will extend linked-in data)' }]
66+
hasSmallICU ? '' : ' (will extend linked-in data)' }],
6767
] : []), (hasNodeOptions ? [
6868
['NODE_OPTIONS', { helpText: 'set CLI options in the environment via a ' +
69-
'space-separated list' }]
69+
'space-separated list' }],
7070
] : []), hasCrypto ? [
7171
['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }],
7272
['SSL_CERT_DIR', { helpText: 'sets OpenSSL\'s directory of trusted ' +

lib/internal/modules/cjs/loader.js

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

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

202202
let wrapperProxy = new Proxy(wrapper, {

lib/internal/process/per_thread.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function wrapProcessMethods(binding) {
138138

139139
return [
140140
hrValues[0] * 0x100000000 + hrValues[1],
141-
hrValues[2]
141+
hrValues[2],
142142
];
143143
}
144144

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

lib/internal/streams/pipeline.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ function pipeline(...streams) {
221221
pt.end(val);
222222
}, (err) => {
223223
pt.destroy(err);
224-
}
224+
},
225225
]);
226226
} else if (isIterable(ret, true)) {
227227
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
@@ -844,7 +844,7 @@ const noEscape = new Int8Array([
844844
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 0x4F
845845
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 0x50 - 0x5F
846846
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 0x6F
847-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 // 0x70 - 0x7F
847+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, // 0x70 - 0x7F
848848
]);
849849

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

lib/internal/util/comparisons.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function isIdenticalTypedArrayType(a, b) {
142142
isBigInt64Array,
143143
isBigUint64Array,
144144
isUint8ClampedArray,
145-
isUint8Array
145+
isUint8Array,
146146
]) {
147147
if (check(a)) {
148148
return check(b);

lib/internal/util/inspect.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ function formatProxy(ctx, proxy, recurseTimes) {
695695
ctx.indentationLvl += 2;
696696
const res = [
697697
formatValue(ctx, proxy[0], recurseTimes),
698-
formatValue(ctx, proxy[1], recurseTimes)
698+
formatValue(ctx, proxy[1], recurseTimes),
699699
];
700700
ctx.indentationLvl -= 2;
701701
return reduceToSingleString(
@@ -1513,7 +1513,7 @@ function formatTypedArray(value, length, ctx, ignored, recurseTimes) {
15131513
'length',
15141514
'byteLength',
15151515
'byteOffset',
1516-
'buffer'
1516+
'buffer',
15171517
]) {
15181518
const str = formatValue(ctx, value[key], recurseTimes, true);
15191519
output.push(`[${key}]: ${str}`);
@@ -1591,7 +1591,7 @@ function formatMapIterInner(ctx, recurseTimes, entries, state) {
15911591
const pos = i * 2;
15921592
const res = [
15931593
formatValue(ctx, entries[pos], recurseTimes),
1594-
formatValue(ctx, entries[pos + 1], recurseTimes)
1594+
formatValue(ctx, entries[pos + 1], recurseTimes),
15951595
];
15961596
output[i] = reduceToSingleString(
15971597
ctx, res, '', ['[', ']'], kArrayExtrasType, recurseTimes);
@@ -1641,7 +1641,7 @@ function formatPromise(ctx, value, recurseTimes) {
16411641
output = [
16421642
state === kRejected ?
16431643
`${ctx.stylize('<rejected>', 'special')} ${str}` :
1644-
str
1644+
str,
16451645
];
16461646
}
16471647
return output;

lib/internal/v8_prof_processor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const scriptFiles = [
2020
'internal/deps/v8/tools/arguments',
2121
'internal/deps/v8/tools/tickprocessor',
2222
'internal/deps/v8/tools/SourceMap',
23-
'internal/deps/v8/tools/tickprocessor-driver'
23+
'internal/deps/v8/tools/tickprocessor-driver',
2424
];
2525
let script = '';
2626

lib/perf_hooks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const observerableTypes = [
9494
'gc',
9595
'function',
9696
'http2',
97-
'http'
97+
'http',
9898
];
9999

100100
const IDX_STREAM_STATS_ID = 0;

lib/querystring.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const unhexTable = new Int8Array([
7474
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
7575
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
7676
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
77-
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // ... 255
77+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 255
7878
]);
7979
/**
8080
* A safe fast alternative to decodeURIComponent
@@ -152,7 +152,7 @@ const noEscape = new Int8Array([
152152
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79
153153
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 80 - 95
154154
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111
155-
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 // 112 - 127
155+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, // 112 - 127
156156
]);
157157

158158
/**

lib/readline.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ function Interface(input, output, completer, terminal) {
144144
this.escapeCodeTimeout = ESCAPE_CODE_TIMEOUT;
145145
this.tabSize = 8;
146146

147-
FunctionPrototypeCall(EventEmitter, this,);
147+
FunctionPrototypeCall(EventEmitter, this);
148148
let history;
149149
let historySize;
150150
let removeHistoryDuplicates = false;

lib/repl.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1631,7 +1631,7 @@ function addCommonWords(completionGroups) {
16311631
'debugger', 'default', 'delete', 'do', 'else', 'export', 'false',
16321632
'finally', 'for', 'function', 'if', 'import', 'in', 'instanceof', 'let',
16331633
'new', 'null', 'return', 'switch', 'this', 'throw', 'true', 'try',
1634-
'typeof', 'var', 'void', 'while', 'with', 'yield'
1634+
'typeof', 'var', 'void', 'while', 'with', 'yield',
16351635
]);
16361636
}
16371637

0 commit comments

Comments
 (0)