Skip to content

Commit 294b3e6

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 2642657 commit 294b3e6

25 files changed

+72
-94
lines changed

doc/api/http2.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -3640,7 +3640,8 @@ will be emitted.
36403640
const body = 'hello world';
36413641
response.writeHead(200, {
36423642
'Content-Length': Buffer.byteLength(body),
3643-
'Content-Type': 'text/plain; charset=utf-8' });
3643+
'Content-Type': 'text/plain; charset=utf-8',
3644+
});
36443645
```
36453646

36463647
`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
@@ -364,10 +364,8 @@ ObjectDefineProperties(
364364
'encode': { enumerable: true },
365365
'encodeInto': { enumerable: true },
366366
'encoding': { enumerable: true },
367-
[SymbolToStringTag]: {
368-
configurable: true,
369-
value: 'TextEncoder'
370-
} });
367+
[SymbolToStringTag]: { configurable: true, value: 'TextEncoder' },
368+
});
371369

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

lib/internal/http2/core.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ const {
108108
} = require('internal/validators');
109109
const fsPromisesInternal = require('internal/fs/promises');
110110
const { utcDate } = require('internal/http');
111-
const { onServerStream,
112-
Http2ServerRequest,
113-
Http2ServerResponse,
111+
const {
112+
Http2ServerRequest,
113+
Http2ServerResponse,
114+
onServerStream,
114115
} = require('internal/http2/compat');
115116

116117
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
@@ -16,20 +16,15 @@ tmpdir.refresh();
1616

1717
const fileInfo = [
1818
{ name: path.join(tmpdir.path, `${prefix}-1K.txt`),
19-
len: 1024,
20-
},
19+
len: 1024 },
2120
{ name: path.join(tmpdir.path, `${prefix}-64K.txt`),
22-
len: 64 * 1024,
23-
},
21+
len: 64 * 1024 },
2422
{ name: path.join(tmpdir.path, `${prefix}-64KLessOne.txt`),
25-
len: (64 * 1024) - 1,
26-
},
23+
len: (64 * 1024) - 1 },
2724
{ name: path.join(tmpdir.path, `${prefix}-1M.txt`),
28-
len: 1 * 1024 * 1024,
29-
},
25+
len: 1 * 1024 * 1024 },
3026
{ name: path.join(tmpdir.path, `${prefix}-1MPlusOne.txt`),
31-
len: (1 * 1024 * 1024) + 1,
32-
},
27+
len: (1 * 1024 * 1024) + 1 },
3328
];
3429

3530
// 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,24 +41,28 @@ 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 ['--openssl-config', '--tls-cipher-list', '--use-bundled-ca',
4748
'--use-openssl-ca' ].includes(opt);
48-
} },
49-
{
49+
}
50+
}, {
5051
// We are using openssl_is_fips from the configuration because it could be
5152
// the case that OpenSSL is FIPS compatible but fips has not been enabled
5253
// (starting node with --enable-fips). If we use common.hasFipsCrypto
5354
// that would only tells us if fips has been enabled, but in this case we
5455
// want to check options which will be available regardless of whether fips
5556
// is enabled at runtime or not.
5657
include: process.config.variables.openssl_is_fips,
57-
filter: (opt) => opt.includes('-fips') },
58-
{ include: common.hasIntl,
59-
filter: (opt) => opt === '--icu-data-dir' },
60-
{ include: process.features.inspector,
61-
filter: (opt) => opt.startsWith('--inspect') || opt === '--debug-port' },
58+
filter: (opt) => opt.includes('-fips')
59+
}, {
60+
include: common.hasIntl,
61+
filter: (opt) => opt === '--icu-data-dir'
62+
}, {
63+
include: process.features.inspector,
64+
filter: (opt) => opt.startsWith('--inspect') || opt === '--debug-port'
65+
},
6266
];
6367
documented.forEach((opt) => {
6468
conditionalOpts.forEach(({ include, filter }) => {

test/parallel/test-readline-interface.js

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

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);

test/sequential/test-inspector-break-when-eval.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ async function breakOnLine(session) {
3636
'params': { 'lineNumber': 9,
3737
'url': pathToFileURL(script).toString(),
3838
'columnNumber': 0,
39-
'condition': ''
40-
}
41-
},
39+
'condition': '' } },
4240
{ 'method': 'Runtime.evaluate',
4341
'params': { 'expression': 'sum()',
4442
'objectGroup': 'console',
@@ -48,9 +46,7 @@ async function breakOnLine(session) {
4846
'returnByValue': false,
4947
'generatePreview': true,
5048
'userGesture': true,
51-
'awaitPromise': false
52-
}
53-
}
49+
'awaitPromise': false } }
5450
];
5551
session.send(commands);
5652
await session.waitForBreakOnLine(9, pathToFileURL(script).toString());

0 commit comments

Comments
 (0)