Skip to content

Commit

Permalink
doc,lib: prepare for stricter multi-line array linting
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Trott authored and targos committed Sep 4, 2021
1 parent 9db3304 commit d56e826
Show file tree
Hide file tree
Showing 28 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ const subprocess = spawn(
'-c',
`node -e "setInterval(() => {
console.log(process.pid, 'is alive')
}, 500);"`
}, 500);"`,
], {
stdio: ['inherit', 'inherit', 'inherit']
}
Expand Down Expand Up @@ -1661,7 +1661,7 @@ const subprocess = child_process.spawn('ls', {
stdio: [
0, // Use parent's stdin for child.
'pipe', // Pipe child's stdout to parent.
fs.openSync('err.out', 'w') // Direct child's stderr to a file.
fs.openSync('err.out', 'w'), // Direct child's stderr to a file.
]
});

Expand Down
8 changes: 4 additions & 4 deletions doc/api/dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ section if a custom port is used.
'4.4.4.4',
'2001:4860:4860::8888',
'4.4.4.4:1053',
'[2001:4860:4860::8888]:1053'
'[2001:4860:4860::8888]:1053',
]
```

Expand Down Expand Up @@ -666,7 +666,7 @@ dns.setServers([
'4.4.4.4',
'[2001:4860:4860::8888]',
'4.4.4.4:1053',
'[2001:4860:4860::8888]:1053'
'[2001:4860:4860::8888]:1053',
]);
```

Expand Down Expand Up @@ -773,7 +773,7 @@ section if a custom port is used.
'4.4.4.4',
'2001:4860:4860::8888',
'4.4.4.4:1053',
'[2001:4860:4860::8888]:1053'
'[2001:4860:4860::8888]:1053',
]
```

Expand Down Expand Up @@ -1184,7 +1184,7 @@ dnsPromises.setServers([
'4.4.4.4',
'[2001:4860:4860::8888]',
'4.4.4.4:1053',
'[2001:4860:4860::8888]:1053'
'[2001:4860:4860::8888]:1053',
]);
```

Expand Down
2 changes: 1 addition & 1 deletion doc/api/os.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The properties included on each object include:
idle: 1070905480,
irq: 20
}
}
},
]
```

Expand Down
6 changes: 3 additions & 3 deletions doc/api/url.md
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@ with [`JSON.stringify()`][].
```js
const myURLs = [
new URL('https://www.example.com'),
new URL('https://test.example.org')
new URL('https://test.example.org'),
];
console.log(JSON.stringify(myURLs));
// Prints ["https://www.example.com/","https://test.example.org/"]
Expand Down Expand Up @@ -710,7 +710,7 @@ let params;
params = new URLSearchParams([
['user', 'abc'],
['query', 'first'],
['query', 'second']
['query', 'second'],
]);
console.log(params.toString());
// Prints 'user=abc&query=first&query=second'
Expand All @@ -735,7 +735,7 @@ console.log(params.toString());

// Each key-value pair must have exactly two elements
new URLSearchParams([
['user', 'abc', 'error']
['user', 'abc', 'error'],
]);
// Throws TypeError [ERR_INVALID_TUPLE]:
// Each query pair must be an iterable [name, value] tuple
Expand Down
4 changes: 2 additions & 2 deletions lib/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const meta = [
'\\u000f', '\\u0010', '\\u0011', '\\u0012', '\\u0013',
'\\u0014', '\\u0015', '\\u0016', '\\u0017', '\\u0018',
'\\u0019', '\\u001a', '\\u001b', '\\u001c', '\\u001d',
'\\u001e', '\\u001f'
'\\u001e', '\\u001f',
];

const escapeFn = (str) => meta[StringPrototypeCharCodeAt(str, 0)];
Expand Down Expand Up @@ -268,7 +268,7 @@ function parseCode(code, offset) {
node.node.start,
StringPrototypeReplace(StringPrototypeSlice(code,
node.node.start, node.node.end),
escapeSequencesRegExp, escapeFn)
escapeSequencesRegExp, escapeFn),
];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const internalBindingAllowlist = new SafeSet([
'util',
'uv',
'v8',
'zlib'
'zlib',
]);

