From d62961ad74783e5acbb1f000636cdeaca6dbd0a7 Mon Sep 17 00:00:00 2001 From: Mark Date: Tue, 23 Aug 2016 12:21:21 -0400 Subject: [PATCH] Fix linting errors Also fix a bug in test helpers in which `util` was not required. --- lib/html-to-dom-client.js | 3 ++- test/helpers.js | 4 ++-- test/helpers/index.js | 1 + test/utilities.js | 8 ++++---- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lib/html-to-dom-client.js b/lib/html-to-dom-client.js index 2ead30e0..f6ed615d 100644 --- a/lib/html-to-dom-client.js +++ b/lib/html-to-dom-client.js @@ -43,7 +43,8 @@ function formatDOM(nodes, parentNode) { }; // set the next node for the previous node (if applicable) - if (prevNode = result[i - 1]) { + prevNode = result[i - 1]; + if (prevNode) { prevNode.next = nodeObj; } diff --git a/test/helpers.js b/test/helpers.js index ac21dba0..aa766877 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -30,9 +30,9 @@ describe('test helper', function() { var obj1; var obj2; - var obj1 = { foo: 'bar', baz: ['qux', 42, null], obj: {} }; + obj1 = { foo: 'bar', baz: ['qux', 42, null], obj: {} }; obj1.ref = obj1.obj; - var obj2 = { obj: {}, baz: ['qux', 42, null], foo: 'bar' }; + obj2 = { obj: {}, baz: ['qux', 42, null], foo: 'bar' }; obj2.ref = obj2.obj; deepEqualCircular(obj1, obj2); }); diff --git a/test/helpers/index.js b/test/helpers/index.js index d9905bea..e6cd4ba8 100644 --- a/test/helpers/index.js +++ b/test/helpers/index.js @@ -4,6 +4,7 @@ * Module dependencies. */ var assert = require('assert'); +var util = require('util'); /** * Test for deep equality between objects that have circular references. diff --git a/test/utilities.js b/test/utilities.js index 52c45387..c19bca18 100644 --- a/test/utilities.js +++ b/test/utilities.js @@ -30,7 +30,7 @@ describe('utilties', function() { [undefined, null, 1337, {}, []].forEach(function(parameter) { assert.throws(function() { camelCase(parameter); }); }); - }) + }); }); describe('`invertObject` helper', function() { @@ -40,7 +40,7 @@ describe('utilties', function() { [undefined, null, 'foo', 1337].forEach(function(parameter) { assert.throws(function() { invertObject(parameter); }); }); - }) + }); it('swaps key with value for object', function() { assert.deepEqual( @@ -67,7 +67,7 @@ describe('utilties', function() { it('uses override if valid', function() { assert.deepEqual( - invertObject({ foo: 'bar', baz: 'qux' }, function(key, value) { + invertObject({ foo: 'bar', baz: 'qux' }, function(key) { if (key === 'foo') { return ['key', 'value']; } @@ -78,7 +78,7 @@ describe('utilties', function() { it('does not use override if invalid', function() { assert.deepEqual( - invertObject({ foo: 'bar', baz: 'qux' }, function(key, value) { + invertObject({ foo: 'bar', baz: 'qux' }, function(key) { if (key === 'foo') { return ['key']; } else if (key === 'baz') {