test: update arrow function style
authorcjihrig <cjihrig@gmail.com>
Thu, 28 Jan 2016 15:21:57 +0000 (10:21 -0500)
committerMyles Borins <mborins@us.ibm.com>
Wed, 2 Mar 2016 22:01:11 +0000 (14:01 -0800)
This commit applies new arrow function linting rules across the
codebase. As it turns out, the only offenders were in the test
directory.

PR-URL: https://github.com/nodejs/node/pull/4813
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
test/common.js
test/parallel/test-assert.js
test/parallel/test-async-wrap-check-providers.js
test/parallel/test-cluster-disconnect-handles.js
test/parallel/test-debug-no-context.js
test/parallel/test-debug-port-cluster.js
test/parallel/test-net-socket-local-address.js
test/parallel/test-process-emit.js
test/parallel/test-repl-require.js
test/parallel/test-tls-no-sslv3.js

index b293a72..9e47a75 100644 (file)
@@ -503,7 +503,7 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) {
 // A stream to push an array into a REPL
 function ArrayStream() {
   this.run = function(data) {
-    data.forEach(line => {
+    data.forEach((line) => {
       this.emit('data', line + '\n');
     });
   };
index e9c01fd..46ce983 100644 (file)
@@ -481,7 +481,7 @@ testBlockTypeError(assert.throws, undefined);
 testBlockTypeError(assert.doesNotThrow, undefined);
 
 // https://github.com/nodejs/node/issues/3275
-assert.throws(() => { throw 'error'; }, err => err === 'error');
-assert.throws(() => { throw new Error(); }, err => err instanceof Error);
+assert.throws(() => { throw 'error'; }, (err) => err === 'error');
+assert.throws(() => { throw new Error(); }, (err) => err instanceof Error);
 
 console.log('All OK');
index 45dd8d4..38302be 100644 (file)
@@ -20,7 +20,7 @@ keyList.splice(0, 1);
 
 
 function init(id) {
-  keyList = keyList.filter(e => e != pkeys[id]);
+  keyList = keyList.filter((e) => e != pkeys[id]);
 }
 
 function noop() { }
index f35f101..0ae0a04 100644 (file)
@@ -31,7 +31,7 @@ if (cluster.isMaster) {
   // scanner but is ignored by atoi(3).  Heinous hack.
   cluster.setupMaster({ execArgv: [`--debug=${common.PORT}.`] });
   const worker = cluster.fork();
-  worker.on('message', common.mustCall(message => {
+  worker.on('message', common.mustCall((message) => {
     assert.strictEqual(Array.isArray(message), true);
     assert.strictEqual(message[0], 'listening');
     let continueRecv = false;
@@ -40,9 +40,9 @@ if (cluster.isMaster) {
     const debugClient = net.connect({ host, port: common.PORT });
     const protocol = new Protocol();
     debugClient.setEncoding('utf8');
-    debugClient.on('data', data => protocol.execute(data));
+    debugClient.on('data', (data) => protocol.execute(data));
     debugClient.once('connect', common.mustCall(() => {
-      protocol.onResponse = common.mustCall(res => {
+      protocol.onResponse = common.mustCall((res) => {
         protocol.onResponse = (res) => {
           // It can happen that the first continue was sent before the break
           // event was received. If that's the case, send also a continue from
@@ -85,7 +85,7 @@ if (cluster.isMaster) {
     throw ex;
   });
 } else {
-  const server = net.createServer(socket => socket.pipe(socket));
+  const server = net.createServer((socket) => socket.pipe(socket));
   const cb = () => {
     process.send(['listening', server.address()]);
     debugger;
index a143e67..11a9aa1 100644 (file)
@@ -17,7 +17,7 @@ proc.on('exit', common.mustCall((exitCode, signalCode) => {
 }));
 let stdout = '';
 proc.stdout.setEncoding('utf8');
-proc.stdout.on('data', data => stdout += data);
+proc.stdout.on('data', (data) => stdout += data);
 process.on('exit', () => {
   assert(stdout.includes('Promise { 42 }'));
   assert(stdout.includes('Promise { 1337 }'));
index 912f06d..05e1627 100644 (file)
@@ -15,7 +15,7 @@ const child = spawn(process.execPath, args);
 child.stderr.setEncoding('utf8');
 
 let stderr = '';
-child.stderr.on('data', data => {
+child.stderr.on('data', (data) => {
   stderr += data;
   if (child.killed !== true && stderr.includes('all workers are running'))
     child.kill();
index e0ef1ee..379bed3 100644 (file)
@@ -13,7 +13,7 @@ var conns = 0;
 var clientLocalPorts = [];
 var serverRemotePorts = [];
 const client = new net.Socket();
-const server = net.createServer(socket => {
+const server = net.createServer((socket) => {
   serverRemotePorts.push(socket.remotePort);
   socket.end();
 });
index 0e6d28b..ce7d441 100644 (file)
@@ -3,15 +3,15 @@ const common = require('../common');
 const assert = require('assert');
 const sym = Symbol();
 
-process.on('normal', common.mustCall(data => {
+process.on('normal', common.mustCall((data) => {
   assert.strictEqual(data, 'normalData');
 }));
 
-process.on(sym, common.mustCall(data => {
+process.on(sym, common.mustCall((data) => {
   assert.strictEqual(data, 'symbolData');
 }));
 
-process.on('SIGPIPE', common.mustCall(data => {
+process.on('SIGPIPE', common.mustCall((data) => {
   assert.strictEqual(data, 'signalData');
 }));
 
index e8e5e34..c964951 100644 (file)
@@ -7,7 +7,7 @@ const net = require('net');
 process.chdir(common.fixturesDir);
 const repl = require('repl');
 
-const server = net.createServer(conn => {
+const server = net.createServer((conn) => {
   repl.start('', conn).on('exit', () => {
     conn.destroy();
     server.close();
@@ -22,7 +22,7 @@ var answer = '';
 server.listen(options, function() {
   const conn = net.connect(options);
   conn.setEncoding('utf8');
-  conn.on('data', data => answer += data);
+  conn.on('data', (data) => answer += data);
   conn.write('require("baz")\n.exit\n');
 });
 
index 442fc3b..44a8b4e 100644 (file)
@@ -40,7 +40,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
   client.stdout.pipe(process.stdout);
   client.stderr.pipe(process.stderr);
   client.stderr.setEncoding('utf8');
-  client.stderr.on('data', data => stderr += data);
+  client.stderr.on('data', (data) => stderr += data);
 
   client.once('exit', common.mustCall(function(exitCode) {
     assert.equal(exitCode, 1);
@@ -48,7 +48,7 @@ server.listen(common.PORT, '127.0.0.1', function() {
   }));
 });
 
-server.on('clientError', err => errors.push(err));
+server.on('clientError', (err) => errors.push(err));
 
 process.on('exit', function() {
   if (/unknown option -ssl3/.test(stderr)) {