Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: change "comma-dangle" rule #19133

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ module.exports = {
// http://eslint.org/docs/rules/#stylistic-issues'
'block-spacing': 'error',
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
'comma-dangle': ['error', 'only-multiline'],
'comma-dangle': ['error', {
'arrays': 'always-multiline',
'objects': 'always-multiline',
'functions': 'never',
}],
'comma-spacing': 'error',
'comma-style': 'error',
'computed-property-spacing': 'error',
Expand Down
10 changes: 5 additions & 5 deletions benchmark/_http-benchmarkers.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class AutocannonBenchmarker {
'-c', options.connections,
'-j',
'-n',
`http://127.0.0.1:${options.port}${options.path}`
`http://127.0.0.1:${options.port}${options.path}`,
];
const child = child_process.spawn(this.executable, args);
return child;
Expand Down Expand Up @@ -59,7 +59,7 @@ class WrkBenchmarker {
'-d', options.duration,
'-c', options.connections,
'-t', 8,
`http://127.0.0.1:${options.port}${options.path}`
`http://127.0.0.1:${options.port}${options.path}`,
];
const child = child_process.spawn(this.executable, args);
return child;
Expand Down Expand Up @@ -96,7 +96,7 @@ class TestDoubleBenchmarker {

const child = child_process.fork(this.executable, {
silent: true,
env
env,
});
return child;
}
Expand Down Expand Up @@ -168,7 +168,7 @@ const http_benchmarkers = [
new WrkBenchmarker(),
new AutocannonBenchmarker(),
new TestDoubleBenchmarker(),
new H2LoadBenchmarker()
new H2LoadBenchmarker(),
];

const benchmarkers = {};
Expand All @@ -186,7 +186,7 @@ exports.run = function(options, callback) {
path: '/',
connections: 100,
duration: 5,
benchmarker: exports.default_http_benchmarker
benchmarker: exports.default_http_benchmarker,
}, options);
if (!options.benchmarker) {
callback(new Error('Could not locate required http benchmarker. See ' +
Expand Down
4 changes: 2 additions & 2 deletions benchmark/arrays/var-int.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const bench = common.createBenchmark(main, {
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
'Float64Array',
],
n: [25]
n: [25],
});

function main({ type, n }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/arrays/zero-float.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const bench = common.createBenchmark(main, {
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
'Float64Array',
],
n: [25]
n: [25],
});

function main({ type, n }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/arrays/zero-int.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const bench = common.createBenchmark(main, {
'Int32Array',
'Uint32Array',
'Float32Array',
'Float64Array'
'Float64Array',
],
n: [25]
n: [25],
});

function main({ type, n }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/assert/deepequal-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const bench = common.createBenchmark(main, {
'deepEqual',
'deepStrictEqual',
'notDeepEqual',
'notDeepStrictEqual'
]
'notDeepStrictEqual',
],
});

function main({ len, n, method }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/assert/deepequal-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const bench = common.createBenchmark(main, {
'notDeepEqual_mixed',
'notDeepStrictEqual_mixed',
'notDeepEqual_looseMatches',
]
],
});

function benchmark(method, n, values, values2) {
Expand Down
8 changes: 4 additions & 4 deletions benchmark/assert/deepequal-object.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const bench = common.createBenchmark(main, {
'deepEqual',
'deepStrictEqual',
'notDeepEqual',
'notDeepStrictEqual'
]
'notDeepStrictEqual',
],
});

function createObj(source, add = '') {
Expand All @@ -20,8 +20,8 @@ function createObj(source, add = '') {
nope: {
bar: `123${add}`,
a: [1, 2, 3],
baz: n
}
baz: n,
},
}));
}

Expand Down
6 changes: 3 additions & 3 deletions benchmark/assert/deepequal-prims-and-objs-big-array-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const primValues = {
'boolean': true,
'object': { 0: 'a' },
'array': [1, 2, 3],
'new-array': new Array([1, 2, 3])
'new-array': new Array([1, 2, 3]),
};

const bench = common.createBenchmark(main, {
Expand All @@ -26,8 +26,8 @@ const bench = common.createBenchmark(main, {
'deepEqual_Set',
'deepStrictEqual_Set',
'notDeepEqual_Set',
'notDeepStrictEqual_Set'
]
'notDeepStrictEqual_Set',
],
});

