Skip to content
Permalink
Browse files
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 294b3e60a578ba38b87f3cf68b6a3513ff1f6788
@@ -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
@@ -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,
@@ -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 ?
@@ -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 {
@@ -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 ' +
@@ -36,7 +36,8 @@ function testWithJSMarshaller({
quitAfter,
abort,
maxQueueSize,
launchSecondary }) {
launchSecondary,
}) {
return new Promise((resolve) => {
const array = [];
binding[threadStarter](function testCallback(value) {
@@ -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: [
@@ -387,8 +384,7 @@ assert.throws(() => {
expire: 1800,
minttl: 3333333333
}
]
},
] },
];

const server = dgram.createSocket('udp4');
@@ -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');

@@ -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.
@@ -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();
@@ -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}`);

@@ -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,
@@ -132,8 +132,7 @@ const trailingTests = [
dir: 'D:\\foo\\\\',
base: 'bar.baz',
ext: '.baz',
name: 'bar'
}
name: 'bar' }
]
]
],
@@ -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 }) => {
@@ -53,7 +53,8 @@ function getInterface(options) {
const rli = new readline.Interface({
input: fi,
output: fi,
...options });
...options,
});
return [rli, fi];
}

@@ -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 = '';
@@ -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' } },
@@ -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',
@@ -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',
@@ -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' }
]
}
] }
];


@@ -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,
@@ -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,
@@ -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,
@@ -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,
@@ -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',
@@ -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) {
@@ -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);
@@ -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);
@@ -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',
@@ -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());

0 comments on commit 294b3e6

Please sign in to comment.