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

tools: lint for dangling commas #5091

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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ ecmaFeatures:
rules:
# Possible Errors
# list: https://github.com/eslint/eslint/tree/master/docs/rules#possible-errors
## disallow trailing commas on final line of object/array declaration
comma-dangle: 2
## check debugger sentence
no-debugger: 2
## check duplicate arguments
Expand Down
2 changes: 1 addition & 1 deletion lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ function workerInit() {
close: close,
listen: listen,
ref: ref,
unref: unref,
unref: unref
};
if (message.sockname) {
handle.getsockname = getsockname; // TCP handles only.
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ function setupChannel(target, channel) {
this._handleQueue.push({
callback: callback,
handle: handle,
message: message.msg,
message: message.msg
});
return this._handleQueue.length === 1;
}
Expand All @@ -575,7 +575,7 @@ function setupChannel(target, channel) {
this._handleQueue.push({
callback: callback,
handle: null,
message: message,
message: message
});
return this._handleQueue.length === 1;
}
Expand Down
2 changes: 1 addition & 1 deletion test/addons/make-callback/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const recv = {
assert.strictEqual(this, recv);
assert.strictEqual(x, 1337);
return 42;
}),
})
};

assert.strictEqual(42, makeCallback(recv, 'one'));
Expand Down
2 changes: 1 addition & 1 deletion test/addons/repl-domain-abort/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var lines = [
// This line shouldn't cause an assertion error.
'require(\'' + buildPath + '\')' +
// Log output to double check callback ran.
'.method(function() { console.log(\'cb_ran\'); });',
'.method(function() { console.log(\'cb_ran\'); });'
];

var dInput = new stream.Readable();
Expand Down
2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ exports.localIPv6Hosts = [
'ipv6-loopback',

// Typically universal
'localhost',
'localhost'
];

