diff --git a/.eslintrc.js b/.eslintrc.js index c38a75a..02d96ef 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -9,6 +9,9 @@ module.exports = { ], rules: { 'no-shadow': 'error', - 'no-unused-vars': 'warn' + 'no-unused-vars': ['error', { + argsIgnorePattern: '^_', + caughtErrorsIgnorePattern: '^_' + }] } } diff --git a/lib/client/client.js b/lib/client/client.js index 67ed31b..d090cca 100644 --- a/lib/client/client.js +++ b/lib/client/client.js @@ -697,7 +697,7 @@ Client.prototype.starttls = function starttls (options, self._starttls = null callback(err) }) - emitter.on('end', function (res) { + emitter.on('end', function (_res) { const sock = self._socket /* * Unplumb socket data during SSL negotiation. @@ -938,7 +938,7 @@ Client.prototype.connect = function connect () { f(basicClient, callback) }, inputs: self.listeners('setup') - }, function (err, res) { + }, function (err, _res) { if (err) { self.emit('setupError', err) } @@ -1001,7 +1001,7 @@ Client.prototype.connect = function connect () { } retry.failAfter(failAfter) - retry.on('ready', function (num, delay) { + retry.on('ready', function (num, _delay) { if (self.destroyed) { // Cease connection attempts if destroyed return diff --git a/lib/client/search_pager.js b/lib/client/search_pager.js index 122ae79..d44f318 100644 --- a/lib/client/search_pager.js +++ b/lib/client/search_pager.js @@ -150,7 +150,7 @@ SearchPager.prototype._nextPage = function _nextPage (cookie) { /** * Callback provided to the client API for successful transmission. */ -SearchPager.prototype._sendCallback = function _sendCallback (err, res) { +SearchPager.prototype._sendCallback = function _sendCallback (err) { if (err) { this.finished = true if (!this.started) { diff --git a/lib/messages/abandon_response.js b/lib/messages/abandon_response.js index 27f0c7d..aa3fbc8 100644 --- a/lib/messages/abandon_response.js +++ b/lib/messages/abandon_response.js @@ -23,7 +23,7 @@ Object.defineProperties(AbandonResponse.prototype, { } }) -AbandonResponse.prototype.end = function (status) {} +AbandonResponse.prototype.end = function (_status) {} AbandonResponse.prototype._json = function (j) { return j diff --git a/lib/messages/search_entry.js b/lib/messages/search_entry.js index 21cabb8..036a663 100644 --- a/lib/messages/search_entry.js +++ b/lib/messages/search_entry.js @@ -54,7 +54,7 @@ Object.defineProperties(SearchEntry.prototype, { obj[a.type] = [] } }) - this.controls.forEach(function (element, index, array) { + this.controls.forEach(function (element) { obj.controls.push(element.json) }) return obj @@ -79,7 +79,7 @@ Object.defineProperties(SearchEntry.prototype, { obj[a.type] = [] } }) - this.controls.forEach(function (element, index, array) { + this.controls.forEach(function (element) { obj.controls.push(element.json) }) return obj diff --git a/lib/messages/unbind_response.js b/lib/messages/unbind_response.js index 77a4d39..3317984 100644 --- a/lib/messages/unbind_response.js +++ b/lib/messages/unbind_response.js @@ -31,9 +31,9 @@ Object.defineProperties(UnbindResponse.prototype, { /** * Special override that just ends the connection, if present. * - * @param {Number} status completely ignored. + * @param {Number} _status completely ignored. */ -UnbindResponse.prototype.end = function (status) { +UnbindResponse.prototype.end = function (_status) { assert.ok(this.connection) this.log.trace('%s: unbinding!', this.connection.ldap.id) diff --git a/lib/persistent_search.js b/lib/persistent_search.js index 620732e..db0ac3e 100644 --- a/lib/persistent_search.js +++ b/lib/persistent_search.js @@ -77,7 +77,7 @@ function getOperationType (requestType) { } } -function getEntryChangeNotificationControl (req, obj, callback) { +function getEntryChangeNotificationControl (req, obj) { // if we want to return a ECNC if (req.persistentSearch.value.returnECs) { const attrs = obj.attributes diff --git a/test-integration/client/issues.test.js b/test-integration/client/issues.test.js index 4abcc3b..1c52148 100644 --- a/test-integration/client/issues.test.js +++ b/test-integration/client/issues.test.js @@ -32,7 +32,7 @@ tap.test('modifyDN with long name (issue #480)', t => { client.modifyDN( `cn=${longStr},ou=people,dc=planetexpress,dc=com`, targetDN, - (err, res) => { + (err) => { t.error(err) client.unbind(t.end) } diff --git a/test/client.test.js b/test/client.test.js index fe7e97c..40a93ce 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -79,7 +79,7 @@ tap.beforeEach((done, t) => { }, 250) }) - server.search('dc=timeout', function (req, res, next) { + server.search('dc=timeout', function () { // Cause the client to timeout by not sending a response. }) @@ -721,13 +721,13 @@ tap.test('GH-602 search basic with delayed event listener binding', function (t) t.error(err) setTimeout(() => { let gotEntry = 0 - res.on('searchEntry', function (entry) { + res.on('searchEntry', function () { gotEntry++ }) res.on('error', function (err) { t.fail(err) }) - res.on('end', function (res) { + res.on('end', function () { t.equal(gotEntry, 2) t.end() }) @@ -751,7 +751,7 @@ tap.test('search sizeLimit', function (t) { t.context.client.search('cn=sizelimit', { sizeLimit: limit }, function (err, res) { t2.error(err) let count = 0 - res.on('searchEntry', function (entry) { + res.on('searchEntry', function () { count++ }) res.on('end', function () { @@ -991,7 +991,7 @@ tap.test('search - sssvlv', { timeout: 10000 }, function (t) { count++ }) res.on('error', (err) => t2.error(err)) - res.on('end', function (result) { + res.on('end', function () { t2.equals(count, 10) t2.end() }) @@ -1033,7 +1033,7 @@ tap.test('search - sssvlv', { timeout: 10000 }, function (t) { count++ }) res.on('error', (err) => t2.error(err)) - res.on('end', function (result) { + res.on('end', function () { t2.equals(count, 10) t2.end() }) @@ -1048,7 +1048,7 @@ tap.test('search referral', function (t) { t.ok(res) let gotEntry = 0 let gotReferral = false - res.on('searchEntry', function (entry) { + res.on('searchEntry', function () { gotEntry++ }) res.on('searchReference', function (referral) { @@ -1261,7 +1261,7 @@ tap.test('setup action', function (t) { socketPath: t.context.socketPath }) setupClient.on('setup', function (clt, cb) { - clt.bind(BIND_DN, BIND_PW, function (err, res) { + clt.bind(BIND_DN, BIND_PW, function (err) { t.error(err) cb(err) }) @@ -1283,7 +1283,7 @@ tap.test('setup reconnect', function (t) { reconnect: true }) rClient.on('setup', function (clt, cb) { - clt.bind(BIND_DN, BIND_PW, function (err, res) { + clt.bind(BIND_DN, BIND_PW, function (err) { t.error(err) cb(err) }) @@ -1402,7 +1402,7 @@ tap.test('reconnect on server close', function (t) { reconnect: true }) clt.on('setup', function (sclt, cb) { - sclt.bind(BIND_DN, BIND_PW, function (err, res) { + sclt.bind(BIND_DN, BIND_PW, function (err) { t.error(err) cb(err) }) @@ -1426,7 +1426,7 @@ tap.test('no auto-reconnect on unbind', function (t) { reconnect: true }) clt.on('setup', function (sclt, cb) { - sclt.bind(BIND_DN, BIND_PW, function (err, res) { + sclt.bind(BIND_DN, BIND_PW, function (err) { t.error(err) cb(err) }) diff --git a/test/laundry.test.js b/test/laundry.test.js index b55ddda..a16b448 100644 --- a/test/laundry.test.js +++ b/test/laundry.test.js @@ -34,7 +34,7 @@ tap.beforeEach((done, t) => { return next() }) - server.search(suffix, function (req, res, next) { + server.search(suffix, function (req, res) { const entry = { dn: 'cn=foo, ' + suffix, attributes: { diff --git a/test/server.test.js b/test/server.test.js index 74c5c1b..c7de4a5 100644 --- a/test/server.test.js +++ b/test/server.test.js @@ -121,7 +121,7 @@ tap.test('route order', function (t) { vasync.forEachParallel({ func: runSearch, inputs: [dnShort, dnMed, dnLong] - }, function (err, results) { + }, function (err) { t.error(err) client.unbind() server.close(() => t.end()) @@ -175,7 +175,7 @@ tap.test('route absent', function (t) { }) } ] - }, function (err, result) { + }, function (err) { t.notOk(err) server.close(() => t.end()) })