Skip to content

Commit 794fae8

Browse files
committed
tools: update ESLint config comma-dangle to always-multiline
The advantage of doing this is that `eslint --fix` can automatically add trailing commas, which avoids wasting time on manual formatting Refs: https://github.com/nodejs/node/discussions/38701 Refs: nodejs#38608 (review)
1 parent 910efc2 commit 794fae8

File tree

2,011 files changed

+7014
-7005
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,011 files changed

+7014
-7005
lines changed

.eslintrc.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ module.exports = {
6868
files: ['**/*.md/*.cjs', '**/*.md/*.js'],
6969
parserOptions: {
7070
sourceType: 'script',
71-
ecmaFeatures: { impliedStrict: true }
71+
ecmaFeatures: { impliedStrict: true },
7272
},
7373
rules: { strict: 'off' },
7474
},
@@ -106,10 +106,10 @@ module.exports = {
106106
}],
107107
'comma-dangle': ['error', {
108108
arrays: 'always-multiline',
109-
exports: 'only-multiline',
109+
exports: 'always-multiline',
110110
functions: 'only-multiline',
111-
imports: 'only-multiline',
112-
objects: 'only-multiline',
111+
imports: 'always-multiline',
112+
objects: 'always-multiline',
113113
}],
114114
'comma-spacing': 'error',
115115
'comma-style': 'error',

benchmark/_http-benchmarkers.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
106106
const scheme = options.scheme || 'http';
107107
const env = {
108108
test_url: `${scheme}://127.0.0.1:${options.port}${options.path}`,
109-
...process.env
109+
...process.env,
110110
};
111111

