Skip to content

Commit 9c69ca5

Browse files
Trotttargos
authored andcommitted
test,doc,lib: adjust object literal newlines for lint rule
Before enabling object-curly-newline for our ESLint rules, adjust files to comply with it. Refs: https://eslint.org/docs/rules/object-curly-newline PR-URL: #37040 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 110063d commit 9c69ca5

33 files changed

+159
-181
lines changed

doc/api/http2.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3675,7 +3675,8 @@ will be emitted.
36753675
const body = 'hello world';
36763676
response.writeHead(200, {
36773677
'Content-Length': Buffer.byteLength(body),
3678-
'Content-Type': 'text/plain; charset=utf-8' });
3678+
'Content-Type': 'text/plain; charset=utf-8',
3679+
});
36793680
```
36803681

36813682
`Content-Length` is given in bytes not characters. The

lib/internal/async_hooks.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,10 @@ const { resource_symbol, owner_symbol } = internalBinding('symbols');
9191
// Each constant tracks how many callbacks there are for any given step of
9292
// async execution. These are tracked so if the user didn't include callbacks
9393
// for a given step, that step can bail out early.
94-
const { kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,
95-
kCheck, kExecutionAsyncId, kAsyncIdCounter, kTriggerAsyncId,
96-
kDefaultTriggerAsyncId, kStackLength, kUsesExecutionAsyncResource
94+
const {
95+
kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,
96+
kCheck, kExecutionAsyncId, kAsyncIdCounter, kTriggerAsyncId,
97+
kDefaultTriggerAsyncId, kStackLength, kUsesExecutionAsyncResource,
9798
} = async_wrap.constants;
9899

99100
const { async_id_symbol,

lib/internal/encoding.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,8 @@ ObjectDefineProperties(
363363
'encode': { enumerable: true },
364364
'encodeInto': { enumerable: true },
365365
'encoding': { enumerable: true },
366-
[SymbolToStringTag]: {
367-
configurable: true,
368-
value: 'TextEncoder'
369-
} });
366+
[SymbolToStringTag]: { configurable: true, value: 'TextEncoder' },
367+
});
370368

371369
const TextDecoder =
372370
internalBinding('config').hasIntl ?

lib/internal/http2/core.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,10 @@ const {
126126
} = require('internal/validators');
127127
const fsPromisesInternal = require('internal/fs/promises');
128128
const { utcDate } = require('internal/http');
129-
const { onServerStream,
130-
Http2ServerRequest,
131-
Http2ServerResponse,
129+
const {
130+
Http2ServerRequest,
131+
Http2ServerResponse,
132+
onServerStream,
132133
} = require('internal/http2/compat');
133134

134135
const {

test/doctool/test-doctool-json.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,7 @@ const testData = [
121121
{ 'version': 'v4.2.0',
122122
'pr-url': 'https://github.com/nodejs/node/pull/3276',
123123
'description': 'The `error` parameter can now be ' +
124-
'an arrow function.'
125-
}
124+
'an arrow function.' }
126125
]
127126
},
128127
desc: '<p>Describe <code>Foobar II</code> in more detail ' +

test/node-api/test_threadsafe_function/test.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ function testWithJSMarshaller({
3636
quitAfter,
3737
abort,
3838
maxQueueSize,
39-
launchSecondary }) {
39+
launchSecondary,
40+
}) {
4041
return new Promise((resolve) => {
4142
const array = [];
4243
binding[threadStarter](function testCallback(value) {

test/parallel/test-dns.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -362,18 +362,15 @@ assert.throws(() => {
362362
expire: 1800,
363363
minttl: 3333333333
364364
},
365-
]
366-
},
365+
] },
367366

368367
{ method: 'resolve4',
369368
options: { ttl: true },
370-
answers: [ { type: 'A', address: '1.2.3.4', ttl: 3333333333 } ]
371-
},
369+
answers: [ { type: 'A', address: '1.2.3.4', ttl: 3333333333 } ] },
372370

373371
{ method: 'resolve6',
374372
options: { ttl: true },
375-
answers: [ { type: 'AAAA', address: '::42', ttl: 3333333333 } ]
376-
},
373+
answers: [ { type: 'AAAA', address: '::42', ttl: 3333333333 } ] },
377374

378375
{ method: 'resolveSoa',
379376
answers: [
@@ -387,8 +384,7 @@ assert.throws(() => {
387384
expire: 1800,
388385
minttl: 3333333333
389386
}
390-
]
391-
},
387+
] },
392388
];
393389

394390
const server = dgram.createSocket('udp4');

test/parallel/test-fs-open-flags.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ const { O_APPEND = 0,
3838
O_SYNC = 0,
3939
O_DSYNC = 0,
4040
O_TRUNC = 0,
41-
O_WRONLY = 0
42-
} = fs.constants;
41+
O_WRONLY = 0 } = fs.constants;
4342

4443
const { stringToFlags } = require('internal/fs/utils');
4544

test/parallel/test-fs-readfile.js

+5-10
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,15 @@ tmpdir.refresh();
1515

1616
const fileInfo = [
1717
{ name: path.join(tmpdir.path, `${prefix}-1K.txt`),
18-
len: 1024,
19-
},
18+
len: 1024 },
2019
{ name: path.join(tmpdir.path, `${prefix}-64K.txt`),
21-
len: 64 * 1024,
22-
},
20+
len: 64 * 1024 },
2321
{ name: path.join(tmpdir.path, `${prefix}-64KLessOne.txt`),
24-
len: (64 * 1024) - 1,
25-
},
22+
len: (64 * 1024) - 1 },
2623
{ name: path.join(tmpdir.path, `${prefix}-1M.txt`),
27-
len: 1 * 1024 * 1024,
28-
},
24+
len: 1 * 1024 * 1024 },
2925
{ name: path.join(tmpdir.path, `${prefix}-1MPlusOne.txt`),
30-
len: (1 * 1024 * 1024) + 1,
31-
},
26+
len: (1 * 1024 * 1024) + 1 },
3227
];
3328

3429
// Populate each fileInfo (and file) with unique fill.

test/parallel/test-http2-max-settings.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ server.listen(0, common.mustCall(() => {
2727
// The actual settings values do not matter.
2828
headerTableSize: 1000,
2929
enablePush: false,
30-
} });
30+
},
31+
});
3132

3233
client.on('error', common.mustCall(() => {
3334
server.close();

test/parallel/test-inspector-esm.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,14 @@ async function testBreakpoint(session) {
4848
'params': { 'lineNumber': 7,
4949
'url': session.scriptURL(),
5050
'columnNumber': 0,
51-
'condition': ''
52-
}
53-
},
51+
'condition': '' } },
5452
{ 'method': 'Debugger.resume' },
5553
];
5654
await session.send(commands);
5755
const { scriptSource } = await session.send({
5856
'method': 'Debugger.getScriptSource',
59-
'params': { 'scriptId': session.mainScriptId } });
57+
'params': { 'scriptId': session.mainScriptId },
58+
});
6059
assert(scriptSource && (scriptSource.includes(session.script())),
6160
`Script source is wrong: ${scriptSource}`);
6261

test/parallel/test-npm-install.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ const env = { ...process.env,
4444
NPM_CONFIG_TMP: path.join(npmSandbox, 'npm-tmp'),
4545
NPM_CONFIG_AUDIT: false,
4646
NPM_CONFIG_UPDATE_NOTIFIER: false,
47-
HOME: homeDir,
48-
};
47+
HOME: homeDir };
4948

5049
exec(`${process.execPath} ${npmPath} install`, {
5150
cwd: installDir,

test/parallel/test-path-parse-format.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ const trailingTests = [
132132
dir: 'D:\\foo\\\\',
133133
base: 'bar.baz',
134134
ext: '.baz',
135-
name: 'bar'
136-
}
135+
name: 'bar' }
137136
]
138137
]
139138
],

test/parallel/test-process-env-allowed-flags-are-documented.js

+12-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ for (const line of [...nodeOptionsLines, ...v8OptionsLines]) {
4141

4242
// Filter out options that are conditionally present.
4343
const conditionalOpts = [
44-
{ include: common.hasCrypto,
44+
{
45+
include: common.hasCrypto,
4546
filter: (opt) => {
4647
return [
4748
'--openssl-config',
@@ -51,20 +52,23 @@ const conditionalOpts = [
5152
'--secure-heap',
5253
'--secure-heap-min',
5354
].includes(opt);
54-
} },
55-
{
55+
}
56+
}, {
5657
// We are using openssl_is_fips from the configuration because it could be
5758
// the case that OpenSSL is FIPS compatible but fips has not been enabled
5859
// (starting node with --enable-fips). If we use common.hasFipsCrypto
5960
// that would only tells us if fips has been enabled, but in this case we
6061
// want to check options which will be available regardless of whether fips
6162
// is enabled at runtime or not.
6263
include: process.config.variables.openssl_is_fips,
63-
filter: (opt) => opt.includes('-fips') },
64-
{ include: common.hasIntl,
65-
filter: (opt) => opt === '--icu-data-dir' },
66-
{ include: process.features.inspector,
67-
filter: (opt) => opt.startsWith('--inspect') || opt === '--debug-port' },
64+
filter: (opt) => opt.includes('-fips')
65+
}, {
66+
include: common.hasIntl,
67+
filter: (opt) => opt === '--icu-data-dir'
68+
}, {
69+
include: process.features.inspector,
70+
filter: (opt) => opt.startsWith('--inspect') || opt === '--debug-port'
71+
},
6872
];
6973
documented.forEach((opt) => {
7074
conditionalOpts.forEach(({ include, filter }) => {

test/parallel/test-readline-interface.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ function getInterface(options) {
5454
const rli = new readline.Interface({
5555
input: fi,
5656
output: fi,
57-
...options });
57+
...options,
58+
});
5859
return [rli, fi];
5960
}
6061

test/parallel/test-stdin-script-child.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ const { spawn } = require('child_process');
66
for (const args of [[], ['-']]) {
77
const child = spawn(process.execPath, args, {
88
env: { ...process.env,
9-
NODE_DEBUG: process.argv[2]
10-
}
9+
NODE_DEBUG: process.argv[2] }
1110
});
1211
const wanted = `${child.pid}\n`;
1312
let found = '';

test/parallel/test-tls-check-server-identity.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,13 @@ const tests = [
124124
cert: { subject: { CN: '*n.b.com' } },
125125
error: 'Host: \n.b.com. is not cert\'s CN: *n.b.com'
126126
},
127-
{ host: 'b.a.com', cert: {
128-
subjectaltname: 'DNS:omg.com',
129-
subject: { CN: '*.a.com' } },
127+
{ host: 'b.a.com',
128+
cert: {
129+
subjectaltname: 'DNS:omg.com',
130+
subject: { CN: '*.a.com' },
131+
},
130132
error: 'Host: b.a.com. is not in the cert\'s altnames: ' +
131-
'DNS:omg.com'
132-
},
133+
'DNS:omg.com' },
133134
{
134135
host: 'b.a.com',
135136
cert: { subject: { CN: 'b*b.a.com' } },

test/parallel/test-tls-client-verify.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ const testCases = [
3636
{ ok: true, key: 'agent1-key', cert: 'agent1-cert' },
3737
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
3838
{ ok: false, key: 'agent3-key', cert: 'agent3-cert' }
39-
]
40-
},
39+
] },
4140

4241
{ ca: [],
4342
key: 'agent2-key',
@@ -46,8 +45,7 @@ const testCases = [
4645
{ ok: false, key: 'agent1-key', cert: 'agent1-cert' },
4746
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
4847
{ ok: false, key: 'agent3-key', cert: 'agent3-cert' }
49-
]
50-
},
48+
] },
5149

5250
{ ca: ['ca1-cert', 'ca2-cert'],
5351
key: 'agent2-key',
@@ -56,8 +54,7 @@ const testCases = [
5654
{ ok: true, key: 'agent1-key', cert: 'agent1-cert' },
5755
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
5856
{ ok: true, key: 'agent3-key', cert: 'agent3-cert' }
59-
]
60-
}
57+
] }
6158
];
6259

6360

test/parallel/test-tls-server-verify.js

+6-12
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ const testCases =
5454
{ name: 'agent2', shouldReject: false, shouldAuth: false },
5555
{ name: 'agent3', shouldReject: false, shouldAuth: false },
5656
{ name: 'nocert', shouldReject: false, shouldAuth: false }
57-
]
58-
},
57+
] },
5958

6059
{ title: 'Allow both authed and unauthed connections with CA1',
6160
requestCert: true,
@@ -67,8 +66,7 @@ const testCases =
6766
{ name: 'agent2', shouldReject: false, shouldAuth: false },
6867
{ name: 'agent3', shouldReject: false, shouldAuth: false },
6968
{ name: 'nocert', shouldReject: false, shouldAuth: false }
70-
]
71-
},
69+
] },
7270

7371
{ title: 'Do not request certs at connection. Do that later',
7472
requestCert: false,
@@ -80,8 +78,7 @@ const testCases =
8078
{ name: 'agent2', shouldReject: false, shouldAuth: false },
8179
{ name: 'agent3', shouldReject: false, shouldAuth: false },
8280
{ name: 'nocert', shouldReject: false, shouldAuth: false }
83-
]
84-
},
81+
] },
8582

8683
{ title: 'Allow only authed connections with CA1',
8784
requestCert: true,
@@ -93,8 +90,7 @@ const testCases =
9390
{ name: 'agent2', shouldReject: true },
9491
{ name: 'agent3', shouldReject: true },
9592
{ name: 'nocert', shouldReject: true }
96-
]
97-
},
93+
] },
9894

9995
{ title: 'Allow only authed connections with CA1 and CA2',
10096
requestCert: true,
@@ -106,8 +102,7 @@ const testCases =
106102
{ name: 'agent2', shouldReject: true },
107103
{ name: 'agent3', shouldReject: false, shouldAuth: true },
108104
{ name: 'nocert', shouldReject: true }
109-
]
110-
},
105+
] },
111106

112107

113108
{ title: 'Allow only certs signed by CA2 but not in the CRL',
@@ -123,8 +118,7 @@ const testCases =
123118
// Agent4 has a cert in the CRL.
124119
{ name: 'agent4', shouldReject: true, shouldAuth: false },
125120
{ name: 'nocert', shouldReject: true }
126-
]
127-
}
121+
] }
128122
];
129123

130124
function filenamePEM(n) {

test/parallel/test-trace-events-async-hooks-dynamic.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ const proc = cp.spawnSync(
3131
cwd: tmpdir.path,
3232
env: { ...process.env,
3333
'NODE_DEBUG_NATIVE': 'tracing',
34-
'NODE_DEBUG': 'tracing'
35-
}
34+
'NODE_DEBUG': 'tracing' }
3635
});
3736

3837
console.log('process exit with signal:', proc.signal);

test/parallel/test-trace-events-async-hooks-worker.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ const proc = cp.spawnSync(
3838
cwd: tmpdir.path,
3939
env: { ...process.env,
4040
'NODE_DEBUG_NATIVE': 'tracing',
41-
'NODE_DEBUG': 'tracing'
42-
}
41+
'NODE_DEBUG': 'tracing' }
4342
});
4443

4544
console.log('process exit with signal:', proc.signal);

0 commit comments

Comments
 (0)