// Set up process.binding() and process._linkedBinding().
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/bootstrap/pre_execution.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ function initializeDeprecations() {
'isSetIterator',
'isTypedArray',
'isUint8Array',
'isAnyArrayBuffer'
'isAnyArrayBuffer',
]) {
utilBinding[name] = pendingDeprecation ?
deprecate(types[name],
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/console/constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ const consoleMethods = {
}
}
return final([
iterKey, keyKey, valuesKey
iterKey, keyKey, valuesKey,
], [
getIndexArray(length),
keys,
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/crypto/random.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ function handleError(ex, buf) {

const kHexDigits = [
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 97, 98, 99, 100, 101, 102
56, 57, 97, 98, 99, 100, 101, 102,
];

const kBatchSize = 128;
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ const encodings = new SafeMap([
['windows-949', 'euc-kr'],
['utf-16be', 'utf-16be'],
['utf-16le', 'utf-16le'],
['utf-16', 'utf-16le']
['utf-16', 'utf-16le'],
]);

// Unfortunately, String.prototype.trim also removes non-ascii whitespace,
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const kTypes = [
'Object',
'boolean',
'bigint',
'symbol'
'symbol',
];

const MainContextError = Error;
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/freeze_intrinsics.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ module.exports = function() {
WebAssembly.CompileError.prototype,
WebAssembly.LinkError.prototype,
WebAssembly.RuntimeError.prototype,
SharedArrayBuffer.prototype
SharedArrayBuffer.prototype,
];
const intrinsics = [
// Anonymous Intrinsics
Expand Down Expand Up @@ -326,7 +326,7 @@ module.exports = function() {
BigInt,
Atomics,
WebAssembly,
SharedArrayBuffer
SharedArrayBuffer,
];

if (typeof Intl !== 'undefined') {
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/http2/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const kValidPseudoHeaders = new Set([
HTTP2_HEADER_AUTHORITY,
HTTP2_HEADER_SCHEME,
HTTP2_HEADER_PATH,
HTTP2_HEADER_PROTOCOL
HTTP2_HEADER_PROTOCOL,
]);

// This set contains headers that are permitted to have only a single
Expand Down Expand Up @@ -147,7 +147,7 @@ const kSingleValueHeaders = new Set([
HTTP2_HEADER_TK,
HTTP2_HEADER_UPGRADE_INSECURE_REQUESTS,
HTTP2_HEADER_USER_AGENT,
HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS
HTTP2_HEADER_X_CONTENT_TYPE_OPTIONS,
]);

// The HTTP methods in this set are specifically defined as assigning no
Expand All @@ -157,7 +157,7 @@ const kSingleValueHeaders = new Set([
const kNoPayloadMethods = new Set([
HTTP2_METHOD_DELETE,
HTTP2_METHOD_GET,
HTTP2_METHOD_HEAD
HTTP2_METHOD_HEAD,
]);

// The following ArrayBuffer instances are used to share memory more efficiently
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/main/print_help.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ const envVars = new SafeMap(ArrayPrototypeConcat([
['NODE_V8_COVERAGE', { helpText: 'directory to output v8 coverage JSON ' +
'to' }],
['UV_THREADPOOL_SIZE', { helpText: 'sets the number of threads used in ' +
'libuv\'s threadpool' }]
'libuv\'s threadpool' }],
], hasIntl ? [
['NODE_ICU_DATA', { helpText: 'data path for ICU (Intl object) data' +
hasSmallICU ? '' : ' (will extend linked-in data)' }]
hasSmallICU ? '' : ' (will extend linked-in data)' }],
] : []), (hasNodeOptions ? [
['NODE_OPTIONS', { helpText: 'set CLI options in the environment via a ' +
'space-separated list' }]
'space-separated list' }],
] : []), hasCrypto ? [
['OPENSSL_CONF', { helpText: 'load OpenSSL configuration from file' }],
['SSL_CERT_DIR', { helpText: 'sets OpenSSL\'s directory of trusted ' +
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/modules/cjs/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ let wrap = function(script) {

const wrapper = [
'(function (exports, require, module, __filename, __dirname) { ',
'\n});'
'\n});',
];

let wrapperProxy = new Proxy(wrapper, {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/process/per_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function wrapProcessMethods(binding) {

return [
hrValues[0] * 0x100000000 + hrValues[1],
hrValues[2]
hrValues[2],
];
}

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/querystring.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const isHexTable = new Int8Array([
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 // ... 256
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // ... 256
]);

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ function pipeline(...streams) {
pt.end(val);
}, (err) => {
pt.destroy(err);
}
},
]);
} else if (isIterable(ret, true)) {
finishCount++;
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/tty.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ const TERM_ENVS_REG_EXP = [
/^rxvt/,
/^screen/,
/^xterm/,
/^vt100/
/^vt100/,
];

let warned = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ const noEscape = new Int8Array([
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x40 - 0x4F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 0x50 - 0x5F
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x60 - 0x6F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0 // 0x70 - 0x7F
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, // 0x70 - 0x7F
]);

// Special version of hexTable that uses `+` for U+0020 SPACE.
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/util/comparisons.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function isIdenticalTypedArrayType(a, b) {
isBigInt64Array,
isBigUint64Array,
isUint8ClampedArray,
isUint8Array
isUint8Array,
]) {
if (check(a)) {
return check(b);
Expand Down
8 changes: 4 additions & 4 deletions lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,7 @@ function formatProxy(ctx, proxy, recurseTimes) {
ctx.indentationLvl += 2;
const res = [
formatValue(ctx, proxy[0], recurseTimes),
formatValue(ctx, proxy[1], recurseTimes)
formatValue(ctx, proxy[1], recurseTimes),
];
ctx.indentationLvl -= 2;
return reduceToSingleString(
Expand Down Expand Up @@ -1513,7 +1513,7 @@ function formatTypedArray(value, length, ctx, ignored, recurseTimes) {
'length',
'byteLength',
'byteOffset',
'buffer'
'buffer',
]) {
const str = formatValue(ctx, value[key], recurseTimes, true);
output.push(`[${key}]: ${str}`);
Expand Down Expand Up @@ -1591,7 +1591,7 @@ function formatMapIterInner(ctx, recurseTimes, entries, state) {
const pos = i * 2;
const res = [
formatValue(ctx, entries[pos], recurseTimes),
formatValue(ctx, entries[pos + 1], recurseTimes)
formatValue(ctx, entries[pos + 1], recurseTimes),
];
output[i] = reduceToSingleString(
ctx, res, '', ['[', ']'], kArrayExtrasType, recurseTimes);
Expand Down Expand Up @@ -1641,7 +1641,7 @@ function formatPromise(ctx, value, recurseTimes) {
output = [
state === kRejected ?
`${ctx.stylize('<rejected>', 'special')} ${str}` :
str
str,
];
}
return output;
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/v8_prof_processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const scriptFiles = [
'internal/deps/v8/tools/arguments',
'internal/deps/v8/tools/tickprocessor',
'internal/deps/v8/tools/SourceMap',
'internal/deps/v8/tools/tickprocessor-driver'
'internal/deps/v8/tools/tickprocessor-driver',
];
let script = '';

Expand Down
2 changes: 1 addition & 1 deletion lib/perf_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const observerableTypes = [
'gc',
'function',
'http2',
'http'
'http',
];

const IDX_STREAM_STATS_ID = 0;
Expand Down
4 changes: 2 additions & 2 deletions lib/querystring.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const unhexTable = new Int8Array([
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // ... 255
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 255
]);
/**
* A safe fast alternative to decodeURIComponent
Expand Down Expand Up @@ -152,7 +152,7 @@ const noEscape = new Int8Array([
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 80 - 95
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0 // 112 - 127
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, // 112 - 127
]);

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function Interface(input, output, completer, terminal) {
this.escapeCodeTimeout = ESCAPE_CODE_TIMEOUT;
this.tabSize = 8;

FunctionPrototypeCall(EventEmitter, this,);
FunctionPrototypeCall(EventEmitter, this);
let history;
let historySize;
let removeHistoryDuplicates = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,7 @@ function addCommonWords(completionGroups) {
'debugger', 'default', 'delete', 'do', 'else', 'export', 'false',
'finally', 'for', 'function', 'if', 'import', 'in', 'instanceof', 'let',
'new', 'null', 'return', 'switch', 'this', 'throw', 'true', 'try',
'typeof', 'var', 'void', 'while', 'with', 'yield'
'typeof', 'var', 'void', 'while', 'with', 'yield',
]);
}

Expand Down
Loading

0 comments on commit d56e826

Please sign in to comment.