Skip to content

Commit

Permalink
benchmark,lib,test: adjust for linting
Browse files Browse the repository at this point in the history
Formatting changes for upcoming linter update.

PR-URL: nodejs#10561
Reviewed-By: Teddy Katz <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Sam Roberts <[email protected]>
  • Loading branch information
Trott committed Jan 6, 2017
1 parent e9b7291 commit a68987c
Show file tree
Hide file tree
Showing 46 changed files with 471 additions and 446 deletions.
4 changes: 2 additions & 2 deletions benchmark/url/whatwg-url-properties.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ var bench = common.createBenchmark(main, {
'http://user:[email protected]:21/aaa/zzz?l=24#test'
],
prop: ['toString', 'href', 'origin', 'protocol',
'username', 'password', 'host', 'hostname', 'port',
'pathname', 'search', 'searchParams', 'hash'],
'username', 'password', 'host', 'hostname', 'port',
'pathname', 'search', 'searchParams', 'hash'],
n: [1e4]
});

Expand Down
10 changes: 6 additions & 4 deletions lib/internal/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ function stripBOM(content) {
return content;
}

exports.builtinLibs = ['assert', 'buffer', 'child_process', 'cluster',
'crypto', 'dgram', 'dns', 'domain', 'events', 'fs', 'http', 'https', 'net',
'os', 'path', 'punycode', 'querystring', 'readline', 'repl', 'stream',
'string_decoder', 'tls', 'tty', 'url', 'util', 'v8', 'vm', 'zlib'];
exports.builtinLibs = [
'assert', 'buffer', 'child_process', 'cluster', 'crypto', 'dgram', 'dns',
'domain', 'events', 'fs', 'http', 'https', 'net', 'os', 'path', 'punycode',
'querystring', 'readline', 'repl', 'stream', 'string_decoder', 'tls', 'tty',
'url', 'util', 'v8', 'vm', 'zlib'
];

