Skip to content

Commit 8d6e679

Browse files
Trottrvagg
authored andcommitted
src,test,tools: modify for more stringent linting
ESLint 2.1.0 is coming. Some lint rules have been tightened. PR-URL: #5214 Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: jbergstroem - Johan Bergström <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Roman Reiss <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent 4727470 commit 8d6e679

10 files changed

+28
-32
lines changed

test/parallel/test-debug-brk.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ const common = require('../common');
44
const assert = require('assert');
55
const spawnSync = require('child_process').spawnSync;
66

7-
const args = [`--debug-brk=${common.PORT}`, `-e`, `0`];
7+
const args = [`--debug-brk=${common.PORT}`, '-e', '0'];
88
const proc = spawnSync(process.execPath, args, {encoding: 'utf8'});
99
assert(/Debugger listening on/.test(proc.stderr));

test/parallel/test-debug-no-context.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const common = require('../common');
44
const assert = require('assert');
55
const spawn = require('child_process').spawn;
66

7-
const args = [`--debug`, `--debug-port=${common.PORT}`, `--interactive`];
7+
const args = ['--debug', `--debug-port=${common.PORT}`, '--interactive'];
88
const proc = spawn(process.execPath, args, { stdio: 'pipe' });
99
proc.stdin.write(`
1010
util.inspect(Promise.resolve(42));

test/parallel/test-dgram-udp4.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ const assert = require('assert');
44
const dgram = require('dgram');
55
const server_port = common.PORT;
66
const message_to_send = 'A message to send';
7-
let server, client;
7+
let client;
88
let timer;
99

10-
server = dgram.createSocket('udp4');
10+
const server = dgram.createSocket('udp4');
1111
server.on('message', function(msg, rinfo) {
1212
console.log('server got: ' + msg +
1313
' from ' + rinfo.address + ':' + rinfo.port);

test/parallel/test-file-write-stream3.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ function run_test_3() {
126126
var file, options;
127127

128128
const data = '\u2026\u2026'; // 3 bytes * 2 = 6 bytes in UTF-8
129-
let fileData;
130129

131130
options = { start: 10,
132131
flags: 'r+' };
@@ -144,7 +143,7 @@ function run_test_3() {
144143
console.log(' (debug: start ', file.start);
145144
console.log(' (debug: pos ', file.pos);
146145
assert.strictEqual(file.bytesWritten, data.length * 3);
147-
fileData = fs.readFileSync(filepath, 'utf8');
146+
const fileData = fs.readFileSync(filepath, 'utf8');
148147
console.log(' (debug: file data ', fileData);
149148
console.log(' (debug: expected ', fileDataExpected_3);
150149
assert.equal(fileData, fileDataExpected_3);

test/parallel/test-fs-realpath.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function test_simple_relative_symlink(callback) {
9090
[
9191
[entry, '../' + common.tmpDirName + '/cycles/root.js']
9292
].forEach(function(t) {
93-
try {fs.unlinkSync(t[0]);}catch (e) {}
93+
try {fs.unlinkSync(t[0]);} catch (e) {}
9494
console.log('fs.symlinkSync(%j, %j, %j)', t[1], t[0], 'file');
9595
fs.symlinkSync(t[1], t[0], 'file');
9696
unlink.push(t[0]);

test/parallel/test-path.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -316,12 +316,11 @@ joinTests.forEach(function(test) {
316316
test[1].forEach(function(test) {
317317
const actual = join.apply(null, test[0]);
318318
const expected = test[1];
319-
let actualAlt;
320319
// For non-Windows specific tests with the Windows join(), we need to try
321320
// replacing the slashes since the non-Windows specific tests' `expected`
322321
// use forward slashes
323-
if (join === path.win32.join)
324-
actualAlt = actual.replace(/\\/g, '/');
322+
const actualAlt = (join === path.win32.join) ?
323+
actual.replace(/\\/g, '/') : undefined;
325324
const fn = 'path.' +
326325
(join === path.win32.join ? 'win32' : 'posix') +
327326
'.join(';

test/parallel/test-tls-two-cas-one-string.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ const tls = require('tls');
55
const fs = require('fs');
66

77
const ca1 =
8-
fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`, `utf8`);
8+
fs.readFileSync(`${common.fixturesDir}/keys/ca1-cert.pem`, 'utf8');
99
const ca2 =
10-
fs.readFileSync(`${common.fixturesDir}/keys/ca2-cert.pem`, `utf8`);
10+
fs.readFileSync(`${common.fixturesDir}/keys/ca2-cert.pem`, 'utf8');
1111
const cert =
12-
fs.readFileSync(`${common.fixturesDir}/keys/agent3-cert.pem`, `utf8`);
12+
fs.readFileSync(`${common.fixturesDir}/keys/agent3-cert.pem`, 'utf8');
1313
const key =
14-
fs.readFileSync(`${common.fixturesDir}/keys/agent3-key.pem`, `utf8`);
14+
fs.readFileSync(`${common.fixturesDir}/keys/agent3-key.pem`, 'utf8');
1515

