Skip to content

Commit

Permalink
tools: update ESLint config comma-dangle to always-multiline
Browse files Browse the repository at this point in the history
The advantage of doing this is that `eslint --fix` can automatically add
trailing commas, which avoids wasting time on manual formatting

Refs: nodejs#38701
Refs: nodejs#38608 (review)
  • Loading branch information
pd4d10 committed May 18, 2021
1 parent 910efc2 commit 794fae8
Show file tree
Hide file tree
Showing 2,011 changed files with 7,014 additions and 7,005 deletions.
8 changes: 4 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module.exports = {
files: ['**/*.md/*.cjs', '**/*.md/*.js'],
parserOptions: {
sourceType: 'script',
ecmaFeatures: { impliedStrict: true }
ecmaFeatures: { impliedStrict: true },
},
rules: { strict: 'off' },
},
Expand Down Expand Up @@ -106,10 +106,10 @@ module.exports = {
}],
'comma-dangle': ['error', {
arrays: 'always-multiline',
exports: 'only-multiline',
exports: 'always-multiline',
functions: 'only-multiline',
imports: 'only-multiline',
objects: 'only-multiline',
imports: 'always-multiline',
objects: 'always-multiline',
}],
'comma-spacing': 'error',
'comma-style': 'error',
Expand Down
4 changes: 2 additions & 2 deletions benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class TestDoubleBenchmarker {
const scheme = options.scheme || 'http';
const env = {
test_url: `${scheme}://127.0.0.1:${options.port}${options.path}`,
...process.env
...process.env,
};

const child = child_process.fork(this.executable,
Expand Down Expand Up @@ -203,7 +203,7 @@ exports.run = function(options, callback) {
connections: 100,
duration: 5,
benchmarker: exports.default_http_benchmarker,
...options
...options,
};
if (!options.benchmarker) {
callback(new Error('Could not locate required http benchmarker. See ' +
Expand Down
16 changes: 8 additions & 8 deletions benchmark/async_hooks/async-resource-vs-destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const {
createHook,
executionAsyncResource,
executionAsyncId,
AsyncLocalStorage
AsyncLocalStorage,
} = require('async_hooks');
const { createServer } = require('http');

Expand All @@ -19,7 +19,7 @@ const bench = common.createBenchmark(main, {
path: '/',
connections: 500,
duration: 5,
n: [1e6]
n: [1e6],
});

function buildCurrentResource(getServe) {
Expand All @@ -30,7 +30,7 @@ function buildCurrentResource(getServe) {

return {
server,
close
close,
};

function getCLS() {
Expand Down Expand Up @@ -71,7 +71,7 @@ function buildDestroy(getServe) {

return {
server,
close
close,
};

function getCLS() {
Expand Down Expand Up @@ -108,7 +108,7 @@ function buildAsyncLocalStorage(getServe) {

return {
server,
close
close,
};

function getCLS() {
Expand Down Expand Up @@ -160,12 +160,12 @@ function getServeCallbacks(getCLS, setCLS) {
const types = {
'async-resource': buildCurrentResource,
'destroy': buildDestroy,
'async-local-storage': buildAsyncLocalStorage
'async-local-storage': buildAsyncLocalStorage,
};

const asyncMethods = {
'callbacks': getServeCallbacks,
'async': getServeAwait
'async': getServeAwait,
};

function main({ type, asyncMethod, connections, duration, path }) {
Expand All @@ -178,7 +178,7 @@ function main({ type, asyncMethod, connections, duration, path }) {
bench.http({
path,
connections,
duration
duration,
}, () => {
close();
});
Expand Down
4 changes: 2 additions & 2 deletions benchmark/async_hooks/gc-tracking.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ const bench = common.createBenchmark(main, {
'trackingEnabled',
'trackingEnabledWithDestroyHook',
'trackingDisabled',
]
],
}, {
flags: ['--expose-gc']
flags: ['--expose-gc'],
});

function endAfterGC(n) {
Expand Down
8 changes: 4 additions & 4 deletions benchmark/async_hooks/http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
asyncHooks: ['init', 'before', 'after', 'all', 'disabled', 'none'],
connections: [50, 500],
duration: 5
duration: 5,
});

function main({ asyncHooks, connections, duration }) {
Expand All @@ -14,11 +14,11 @@ function main({ asyncHooks, connections, duration }) {
before() {},
after() {},
destroy() {},
promiseResolve() {}
promiseResolve() {},
};
if (asyncHooks !== 'all' || asyncHooks !== 'disabled') {
hooks = {
[asyncHooks]: () => {}
[asyncHooks]: () => {},
};
}
const hook = require('async_hooks').createHook(hooks);
Expand All @@ -34,7 +34,7 @@ function main({ asyncHooks, connections, duration }) {
bench.http({
connections,
path,
duration
duration,
}, () => {
server.close();
});
Expand Down
12 changes: 6 additions & 6 deletions benchmark/async_hooks/promises.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ let hook;
const tests = {
disabled() {
hook = createHook({
promiseResolve() {}
promiseResolve() {},
});
},
enabled() {
hook = createHook({
promiseResolve() {}
promiseResolve() {},
}).enable();
},
enabledWithDestroy() {
hook = createHook({
promiseResolve() {},
destroy() {}
destroy() {},
}).enable();
},
enabledWithInitOnly() {
hook = createHook({
init() {}
init() {},
}).enable();
}
},
};

const bench = common.createBenchmark(main, {
Expand All @@ -34,7 +34,7 @@ const bench = common.createBenchmark(main, {
'enabledWithDestroy',
'enabledWithInitOnly',
'disabled',
]
],
});

const err = new Error('foobar');
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-base64-decode.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');

const bench = common.createBenchmark(main, {
n: [32],
size: [8 << 20]
size: [8 << 20],
});

function main({ n, size }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/buffers/buffer-base64-encode.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const common = require('../common.js');

const bench = common.createBenchmark(main, {
len: [64 * 1024 * 1024],
n: [32]
n: [32],
}, {
test: { len: 256 }
test: { len: 256 },
});

function main({ n, len }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-bytelength.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common');
const bench = common.createBenchmark(main, {
encoding: ['utf8', 'base64', 'buffer'],
len: [2, 16, 256], // x16
n: [4e6]
n: [4e6],
});

// 16 chars each
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-compare-instance-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
size: [16, 512, 4096, 16386],
args: [1, 2, 5],
n: [1e6]
n: [1e6],
});

function main({ n, size, args }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-compare-offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
method: ['offset', 'slice'],
size: [16, 512, 4096, 16386],
n: [1e6]
n: [1e6],
});

function compareUsingSlice(b0, b1, len, iter) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const common = require('../common.js');

const bench = common.createBenchmark(main, {
size: [16, 512, 4096, 16386],
n: [1e6]
n: [1e6],
});

function main({ n, size }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-concat-fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const common = require('../common.js');

const bench = common.createBenchmark(main, {
extraSize: [1, 256, 4 * 256],
n: [8e5]
n: [8e5],
});

function main({ n, extraSize }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const bench = common.createBenchmark(main, {
pieces: [4, 16],
pieceSize: [1, 16, 256],
withTotalLength: [0, 1],
n: [8e5]
n: [8e5],
});

function main({ n, pieces, pieceSize, withTotalLength }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-copy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
bytes: [0, 8, 128, 32 * 1024],
partial: ['true', 'false'],
n: [6e6]
n: [6e6],
});

function main({ n, bytes, partial }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-creation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const bench = common.createBenchmark(main, {
'slow-allocUnsafe',
],
len: [10, 1024, 4096, 8192],
n: [6e5]
n: [6e5],
});

function main({ len, n, type }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-equals.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');
const bench = common.createBenchmark(main, {
size: [0, 512, 16386],
difflen: ['true', 'false'],
n: [1e6]
n: [1e6],
});

function main({ n, size, difflen }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, {
'fill(Buffer.alloc(1), 0)',
],
size: [2 ** 13, 2 ** 16],
n: [2e4]
n: [2e4],
});

function main({ n, type, size }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-from.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
'uint16array',
],
len: [100, 2048],
n: [8e5]
n: [8e5],
});

function main({ len, n, source }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-hex.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const common = require('../common.js');

const bench = common.createBenchmark(main, {
len: [64, 1024],
n: [1e6]
n: [1e6],
});

function main({ len, n }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-indexof-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path');

const bench = common.createBenchmark(main, {
value: ['@'.charCodeAt(0)],
n: [1e6]
n: [1e6],
});

function main({ n, value }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-indexof.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const bench = common.createBenchmark(main, {
search: searchStrings,
encoding: ['utf8', 'ucs2'],
type: ['buffer', 'string'],
n: [5e4]
n: [5e4],
});

function main({ n, search, encoding, type }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/buffers/buffer-iterate.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ const bench = common.createBenchmark(main, {
size: [512, 4096, 16386],
type: ['fast'],
method: ['for', 'forOf', 'iterator'],
n: [1e3]
n: [1e3],
});

const methods = {
'for': benchFor,
'forOf': benchForOf,
'iterator': benchIterator
'iterator': benchIterator,
};

function main({ size, type, method, n }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/buffers/buffer-normalize-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ const bench = common.createBenchmark(main, {
'utf8',
'UTF8',
],
n: [1e6]
n: [1e6],
}, {
flags: ['--expose-internals']
flags: ['--expose-internals'],
});

function main({ encoding, n }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-read-float.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const bench = common.createBenchmark(main, {
type: ['Double', 'Float'],
endian: ['LE'],
value: ['zero', 'big', 'small', 'inf', 'nan'],
n: [1e6]
n: [1e6],
});

function main({ n, type, endian, value }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-read-with-byteLength.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
buffer: ['fast'],
type: types,
n: [1e6],
byteLength: [1, 2, 3, 4, 5, 6]
byteLength: [1, 2, 3, 4, 5, 6],
});

function main({ n, buf, type, byteLength }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-read.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const types = [
const bench = common.createBenchmark(main, {
buffer: ['fast'],
type: types,
n: [1e6]
n: [1e6],
});

function main({ n, buf, type }) {
Expand Down
Loading

0 comments on commit 794fae8

Please sign in to comment.