function run(fn, n, actual, expected) {
Expand Down
6 changes: 3 additions & 3 deletions benchmark/assert/deepequal-prims-and-objs-big-loop.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const primValues = {
'boolean': true,
'object': { 0: 'a' },
'array': [1, 2, 3],
'new-array': new Array([1, 2, 3])
'new-array': new Array([1, 2, 3]),
};

const bench = common.createBenchmark(main, {
Expand All @@ -20,8 +20,8 @@ const bench = common.createBenchmark(main, {
'deepEqual',
'deepStrictEqual',
'notDeepEqual',
'notDeepStrictEqual'
]
'notDeepStrictEqual',
],
});

function main({ n, primitive, method }) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/assert/deepequal-set.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const bench = common.createBenchmark(main, {
'notDeepEqual_mixed',
'notDeepStrictEqual_mixed',
'notDeepEqual_looseMatches',
]
],
});

function benchmark(method, n, values, values2) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/assert/deepequal-typedarrays.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const bench = common.createBenchmark(main, {
'deepEqual',
'deepStrictEqual',
'notDeepEqual',
'notDeepStrictEqual'
'notDeepStrictEqual',
],
len: [1e6]
len: [1e6],
});

function main({ type, n, len, method }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/assert/throws.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const bench = common.createBenchmark(main, {
'doesNotThrow',
'throws',
'throws_TypeError',
'throws_RegExp'
]
'throws_RegExp',
],
});

function main({ n, method }) {
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 @@ -7,9 +7,9 @@ const bench = common.createBenchmark(main, {
method: [
'trackingEnabled',
'trackingDisabled',
]
],
}, {
flags: ['--expose-gc']
flags: ['--expose-gc'],
});

function endAfterGC(n) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/buffers/buffer-base64-encode.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, {
len: [64 * 1024 * 1024],
n: [32]
n: [32],
});

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

// 16 chars each
const chars = [
'hello brendan!!!', // 1 byte
'ΰαβγδεζηθικλμνξο', // 2 bytes
'挰挱挲挳挴挵挶挷挸挹挺挻挼挽挾挿', // 3 bytes
'𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢' // 4 bytes
'𠜎𠜱𠝹𠱓𠱸𠲖𠳏𠳕𠴕𠵼𠵿𠸎𠸏𠹷𠺝𠺢', // 4 bytes
];

function main({ n, len, encoding }) {
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, 1024, 4096, 16386],
args: [1, 2, 3, 4, 5],
millions: [1]
millions: [1],
});

function main({ millions, 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, 1024, 4096, 16386],
millions: [1]
millions: [1],
});

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, 1024, 4096, 16386],
millions: [1]
millions: [1],
});

function main({ millions, size }) {
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: [1, 4, 16],
pieceSize: [1, 16, 256],
withTotalLength: [0, 1],
n: [1024]
n: [1024],
});

function main({ n, pieces, pieceSize, withTotalLength }) {
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 @@ -12,7 +12,7 @@ const bench = common.createBenchmark(main, {
'slow',
'buffer()'],
len: [10, 1024, 2048, 4096, 8192],
n: [1024]
n: [1024],
});

function main({ len, n, type }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/buffers/buffer-fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const bench = common.createBenchmark(main, {
'fill("t", "utf8")',
'fill("t", 0, "utf8")',
'fill("t", 0)',
'fill(Buffer.alloc(1), 0)'
'fill(Buffer.alloc(1), 0)',
],
size: [2 ** 8, 2 ** 13, 2 ** 16],
n: [2e4]
n: [2e4],
});

function main({ n, type, size }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/buffers/buffer-from.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ const bench = common.createBenchmark(main, {
'string',
'string-utf8',
'string-base64',
'object'
'object',
],
len: [10, 2048],
n: [2048]
n: [2048],
});

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: [0, 1, 64, 1024],
n: [1e7]
n: [1e7],
});

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: [1e7]
n: [1e7],
});

function main({ n, value }) {
Expand Down
4 changes: 2 additions & 2 deletions benchmark/buffers/buffer-indexof.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ const searchStrings = [
'Soo--oop',
'aaaaaaaaaaaaaaaaa',
'venture to go near the house till she had brought herself down to',
'</i> to the Caterpillar'
'</i> to the Caterpillar',
];

const bench = common.createBenchmark(main, {
search: searchStrings,
encoding: ['undefined', 'utf8', 'ucs2', 'binary'],
type: ['buffer', 'string'],
iter: [100000]
iter: [100000],
});

function main({ iter, 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: [16, 512, 1024, 4096, 16386],
type: ['fast', 'slow'],
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
6 changes: 3 additions & 3 deletions benchmark/buffers/buffer-normalize-encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ const bench = common.createBenchmark(main, {
'utf16le',
'UTF16LE',
'utf8',
'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: ['BE', 'LE'],
value: ['zero', 'big', 'small', 'inf', 'nan'],
millions: [1]
millions: [1],
});

function main({ millions, type, endian, value }) {
Expand Down
Loading