1616
function test(ca, next) {
1717
const server = tls.createServer({ ca, cert, key }, function(conn) {

test/parallel/test-url.js

+13-14
Original file line numberDiff line numberDiff line change
@@ -259,20 +259,19 @@ var parseTests = {
259259
path: '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s='
260260
},
261261

262-
'http://user:[email protected]/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=':
263-
{
264-
href: 'http://user:[email protected]/vt/lyrs=m@114???' +
265-
'&hl=en&src=api&x=2&y=2&z=3&s=',
266-
protocol: 'http:',
267-
slashes: true,
268-
host: 'mt0.google.com',
269-
auth: 'user:pass',
270-
hostname: 'mt0.google.com',
271-
search: '???&hl=en&src=api&x=2&y=2&z=3&s=',
272-
query: '??&hl=en&src=api&x=2&y=2&z=3&s=',
273-
pathname: '/vt/lyrs=m@114',
274-
path: '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s='
275-
},
262+
'http://user:[email protected]/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s=': {
263+
href: 'http://user:[email protected]/vt/lyrs=m@114???' +
264+
'&hl=en&src=api&x=2&y=2&z=3&s=',
265+
protocol: 'http:',
266+
slashes: true,
267+
host: 'mt0.google.com',
268+
auth: 'user:pass',
269+
hostname: 'mt0.google.com',
270+
search: '???&hl=en&src=api&x=2&y=2&z=3&s=',
271+
query: '??&hl=en&src=api&x=2&y=2&z=3&s=',
272+
pathname: '/vt/lyrs=m@114',
273+
path: '/vt/lyrs=m@114???&hl=en&src=api&x=2&y=2&z=3&s='
274+
},
276275

277276
'file:///etc/passwd': {
278277
href: 'file:///etc/passwd',

test/sequential/test-child-process-fork-getconnections.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ if (process.argv[2] === 'child') {
5656

5757
let disconnected = 0;
5858
server.on('listening', function() {
59-
let j = count, client;
59+
let j = count;
6060
while (j--) {
61-
client = net.connect(common.PORT, '127.0.0.1');
61+
const client = net.connect(common.PORT, '127.0.0.1');
6262
client.on('close', function() {
6363
disconnected += 1;
6464
});

tools/doc/addon-verify.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ const contents = fs.readFileSync(doc).toString();
1212

1313
const tokens = marked.lexer(contents, {});
1414
let files = null;
15-
let blockName;
1615
let id = 0;
1716

1817
// Just to make sure that all examples will be processed
@@ -28,7 +27,7 @@ oldDirs = oldDirs.filter(function(dir) {
2827
for (var i = 0; i < tokens.length; i++) {
2928
var token = tokens[i];
3029
if (token.type === 'heading' && token.text) {
31-
blockName = token.text;
30+
const blockName = token.text;
3231
if (files && Object.keys(files).length !== 0) {
3332
verifyFiles(files,
3433
blockName,

0 commit comments

Comments
 (0)