From ef5cb129ae8c68395eb6debde443f99a2c71c7bf Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 9 Sep 2016 17:13:41 -0700 Subject: [PATCH] tools: fix new-parens violations PR-URL: https://github.com/nodejs/node/pull/8478 Reviewed-By: James M Snell --- lib/internal/child_process.js | 2 +- test/parallel/test-timer-close.js | 2 +- test/parallel/test-util-inspect.js | 2 +- test/parallel/test-util.js | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index f2d961ee068a8c..f79657048cc489 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -430,7 +430,7 @@ function setupChannel(target, channel) { this.emit('unref'); } } - }; + }(); var decoder = new StringDecoder('utf8'); var jsonBuffer = ''; diff --git a/test/parallel/test-timer-close.js b/test/parallel/test-timer-close.js index 9eb70041eb4b97..f13078e5a5bed1 100644 --- a/test/parallel/test-timer-close.js +++ b/test/parallel/test-timer-close.js @@ -2,7 +2,7 @@ require('../common'); var assert = require('assert'); -var t = new (process.binding('timer_wrap').Timer); +var t = new (process.binding('timer_wrap').Timer)(); var called = 0; function onclose() { called++; diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 15a444fdab648e..3becf5b318d0a9 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -792,7 +792,7 @@ checkAlignment(new Map(big_array.map(function(y) { return [y, null]; }))); } { - const x = new function() {}; + const x = new function() {}; // eslint-disable-line new-parens assert.strictEqual(util.inspect(x), '{}'); } diff --git a/test/parallel/test-util.js b/test/parallel/test-util.js index 09ce08331a9b96..023583ca4c7e7d 100644 --- a/test/parallel/test-util.js +++ b/test/parallel/test-util.js @@ -30,6 +30,7 @@ assert.equal(false, util.isRegExp(Object.create(RegExp.prototype))); // isDate assert.equal(true, util.isDate(new Date())); assert.equal(true, util.isDate(new Date(0))); +// eslint-disable-next-line new-parens assert.equal(true, util.isDate(new (context('Date')))); assert.equal(false, util.isDate(Date())); assert.equal(false, util.isDate({})); @@ -41,9 +42,11 @@ assert.equal(false, util.isDate(Object.create(Date.prototype))); assert.equal(true, util.isError(new Error())); assert.equal(true, util.isError(new TypeError())); assert.equal(true, util.isError(new SyntaxError())); +/* eslint-disable new-parens */ assert.equal(true, util.isError(new (context('Error')))); assert.equal(true, util.isError(new (context('TypeError')))); assert.equal(true, util.isError(new (context('SyntaxError')))); +/* eslint-enable */ assert.equal(false, util.isError({})); assert.equal(false, util.isError({ name: 'Error', message: '' })); assert.equal(false, util.isError([]));