112112
const child = child_process.fork(this.executable,
@@ -203,7 +203,7 @@ exports.run = function(options, callback) {
203203
connections: 100,
204204
duration: 5,
205205
benchmarker: exports.default_http_benchmarker,
206-
...options
206+
...options,
207207
};
208208
if (!options.benchmarker) {
209209
callback(new Error('Could not locate required http benchmarker. See ' +

benchmark/async_hooks/async-resource-vs-destroy.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const {
99
createHook,
1010
executionAsyncResource,
1111
executionAsyncId,
12-
AsyncLocalStorage
12+
AsyncLocalStorage,
1313
} = require('async_hooks');
1414
const { createServer } = require('http');
1515

@@ -19,7 +19,7 @@ const bench = common.createBenchmark(main, {
1919
path: '/',
2020
connections: 500,
2121
duration: 5,
22-
n: [1e6]
22+
n: [1e6],
2323
});
2424

2525
function buildCurrentResource(getServe) {
@@ -30,7 +30,7 @@ function buildCurrentResource(getServe) {
3030

3131
return {
3232
server,
33-
close
33+
close,
3434
};
3535

3636
function getCLS() {
@@ -71,7 +71,7 @@ function buildDestroy(getServe) {
7171

7272
return {
7373
server,
74-
close
74+
close,
7575
};
7676

7777
function getCLS() {
@@ -108,7 +108,7 @@ function buildAsyncLocalStorage(getServe) {
108108

109109
return {
110110
server,
111-
close
111+
close,
112112
};
113113

114114
function getCLS() {
@@ -160,12 +160,12 @@ function getServeCallbacks(getCLS, setCLS) {
160160
const types = {
161161
'async-resource': buildCurrentResource,
162162
'destroy': buildDestroy,
163-
'async-local-storage': buildAsyncLocalStorage
163+
'async-local-storage': buildAsyncLocalStorage,
164164
};
165165

166166
const asyncMethods = {
167167
'callbacks': getServeCallbacks,
168-
'async': getServeAwait
168+
'async': getServeAwait,
169169
};
170170

171171
function main({ type, asyncMethod, connections, duration, path }) {
@@ -178,7 +178,7 @@ function main({ type, asyncMethod, connections, duration, path }) {
178178
bench.http({
179179
path,
180180
connections,
181-
duration
181+
duration,
182182
}, () => {
183183
close();
184184
});

benchmark/async_hooks/gc-tracking.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const bench = common.createBenchmark(main, {
88
'trackingEnabled',
99
'trackingEnabledWithDestroyHook',
1010
'trackingDisabled',
11-
]
11+
],
1212
}, {
13-
flags: ['--expose-gc']
13+
flags: ['--expose-gc'],
1414
});
1515

1616
function endAfterGC(n) {

benchmark/async_hooks/http-server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44
const bench = common.createBenchmark(main, {
55
asyncHooks: ['init', 'before', 'after', 'all', 'disabled', 'none'],
66
connections: [50, 500],
7-
duration: 5
7+
duration: 5,
88
});
99

1010
function main({ asyncHooks, connections, duration }) {
@@ -14,11 +14,11 @@ function main({ asyncHooks, connections, duration }) {
1414
before() {},
1515
after() {},
1616
destroy() {},
17-
promiseResolve() {}
17+
promiseResolve() {},
1818
};
1919
if (asyncHooks !== 'all' || asyncHooks !== 'disabled') {
2020
hooks = {
21-
[asyncHooks]: () => {}
21+
[asyncHooks]: () => {},
2222
};
2323
}
2424
const hook = require('async_hooks').createHook(hooks);
@@ -34,7 +34,7 @@ function main({ asyncHooks, connections, duration }) {
3434
bench.http({
3535
connections,
3636
path,
37-
duration
37+
duration,
3838
}, () => {
3939
server.close();
4040
});

benchmark/async_hooks/promises.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,25 @@ let hook;
66
const tests = {
77
disabled() {
88
hook = createHook({
9-
promiseResolve() {}
9+
promiseResolve() {},
1010
});
1111
},
1212
enabled() {
1313
hook = createHook({
14-
promiseResolve() {}
14+
promiseResolve() {},
1515
}).enable();
1616
},
1717
enabledWithDestroy() {
1818
hook = createHook({
1919
promiseResolve() {},
20-
destroy() {}
20+
destroy() {},
2121
}).enable();
2222
},
2323
enabledWithInitOnly() {
2424
hook = createHook({
25-
init() {}
25+
init() {},
2626
}).enable();
27-
}
27+
},
2828
};
2929

3030
const bench = common.createBenchmark(main, {
@@ -34,7 +34,7 @@ const bench = common.createBenchmark(main, {
3434
'enabledWithDestroy',
3535
'enabledWithInitOnly',
3636
'disabled',
37-
]
37+
],
3838
});
3939

4040
const err = new Error('foobar');

benchmark/buffers/buffer-base64-decode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44

55
const bench = common.createBenchmark(main, {
66
n: [32],
7-
size: [8 << 20]
7+
size: [8 << 20],
88
});
99

1010
function main({ n, size }) {

benchmark/buffers/buffer-base64-encode.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ const common = require('../common.js');
2424

2525
const bench = common.createBenchmark(main, {
2626
len: [64 * 1024 * 1024],
27-
n: [32]
27+
n: [32],
2828
}, {
29-
test: { len: 256 }
29+
test: { len: 256 },
3030
});
3131

3232
function main({ n, len }) {

benchmark/buffers/buffer-bytelength.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common');
44
const bench = common.createBenchmark(main, {
55
encoding: ['utf8', 'base64', 'buffer'],
66
len: [2, 16, 256], // x16
7-
n: [4e6]
7+
n: [4e6],
88
});
99

1010
// 16 chars each

benchmark/buffers/buffer-compare-instance-method.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44
const bench = common.createBenchmark(main, {
55
size: [16, 512, 4096, 16386],
66
args: [1, 2, 5],
7-
n: [1e6]
7+
n: [1e6],
88
});
99

1010
function main({ n, size, args }) {

benchmark/buffers/buffer-compare-offset.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44
const bench = common.createBenchmark(main, {
55
method: ['offset', 'slice'],
66
size: [16, 512, 4096, 16386],
7-
n: [1e6]
7+
n: [1e6],
88
});
99

1010
function compareUsingSlice(b0, b1, len, iter) {

benchmark/buffers/buffer-compare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const common = require('../common.js');
2424

2525
const bench = common.createBenchmark(main, {
2626
size: [16, 512, 4096, 16386],
27-
n: [1e6]
27+
n: [1e6],
2828
});
2929

3030
function main({ n, size }) {

benchmark/buffers/buffer-concat-fill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const common = require('../common.js');
33

44
const bench = common.createBenchmark(main, {
55
extraSize: [1, 256, 4 * 256],
6-
n: [8e5]
6+
n: [8e5],
77
});
88

99
function main({ n, extraSize }) {

benchmark/buffers/buffer-concat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const bench = common.createBenchmark(main, {
55
pieces: [4, 16],
66
pieceSize: [1, 16, 256],
77
withTotalLength: [0, 1],
8-
n: [8e5]
8+
n: [8e5],
99
});
1010

1111
function main({ n, pieces, pieceSize, withTotalLength }) {

benchmark/buffers/buffer-copy.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44
const bench = common.createBenchmark(main, {
55
bytes: [0, 8, 128, 32 * 1024],
66
partial: ['true', 'false'],
7-
n: [6e6]
7+
n: [6e6],
88
});
99

1010
function main({ n, bytes, partial }) {

benchmark/buffers/buffer-creation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
1010
'slow-allocUnsafe',
1111
],
1212
len: [10, 1024, 4096, 8192],
13-
n: [6e5]
13+
n: [6e5],
1414
});
1515

1616
function main({ len, n, type }) {

benchmark/buffers/buffer-equals.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44
const bench = common.createBenchmark(main, {
55
size: [0, 512, 16386],
66
difflen: ['true', 'false'],
7-
n: [1e6]
7+
n: [1e6],
88
});
99

1010
function main({ n, size, difflen }) {

benchmark/buffers/buffer-fill.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, {
1515
'fill(Buffer.alloc(1), 0)',
1616
],
1717
size: [2 ** 13, 2 ** 16],
18-
n: [2e4]
18+
n: [2e4],
1919
});
2020

2121
function main({ n, type, size }) {

benchmark/buffers/buffer-from.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
1616
'uint16array',
1717
],
1818
len: [100, 2048],
19-
n: [8e5]
19+
n: [8e5],
2020
});
2121

2222
function main({ len, n, source }) {

benchmark/buffers/buffer-hex.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common.js');
44

55
const bench = common.createBenchmark(main, {
66
len: [64, 1024],
7-
n: [1e6]
7+
n: [1e6],
88
});
99

1010
function main({ len, n }) {

benchmark/buffers/buffer-indexof-number.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const path = require('path');
55

66
const bench = common.createBenchmark(main, {
77
value: ['@'.charCodeAt(0)],
8-
n: [1e6]
8+
n: [1e6],
99
});
1010

1111
function main({ n, value }) {

benchmark/buffers/buffer-indexof.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const bench = common.createBenchmark(main, {
2121
search: searchStrings,
2222
encoding: ['utf8', 'ucs2'],
2323
type: ['buffer', 'string'],
24-
n: [5e4]
24+
n: [5e4],
2525
});
2626

2727
function main({ n, search, encoding, type }) {

benchmark/buffers/buffer-iterate.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ const bench = common.createBenchmark(main, {
77
size: [512, 4096, 16386],
88
type: ['fast'],
99
method: ['for', 'forOf', 'iterator'],
10-
n: [1e3]
10+
n: [1e3],
1111
});
1212

1313
const methods = {
1414
'for': benchFor,
1515
'forOf': benchForOf,
16-
'iterator': benchIterator
16+
'iterator': benchIterator,
1717
};
1818

1919
function main({ size, type, method, n }) {

benchmark/buffers/buffer-normalize-encoding.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ const bench = common.createBenchmark(main, {
2222
'utf8',
2323
'UTF8',
2424
],
25-
n: [1e6]
25+
n: [1e6],
2626
}, {
27-
flags: ['--expose-internals']
27+
flags: ['--expose-internals'],
2828
});
2929

3030
function main({ encoding, n }) {

benchmark/buffers/buffer-read-float.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const bench = common.createBenchmark(main, {
55
type: ['Double', 'Float'],
66
endian: ['LE'],
77
value: ['zero', 'big', 'small', 'inf', 'nan'],
8-
n: [1e6]
8+
n: [1e6],
99
});
1010

1111
function main({ n, type, endian, value }) {

benchmark/buffers/buffer-read-with-byteLength.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
1212
buffer: ['fast'],
1313
type: types,
1414
n: [1e6],
15-
byteLength: [1, 2, 3, 4, 5, 6]
15+
byteLength: [1, 2, 3, 4, 5, 6],
1616
});
1717

1818
function main({ n, buf, type, byteLength }) {

benchmark/buffers/buffer-read.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const types = [
2121
const bench = common.createBenchmark(main, {
2222
buffer: ['fast'],
2323
type: types,
24-
n: [1e6]
24+
n: [1e6],
2525
});
2626

2727
function main({ n, buf, type }) {

0 commit comments

Comments
 (0)