Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Trott authored and targos committed Jun 11, 2021
1 parent 2642657 commit 294b3e6
Show file tree
Hide file tree
Showing 25 changed files with 72 additions and 94 deletions.
3 changes: 2 additions & 1 deletion doc/api/http2.md
Expand Up @@ -3640,7 +3640,8 @@ will be emitted.
const body = 'hello world';
response.writeHead(200, {
'Content-Length': Buffer.byteLength(body),
'Content-Type': 'text/plain; charset=utf-8' });
'Content-Type': 'text/plain; charset=utf-8',
});
```

`Content-Length` is given in bytes not characters. The
Expand Down
7 changes: 4 additions & 3 deletions lib/internal/async_hooks.js
Expand Up @@ -91,9 +91,10 @@ const { resource_symbol, owner_symbol } = internalBinding('symbols');
// Each constant tracks how many callbacks there are for any given step of
// async execution. These are tracked so if the user didn't include callbacks
// for a given step, that step can bail out early.
const { kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,
kCheck, kExecutionAsyncId, kAsyncIdCounter, kTriggerAsyncId,
kDefaultTriggerAsyncId, kStackLength, kUsesExecutionAsyncResource
const {
kInit, kBefore, kAfter, kDestroy, kTotals, kPromiseResolve,
kCheck, kExecutionAsyncId, kAsyncIdCounter, kTriggerAsyncId,
kDefaultTriggerAsyncId, kStackLength, kUsesExecutionAsyncResource,
} = async_wrap.constants;

const { async_id_symbol,
Expand Down
6 changes: 2 additions & 4 deletions lib/internal/encoding.js
Expand Up @@ -364,10 +364,8 @@ ObjectDefineProperties(
'encode': { enumerable: true },
'encodeInto': { enumerable: true },
'encoding': { enumerable: true },
[SymbolToStringTag]: {
configurable: true,
value: 'TextEncoder'
} });
[SymbolToStringTag]: { configurable: true, value: 'TextEncoder' },
});

const TextDecoder =
internalBinding('config').hasIntl ?
Expand Down
7 changes: 4 additions & 3 deletions lib/internal/http2/core.js
Expand Up @@ -108,9 +108,10 @@ const {
} = require('internal/validators');
const fsPromisesInternal = require('internal/fs/promises');
const { utcDate } = require('internal/http');
const { onServerStream,
Http2ServerRequest,
Http2ServerResponse,
const {
Http2ServerRequest,
Http2ServerResponse,
onServerStream,
} = require('internal/http2/compat');

const {
Expand Down
3 changes: 1 addition & 2 deletions test/doctool/test-doctool-json.js
Expand Up @@ -121,8 +121,7 @@ const testData = [
{ 'version': 'v4.2.0',
'pr-url': 'https://github.com/nodejs/node/pull/3276',
'description': 'The `error` parameter can now be ' +
'an arrow function.'
}
'an arrow function.' }
]
},
desc: '<p>Describe <code>Foobar II</code> in more detail ' +
Expand Down
3 changes: 2 additions & 1 deletion test/node-api/test_threadsafe_function/test.js
Expand Up @@ -36,7 +36,8 @@ function testWithJSMarshaller({
quitAfter,
abort,
maxQueueSize,
launchSecondary }) {
launchSecondary,
}) {
return new Promise((resolve) => {
const array = [];
binding[threadStarter](function testCallback(value) {
Expand Down
12 changes: 4 additions & 8 deletions test/parallel/test-dns.js
Expand Up @@ -362,18 +362,15 @@ assert.throws(() => {
expire: 1800,
minttl: 3333333333
},
]
},
] },

{ method: 'resolve4',
options: { ttl: true },
answers: [ { type: 'A', address: '1.2.3.4', ttl: 3333333333 } ]
},
answers: [ { type: 'A', address: '1.2.3.4', ttl: 3333333333 } ] },

{ method: 'resolve6',
options: { ttl: true },
answers: [ { type: 'AAAA', address: '::42', ttl: 3333333333 } ]
},
answers: [ { type: 'AAAA', address: '::42', ttl: 3333333333 } ] },

{ method: 'resolveSoa',
answers: [
Expand All @@ -387,8 +384,7 @@ assert.throws(() => {
expire: 1800,
minttl: 3333333333
}
]
},
] },
];

const server = dgram.createSocket('udp4');
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-fs-open-flags.js
Expand Up @@ -38,8 +38,7 @@ const { O_APPEND = 0,
O_SYNC = 0,
O_DSYNC = 0,
O_TRUNC = 0,
O_WRONLY = 0
} = fs.constants;
O_WRONLY = 0 } = fs.constants;

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

Expand Down
15 changes: 5 additions & 10 deletions test/parallel/test-fs-readfile.js
Expand Up @@ -16,20 +16,15 @@ tmpdir.refresh();

const fileInfo = [
{ name: path.join(tmpdir.path, `${prefix}-1K.txt`),
len: 1024,
},
len: 1024 },
{ name: path.join(tmpdir.path, `${prefix}-64K.txt`),
len: 64 * 1024,
},
len: 64 * 1024 },
{ name: path.join(tmpdir.path, `${prefix}-64KLessOne.txt`),
len: (64 * 1024) - 1,
},
len: (64 * 1024) - 1 },
{ name: path.join(tmpdir.path, `${prefix}-1M.txt`),
len: 1 * 1024 * 1024,
},
len: 1 * 1024 * 1024 },
{ name: path.join(tmpdir.path, `${prefix}-1MPlusOne.txt`),
len: (1 * 1024 * 1024) + 1,
},
len: (1 * 1024 * 1024) + 1 },
];

// Populate each fileInfo (and file) with unique fill.
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-http2-max-settings.js
Expand Up @@ -27,7 +27,8 @@ server.listen(0, common.mustCall(() => {
// The actual settings values do not matter.
headerTableSize: 1000,
enablePush: false,
} });
},
});

client.on('error', common.mustCall(() => {
server.close();
Expand Down
7 changes: 3 additions & 4 deletions test/parallel/test-inspector-esm.js
Expand Up @@ -48,15 +48,14 @@ async function testBreakpoint(session) {
'params': { 'lineNumber': 7,
'url': session.scriptURL(),
'columnNumber': 0,
'condition': ''
}
},
'condition': '' } },
{ 'method': 'Debugger.resume' },
];
await session.send(commands);
const { scriptSource } = await session.send({
'method': 'Debugger.getScriptSource',
'params': { 'scriptId': session.mainScriptId } });
'params': { 'scriptId': session.mainScriptId },
});
assert(scriptSource && (scriptSource.includes(session.script())),
`Script source is wrong: ${scriptSource}`);

Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-npm-install.js
Expand Up @@ -44,8 +44,7 @@ const env = { ...process.env,
NPM_CONFIG_TMP: path.join(npmSandbox, 'npm-tmp'),
NPM_CONFIG_AUDIT: false,
NPM_CONFIG_UPDATE_NOTIFIER: false,
HOME: homeDir,
};
HOME: homeDir };

exec(`${process.execPath} ${npmPath} install`, {
cwd: installDir,
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-path-parse-format.js
Expand Up @@ -132,8 +132,7 @@ const trailingTests = [
dir: 'D:\\foo\\\\',
base: 'bar.baz',
ext: '.baz',
name: 'bar'
}
name: 'bar' }
]
]
],
Expand Down
20 changes: 12 additions & 8 deletions test/parallel/test-process-env-allowed-flags-are-documented.js
Expand Up @@ -41,24 +41,28 @@ for (const line of [...nodeOptionsLines, ...v8OptionsLines]) {

// Filter out options that are conditionally present.
const conditionalOpts = [
{ include: common.hasCrypto,
{
include: common.hasCrypto,
filter: (opt) => {
return ['--openssl-config', '--tls-cipher-list', '--use-bundled-ca',
'--use-openssl-ca' ].includes(opt);
} },
{
}
}, {
// We are using openssl_is_fips from the configuration because it could be
// the case that OpenSSL is FIPS compatible but fips has not been enabled
// (starting node with --enable-fips). If we use common.hasFipsCrypto
// that would only tells us if fips has been enabled, but in this case we
// want to check options which will be available regardless of whether fips
// is enabled at runtime or not.
include: process.config.variables.openssl_is_fips,
filter: (opt) => opt.includes('-fips') },
{ include: common.hasIntl,
filter: (opt) => opt === '--icu-data-dir' },
{ include: process.features.inspector,
filter: (opt) => opt.startsWith('--inspect') || opt === '--debug-port' },
filter: (opt) => opt.includes('-fips')
}, {
include: common.hasIntl,
filter: (opt) => opt === '--icu-data-dir'
}, {
include: process.features.inspector,
filter: (opt) => opt.startsWith('--inspect') || opt === '--debug-port'
},
];
documented.forEach((opt) => {
conditionalOpts.forEach(({ include, filter }) => {
Expand Down
3 changes: 2 additions & 1 deletion test/parallel/test-readline-interface.js
Expand Up @@ -53,7 +53,8 @@ function getInterface(options) {
const rli = new readline.Interface({
input: fi,
output: fi,
...options });
...options,
});
return [rli, fi];
}

Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-stdin-script-child.js
Expand Up @@ -6,8 +6,7 @@ const { spawn } = require('child_process');
for (const args of [[], ['-']]) {
const child = spawn(process.execPath, args, {
env: { ...process.env,
NODE_DEBUG: process.argv[2]
}
NODE_DEBUG: process.argv[2] }
});
const wanted = `${child.pid}\n`;
let found = '';
Expand Down
11 changes: 6 additions & 5 deletions test/parallel/test-tls-check-server-identity.js
Expand Up @@ -124,12 +124,13 @@ const tests = [
cert: { subject: { CN: '*n.b.com' } },
error: 'Host: \n.b.com. is not cert\'s CN: *n.b.com'
},
{ host: 'b.a.com', cert: {
subjectaltname: 'DNS:omg.com',
subject: { CN: '*.a.com' } },
{ host: 'b.a.com',
cert: {
subjectaltname: 'DNS:omg.com',
subject: { CN: '*.a.com' },
},
error: 'Host: b.a.com. is not in the cert\'s altnames: ' +
'DNS:omg.com'
},
'DNS:omg.com' },
{
host: 'b.a.com',
cert: { subject: { CN: 'b*b.a.com' } },
Expand Down
9 changes: 3 additions & 6 deletions test/parallel/test-tls-client-verify.js
Expand Up @@ -36,8 +36,7 @@ const testCases = [
{ ok: true, key: 'agent1-key', cert: 'agent1-cert' },
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
{ ok: false, key: 'agent3-key', cert: 'agent3-cert' }
]
},
] },

{ ca: [],
key: 'agent2-key',
Expand All @@ -46,8 +45,7 @@ const testCases = [
{ ok: false, key: 'agent1-key', cert: 'agent1-cert' },
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
{ ok: false, key: 'agent3-key', cert: 'agent3-cert' }
]
},
] },

{ ca: ['ca1-cert', 'ca2-cert'],
key: 'agent2-key',
Expand All @@ -56,8 +54,7 @@ const testCases = [
{ ok: true, key: 'agent1-key', cert: 'agent1-cert' },
{ ok: false, key: 'agent2-key', cert: 'agent2-cert' },
{ ok: true, key: 'agent3-key', cert: 'agent3-cert' }
]
}
] }
];


Expand Down
18 changes: 6 additions & 12 deletions test/parallel/test-tls-server-verify.js
Expand Up @@ -54,8 +54,7 @@ const testCases =
{ name: 'agent2', shouldReject: false, shouldAuth: false },
{ name: 'agent3', shouldReject: false, shouldAuth: false },
{ name: 'nocert', shouldReject: false, shouldAuth: false }
]
},
] },

{ title: 'Allow both authed and unauthed connections with CA1',
requestCert: true,
Expand All @@ -67,8 +66,7 @@ const testCases =
{ name: 'agent2', shouldReject: false, shouldAuth: false },
{ name: 'agent3', shouldReject: false, shouldAuth: false },
{ name: 'nocert', shouldReject: false, shouldAuth: false }
]
},
] },

{ title: 'Do not request certs at connection. Do that later',
requestCert: false,
Expand All @@ -80,8 +78,7 @@ const testCases =
{ name: 'agent2', shouldReject: false, shouldAuth: false },
{ name: 'agent3', shouldReject: false, shouldAuth: false },
{ name: 'nocert', shouldReject: false, shouldAuth: false }
]
},
] },

{ title: 'Allow only authed connections with CA1',
requestCert: true,
Expand All @@ -93,8 +90,7 @@ const testCases =
{ name: 'agent2', shouldReject: true },
{ name: 'agent3', shouldReject: true },
{ name: 'nocert', shouldReject: true }
]
},
] },

{ title: 'Allow only authed connections with CA1 and CA2',
requestCert: true,
Expand All @@ -106,8 +102,7 @@ const testCases =
{ name: 'agent2', shouldReject: true },
{ name: 'agent3', shouldReject: false, shouldAuth: true },
{ name: 'nocert', shouldReject: true }
]
},
] },


{ title: 'Allow only certs signed by CA2 but not in the CRL',
Expand All @@ -123,8 +118,7 @@ const testCases =
// Agent4 has a cert in the CRL.
{ name: 'agent4', shouldReject: true, shouldAuth: false },
{ name: 'nocert', shouldReject: true }
]
}
] }
];

function filenamePEM(n) {
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-trace-events-async-hooks-dynamic.js
Expand Up @@ -31,8 +31,7 @@ const proc = cp.spawnSync(
cwd: tmpdir.path,
env: { ...process.env,
'NODE_DEBUG_NATIVE': 'tracing',
'NODE_DEBUG': 'tracing'
}
'NODE_DEBUG': 'tracing' }
});

console.log('process exit with signal:', proc.signal);
Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-trace-events-async-hooks-worker.js
Expand Up @@ -38,8 +38,7 @@ const proc = cp.spawnSync(
cwd: tmpdir.path,
env: { ...process.env,
'NODE_DEBUG_NATIVE': 'tracing',
'NODE_DEBUG': 'tracing'
}
'NODE_DEBUG': 'tracing' }
});

console.log('process exit with signal:', proc.signal);
Expand Down
8 changes: 2 additions & 6 deletions test/sequential/test-inspector-break-when-eval.js
Expand Up @@ -36,9 +36,7 @@ async function breakOnLine(session) {
'params': { 'lineNumber': 9,
'url': pathToFileURL(script).toString(),
'columnNumber': 0,
'condition': ''
}
},
'condition': '' } },
{ 'method': 'Runtime.evaluate',
'params': { 'expression': 'sum()',
'objectGroup': 'console',
Expand All @@ -48,9 +46,7 @@ async function breakOnLine(session) {
'returnByValue': false,
'generatePreview': true,
'userGesture': true,
'awaitPromise': false
}
}
'awaitPromise': false } }
];
session.send(commands);
await session.waitForBreakOnLine(9, pathToFileURL(script).toString());
Expand Down

0 comments on commit 294b3e6

Please sign in to comment.