mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

There has been occasional nits for spacing in object literals in PRs but the project does not lint for it and it is not always handled consistently in the existing code, even on adjacent lines of a file. This change enables a linting rule requiring no space between the key and the colon, and requiring at least one space (but allowing for more so property values can be lined up if desired) between the colon and the value. This appears to be the most common style used in the current code base. Example code the complies with lint rule: myObj = { foo: 'bar' }; Examples that do not comply with the lint rule: myObj = { foo : 'bar' }; myObj = { foo:'bar' }; PR-URL: https://github.com/nodejs/node/pull/6592 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
41 lines
749 B
JavaScript
41 lines
749 B
JavaScript
'use strict';
|
|
// see https://github.com/joyent/node/issues/3257
|
|
|
|
var common = require('../common');
|
|
var http = require('http');
|
|
|
|
var server = http.createServer(function(req, res) {
|
|
req.resume();
|
|
req.once('end', function() {
|
|
res.writeHead(200);
|
|
res.end();
|
|
server.close();
|
|
});
|
|
});
|
|
|
|
common.refreshTmpDir();
|
|
|
|
server.listen(common.PIPE, function() {
|
|
var req = http.request({
|
|
socketPath: common.PIPE,
|
|
headers: {'Content-Length': '1'},
|
|
method: 'POST',
|
|
path: '/'
|
|
});
|
|
|
|
req.write('.');
|
|
|
|
sched(function() { req.end(); }, 5);
|
|
});
|
|
|
|
// schedule a callback after `ticks` event loop ticks
|
|
function sched(cb, ticks) {
|
|
function fn() {
|
|
if (--ticks)
|
|
setImmediate(fn);
|
|
else
|
|
cb();
|
|
}
|
|
setImmediate(fn);
|
|
}
|