Object.defineProperty(exports, 'inFreeBSDJail', {
Expand Down
2 changes: 1 addition & 1 deletion test/debugger/test-debugger-repl-restart.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ initialLines.splice(2, 0, /Restoring/, /Warning/);

// Restart the debugged script
repl.addTest('restart', [
/terminated/,
/terminated/
].concat(initialLines));

repl.addTest('list(5)', linesWithBreakpoint);
Expand Down
6 changes: 3 additions & 3 deletions test/debugger/test-debugger-repl-term.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ addTest('n', [
addTest('', [
/debug>/,
/break in .*:5/,
/3/, /4/, /5/, /6/, /7/,
/3/, /4/, /5/, /6/, /7/
]);

// continue
Expand All @@ -33,12 +33,12 @@ addTest('c', [
addTest('', [
/debug>/,
/break in .*:5/,
/3/, /4/, /5/, /6/, /7/,
/3/, /4/, /5/, /6/, /7/
]);

// should repeat continue
addTest('', [
/debug>/,
/break in .*:23/,
/21/, /22/, /23/, /24/, /25/,
/21/, /22/, /23/, /24/, /25/
]);
4 changes: 2 additions & 2 deletions test/parallel/test-cluster-setup-master-cumulative.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ assert.deepEqual(cluster.settings, {
args: process.argv.slice(2),
exec: process.argv[1],
execArgv: process.execArgv,
silent: false,
silent: false
});
console.log('ok sets defaults');

Expand All @@ -36,6 +36,6 @@ assert.deepEqual(cluster.settings, {
args: ['foo', 'bar'],
exec: 'overridden',
execArgv: ['baz', 'bang'],
silent: false,
silent: false
});
console.log('ok preserves current settings');
2 changes: 1 addition & 1 deletion test/parallel/test-cluster-setup-master-multiple.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cluster.on('setup', function() {
var execs = [
'node-next',
'node-next-2',
'node-next-3',
'node-next-3'
];

process.on('exit', function assertTests() {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-dh.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ ecdh5.setPrivateKey(cafebabeKey, 'hex');
[ // Some invalid private keys for the secp256k1 curve.
'0000000000000000000000000000000000000000000000000000000000000000',
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141',
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',
'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'
].forEach(function(element, index, object) {
assert.throws(function() {
ecdh5.setPrivateKey(element, 'hex');
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-crypto-hmac.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var wikipedia = [
'b613679a0814d9ec772f95d778c35fc5ff1697c493715653c6c71214' +
'4292c5ad'
}
},
}
];

for (let i = 0, l = wikipedia.length; i < l; i++) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-debug-signal-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ var expectedLines = [
'Starting debugger agent.',
'Debugger listening on port ' + (port + 1),
'Starting debugger agent.',
'Debugger listening on port ' + (port + 2),
'Debugger listening on port ' + (port + 2)
];

function assertOutputLines() {
Expand Down
8 changes: 4 additions & 4 deletions test/parallel/test-dns.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function noop() {}

var goog = [
'8.8.8.8',
'8.8.4.4',
'8.8.4.4'
];
assert.doesNotThrow(function() { dns.setServers(goog); });
assert.deepEqual(dns.getServers(), goog);
Expand All @@ -20,7 +20,7 @@ assert.deepEqual(dns.getServers(), goog);

var goog6 = [
'2001:4860:4860::8888',
'2001:4860:4860::8844',
'2001:4860:4860::8844'
];
assert.doesNotThrow(function() { dns.setServers(goog6); });
assert.deepEqual(dns.getServers(), goog6);
Expand All @@ -31,11 +31,11 @@ assert.deepEqual(dns.getServers(), goog6);

var ports = [
'4.4.4.4:53',
'[2001:4860:4860::8888]:53',
'[2001:4860:4860::8888]:53'
];
var portsExpected = [
'4.4.4.4',
'2001:4860:4860::8888',
'2001:4860:4860::8888'
];
dns.setServers(ports);
assert.deepEqual(dns.getServers(), portsExpected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const tests = [
});
});
});
},
}
];

if (process.argv[2] === 'child') {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-agent-error-on-idle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var http = require('http');
var Agent = http.Agent;

var agent = new Agent({
keepAlive: true,
keepAlive: true
});

var requestParams = {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-client-timeout-agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var requests_done = 0;
var options = {
method: 'GET',
port: common.PORT,
host: '127.0.0.1',
host: '127.0.0.1'
};

//http.globalAgent.maxSockets = 15;
Expand Down
6 changes: 3 additions & 3 deletions test/parallel/test-http-content-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ var http = require('http');

var expectedHeadersMultipleWrites = {
'connection': 'close',
'transfer-encoding': 'chunked',
'transfer-encoding': 'chunked'
};

var expectedHeadersEndWithData = {
'connection': 'close',
'content-length': 'hello world'.length,
'content-length': 'hello world'.length
};

var expectedHeadersEndNoData = {
'connection': 'close',
'content-length': '0',
'content-length': '0'
};

var receivedRequests = 0;
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-flush-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
const req = http.request({
method: 'GET',
host: '127.0.0.1',
port: common.PORT,
port: common.PORT
});
req.setHeader('foo', 'bar');
req.flushHeaders();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-flush-response-headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ server.listen(common.PORT, common.localhostIPv4, function() {
var req = http.request({
method: 'GET',
host: common.localhostIPv4,
port: common.PORT,
port: common.PORT
}, onResponse);

req.end();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-flush.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ http.createServer(function(req, res) {
var req = http.request({
method: 'POST',
host: '127.0.0.1',
port: common.PORT,
port: common.PORT
});
req.flush(); // Flush the request headers.
req.flush(); // Should be idempotent.
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-http-server-multiheaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ srv.listen(common.PORT, function() {
['sec-websocket-extensions', 'baz'],
['constructor', 'foo'],
['constructor', 'bar'],
['constructor', 'baz'],
['constructor', 'baz']
]
});
});
6 changes: 3 additions & 3 deletions test/parallel/test-http-server-multiheaders2.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var multipleAllowed = [

// make sure that unspecified headers is treated as multiple
'Some-Random-Header',
'X-Some-Random-Header',
'X-Some-Random-Header'
];

var multipleForbidden = [
Expand All @@ -42,7 +42,7 @@ var multipleForbidden = [
'If-Unmodified-Since',
'From',
'Location',
'Max-Forwards',
'Max-Forwards'

// special case, tested differently
//'Content-Length',
Expand Down Expand Up @@ -85,6 +85,6 @@ srv.listen(common.PORT, function() {
host: 'localhost',
port: common.PORT,
path: '/',
headers: headers,
headers: headers
});
});
2 changes: 1 addition & 1 deletion test/parallel/test-http-server-stale-close.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if (process.env.NODE_TEST_FORK) {
headers: {'Content-Length': '42'},
method: 'POST',
host: '127.0.0.1',
port: common.PORT,
port: common.PORT
}, process.exit);
req.write('BAM');
req.end();
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-listen-fd-cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ test(function(parent) {
http.get({
server: 'localhost',
port: PORT,
path: '/',
path: '/'
}).on('response', function(res) {
var s = '';
res.on('data', function(c) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-listen-fd-detached-inherit.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function test() {
http.get({
server: 'localhost',
port: PORT,
path: '/',
path: '/'
}).on('response', function(res) {
var s = '';
res.on('data', function(c) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-listen-fd-detached.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function test() {
http.get({
server: 'localhost',
port: PORT,
path: '/',
path: '/'
}).on('response', function(res) {
var s = '';
res.on('data', function(c) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-listen-fd-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test(function(child) {
http.get({
server: 'localhost',
port: PORT,
path: '/',
path: '/'
}).on('response', function(res) {
var s = '';
res.on('data', function(c) {
Expand Down
4 changes: 2 additions & 2 deletions test/parallel/test-net-localerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ var net = require('net');
connect({
host: 'localhost',
port: common.PORT,
localPort: 'foobar',
localPort: 'foobar'
}, 'localPort should be a number: foobar');

connect({
host: 'localhost',
port: common.PORT,
localAddress: 'foobar',
localAddress: 'foobar'
}, 'localAddress should be a valid IP: foobar');

function connect(opts, msg) {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-path-parse-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const errors = [
{method: 'format', input: [true],
message: /Parameter "pathObject" must be an object, not boolean/},
{method: 'format', input: [1],
message: /Parameter "pathObject" must be an object, not number/},
message: /Parameter "pathObject" must be an object, not number/}
];

checkParseFormat(path.win32, winPaths);
Expand Down
Loading