function addBuiltinLibsToObject(object) {
// Make built-in modules available directly (loaded lazily).
Expand Down
5 changes: 3 additions & 2 deletions lib/os.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ exports.tmpdir = function() {
return path;
};

exports.tmpDir = internalUtil.deprecate(exports.tmpdir,
'os.tmpDir() is deprecated. Use os.tmpdir() instead.');
const tmpDirDeprecationMsg =
'os.tmpDir() is deprecated. Use os.tmpdir() instead.';
exports.tmpDir = internalUtil.deprecate(exports.tmpdir, tmpDirDeprecationMsg);

exports.getNetworkInterfaces = internalUtil.deprecate(function() {
return exports.networkInterfaces();
Expand Down
27 changes: 14 additions & 13 deletions lib/repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ const debug = util.debuglog('repl');
const parentModule = module;
const replMap = new WeakMap();

const GLOBAL_OBJECT_PROPERTIES = ['NaN', 'Infinity', 'undefined',
'eval', 'parseInt', 'parseFloat', 'isNaN', 'isFinite', 'decodeURI',
'decodeURIComponent', 'encodeURI', 'encodeURIComponent',
'Object', 'Function', 'Array', 'String', 'Boolean', 'Number',
'Date', 'RegExp', 'Error', 'EvalError', 'RangeError',
'ReferenceError', 'SyntaxError', 'TypeError', 'URIError',
'Math', 'JSON'];
const GLOBAL_OBJECT_PROPERTIES = [
'NaN', 'Infinity', 'undefined', 'eval', 'parseInt', 'parseFloat', 'isNaN',
'isFinite', 'decodeURI', 'decodeURIComponent', 'encodeURI',
'encodeURIComponent', 'Object', 'Function', 'Array', 'String', 'Boolean',
'Number', 'Date', 'RegExp', 'Error', 'EvalError', 'RangeError',
'ReferenceError', 'SyntaxError', 'TypeError', 'URIError', 'Math', 'JSON'
];
const GLOBAL_OBJECT_PROPERTY_MAP = {};
GLOBAL_OBJECT_PROPERTIES.forEach((p) => GLOBAL_OBJECT_PROPERTY_MAP[p] = p);

Expand Down Expand Up @@ -1216,12 +1216,13 @@ function addStandardGlobals(completionGroups, filter) {
// Common keywords. Exclude for completion on the empty string, b/c
// they just get in the way.
if (filter) {
completionGroups.push(['break', 'case', 'catch', 'const',
'continue', 'debugger', 'default', 'delete', 'do', 'else',
'export', 'false', 'finally', 'for', 'function', 'if',
'import', 'in', 'instanceof', 'let', 'new', 'null', 'return',
'switch', 'this', 'throw', 'true', 'try', 'typeof', 'undefined',
'var', 'void', 'while', 'with', 'yield']);
completionGroups.push([
'break', 'case', 'catch', 'const', 'continue', 'debugger', 'default',
'delete', 'do', 'else', 'export', 'false', 'finally', 'for', 'function',
'if', 'import', 'in', 'instanceof', 'let', 'new', 'null', 'return',
'switch', 'this', 'throw', 'true', 'try', 'typeof', 'undefined', 'var',
'void', 'while', 'with', 'yield'
]);
}
}

Expand Down
6 changes: 3 additions & 3 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ function formatValue(ctx, value, recurseTimes) {
if (keys.length === 0) {
if (typeof value === 'function') {
return ctx.stylize(`[Function${value.name ? `: ${value.name}` : ''}]`,
'special');
'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
Expand Down Expand Up @@ -667,7 +667,7 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
for (var i = 0; i < maxLength; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
String(i), true));
} else {
output.push('');
}
Expand All @@ -678,7 +678,7 @@ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
keys.forEach(function(key) {
if (typeof key === 'symbol' || !key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
key, true));
}
});
return output;
Expand Down
2 changes: 1 addition & 1 deletion test/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ exports.canCreateSymLink = function() {
// If unix tools are in the path, they can shadow the one we want,
// so use the full path while executing whoami
const whoamiPath = path.join(process.env['SystemRoot'],
'System32', 'whoami.exe');
'System32', 'whoami.exe');

let err = false;
let output = '';
Expand Down
8 changes: 4 additions & 4 deletions test/inspector/test-inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,10 @@ function testSetBreakpointAndResume(session) {
const commands = [
{ 'method': 'Debugger.setBreakpointByUrl',
'params': { 'lineNumber': 5,
'url': session.mainScriptPath,
'columnNumber': 0,
'condition': ''
}
'url': session.mainScriptPath,
'columnNumber': 0,
'condition': ''
}
},
{ 'method': 'Debugger.resume'},
[ { 'method': 'Debugger.getScriptSource',
Expand Down
92 changes: 47 additions & 45 deletions test/internet/test-dns-ipv4.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,61 +36,61 @@ function checkWrap(req) {

TEST(function test_resolve4(done) {
const req = dns.resolve4('www.google.com',
common.mustCall((err, ips) => {
assert.ifError(err);
common.mustCall((err, ips) => {
assert.ifError(err);

assert.ok(ips.length > 0);
assert.ok(ips.length > 0);

for (let i = 0; i < ips.length; i++) {
assert.ok(isIPv4(ips[i]));
}
for (let i = 0; i < ips.length; i++) {
assert.ok(isIPv4(ips[i]));
}

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_reverse_ipv4(done) {
const req = dns.reverse('8.8.8.8',
common.mustCall((err, domains) => {
assert.ifError(err);
common.mustCall((err, domains) => {
assert.ifError(err);

assert.ok(domains.length > 0);
assert.ok(domains.length > 0);

for (let i = 0; i < domains.length; i++) {
assert.ok(domains[i]);
assert.ok(typeof domains[i] === 'string');
}
for (let i = 0; i < domains.length; i++) {
assert.ok(domains[i]);
assert.ok(typeof domains[i] === 'string');
}

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_lookup_ipv4_explicit(done) {
const req = dns.lookup('www.google.com', 4,
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(net.isIPv4(ip));
assert.strictEqual(family, 4);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(net.isIPv4(ip));
assert.strictEqual(family, 4);

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_lookup_ipv4_implicit(done) {
const req = dns.lookup('www.google.com',
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(net.isIPv4(ip));
assert.strictEqual(family, 4);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.ok(net.isIPv4(ip));
assert.strictEqual(family, 4);

done();
}));
done();
}));

checkWrap(req);
});
Expand Down Expand Up @@ -125,26 +125,26 @@ TEST(function test_lookup_ipv4_hint_addrconfig(done) {

TEST(function test_lookup_ip_ipv4(done) {
const req = dns.lookup('127.0.0.1',
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(family, 4);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(family, 4);

done();
}));
done();
}));

checkWrap(req);
});

TEST(function test_lookup_localhost_ipv4(done) {
const req = dns.lookup('localhost', 4,
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(family, 4);
common.mustCall((err, ip, family) => {
assert.ifError(err);
assert.strictEqual(ip, '127.0.0.1');
assert.strictEqual(family, 4);

done();
}));
done();
}));

checkWrap(req);
});
Expand All @@ -164,21 +164,23 @@ TEST(function test_lookup_all_ipv4(done) {
});

done();
}
));
})
);

checkWrap(req);
});

TEST(function test_lookupservice_ip_ipv4(done) {
const req = dns.lookupService('127.0.0.1', 80,
const req = dns.lookupService(
'127.0.0.1', 80,
common.mustCall((err, host, service) => {
assert.ifError(err);
assert.strictEqual(typeof host, 'string');
assert(host);
assert(['http', 'www', '80'].includes(service));
done();
}));
})
);

checkWrap(req);
});
Loading

0 comments on commit a68987c

Please sign in to comment.