chore(lint): fix no-unused-vars errors

This commit is contained in:
Tony Brix 2020-12-06 19:26:27 -06:00
parent 237d1ec471
commit de9926a329
11 changed files with 29 additions and 26 deletions

View File

@ -9,6 +9,9 @@ module.exports = {
], ],
rules: { rules: {
'no-shadow': 'error', 'no-shadow': 'error',
'no-unused-vars': 'warn' 'no-unused-vars': ['error', {
argsIgnorePattern: '^_',
caughtErrorsIgnorePattern: '^_'
}]
} }
} }

View File

@ -697,7 +697,7 @@ Client.prototype.starttls = function starttls (options,
self._starttls = null self._starttls = null
callback(err) callback(err)
}) })
emitter.on('end', function (res) { emitter.on('end', function (_res) {
const sock = self._socket const sock = self._socket
/* /*
* Unplumb socket data during SSL negotiation. * Unplumb socket data during SSL negotiation.
@ -938,7 +938,7 @@ Client.prototype.connect = function connect () {
f(basicClient, callback) f(basicClient, callback)
}, },
inputs: self.listeners('setup') inputs: self.listeners('setup')
}, function (err, res) { }, function (err, _res) {
if (err) { if (err) {
self.emit('setupError', err) self.emit('setupError', err)
} }
@ -1001,7 +1001,7 @@ Client.prototype.connect = function connect () {
} }
retry.failAfter(failAfter) retry.failAfter(failAfter)
retry.on('ready', function (num, delay) { retry.on('ready', function (num, _delay) {
if (self.destroyed) { if (self.destroyed) {
// Cease connection attempts if destroyed // Cease connection attempts if destroyed
return return

View File

@ -150,7 +150,7 @@ SearchPager.prototype._nextPage = function _nextPage (cookie) {
/** /**
* Callback provided to the client API for successful transmission. * Callback provided to the client API for successful transmission.
*/ */
SearchPager.prototype._sendCallback = function _sendCallback (err, res) { SearchPager.prototype._sendCallback = function _sendCallback (err) {
if (err) { if (err) {
this.finished = true this.finished = true
if (!this.started) { if (!this.started) {

View File

@ -23,7 +23,7 @@ Object.defineProperties(AbandonResponse.prototype, {
} }
}) })
AbandonResponse.prototype.end = function (status) {} AbandonResponse.prototype.end = function (_status) {}
AbandonResponse.prototype._json = function (j) { AbandonResponse.prototype._json = function (j) {
return j return j

View File

@ -54,7 +54,7 @@ Object.defineProperties(SearchEntry.prototype, {
obj[a.type] = [] obj[a.type] = []
} }
}) })
this.controls.forEach(function (element, index, array) { this.controls.forEach(function (element) {
obj.controls.push(element.json) obj.controls.push(element.json)
}) })
return obj return obj
@ -79,7 +79,7 @@ Object.defineProperties(SearchEntry.prototype, {
obj[a.type] = [] obj[a.type] = []
} }
}) })
this.controls.forEach(function (element, index, array) { this.controls.forEach(function (element) {
obj.controls.push(element.json) obj.controls.push(element.json)
}) })
return obj return obj

View File

@ -31,9 +31,9 @@ Object.defineProperties(UnbindResponse.prototype, {
/** /**
* Special override that just ends the connection, if present. * 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) assert.ok(this.connection)
this.log.trace('%s: unbinding!', this.connection.ldap.id) this.log.trace('%s: unbinding!', this.connection.ldap.id)

View File

@ -77,7 +77,7 @@ function getOperationType (requestType) {
} }
} }
function getEntryChangeNotificationControl (req, obj, callback) { function getEntryChangeNotificationControl (req, obj) {
// if we want to return a ECNC // if we want to return a ECNC
if (req.persistentSearch.value.returnECs) { if (req.persistentSearch.value.returnECs) {
const attrs = obj.attributes const attrs = obj.attributes

View File

@ -32,7 +32,7 @@ tap.test('modifyDN with long name (issue #480)', t => {
client.modifyDN( client.modifyDN(
`cn=${longStr},ou=people,dc=planetexpress,dc=com`, `cn=${longStr},ou=people,dc=planetexpress,dc=com`,
targetDN, targetDN,
(err, res) => { (err) => {
t.error(err) t.error(err)
client.unbind(t.end) client.unbind(t.end)
} }

View File

@ -79,7 +79,7 @@ tap.beforeEach((done, t) => {
}, 250) }, 250)
}) })
server.search('dc=timeout', function (req, res, next) { server.search('dc=timeout', function () {
// Cause the client to timeout by not sending a response. // 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) t.error(err)
setTimeout(() => { setTimeout(() => {
let gotEntry = 0 let gotEntry = 0
res.on('searchEntry', function (entry) { res.on('searchEntry', function () {
gotEntry++ gotEntry++
}) })
res.on('error', function (err) { res.on('error', function (err) {
t.fail(err) t.fail(err)
}) })
res.on('end', function (res) { res.on('end', function () {
t.equal(gotEntry, 2) t.equal(gotEntry, 2)
t.end() t.end()
}) })
@ -751,7 +751,7 @@ tap.test('search sizeLimit', function (t) {
t.context.client.search('cn=sizelimit', { sizeLimit: limit }, function (err, res) { t.context.client.search('cn=sizelimit', { sizeLimit: limit }, function (err, res) {
t2.error(err) t2.error(err)
let count = 0 let count = 0
res.on('searchEntry', function (entry) { res.on('searchEntry', function () {
count++ count++
}) })
res.on('end', function () { res.on('end', function () {
@ -991,7 +991,7 @@ tap.test('search - sssvlv', { timeout: 10000 }, function (t) {
count++ count++
}) })
res.on('error', (err) => t2.error(err)) res.on('error', (err) => t2.error(err))
res.on('end', function (result) { res.on('end', function () {
t2.equals(count, 10) t2.equals(count, 10)
t2.end() t2.end()
}) })
@ -1033,7 +1033,7 @@ tap.test('search - sssvlv', { timeout: 10000 }, function (t) {
count++ count++
}) })
res.on('error', (err) => t2.error(err)) res.on('error', (err) => t2.error(err))
res.on('end', function (result) { res.on('end', function () {
t2.equals(count, 10) t2.equals(count, 10)
t2.end() t2.end()
}) })
@ -1048,7 +1048,7 @@ tap.test('search referral', function (t) {
t.ok(res) t.ok(res)
let gotEntry = 0 let gotEntry = 0
let gotReferral = false let gotReferral = false
res.on('searchEntry', function (entry) { res.on('searchEntry', function () {
gotEntry++ gotEntry++
}) })
res.on('searchReference', function (referral) { res.on('searchReference', function (referral) {
@ -1261,7 +1261,7 @@ tap.test('setup action', function (t) {
socketPath: t.context.socketPath socketPath: t.context.socketPath
}) })
setupClient.on('setup', function (clt, cb) { 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) t.error(err)
cb(err) cb(err)
}) })
@ -1283,7 +1283,7 @@ tap.test('setup reconnect', function (t) {
reconnect: true reconnect: true
}) })
rClient.on('setup', function (clt, cb) { 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) t.error(err)
cb(err) cb(err)
}) })
@ -1402,7 +1402,7 @@ tap.test('reconnect on server close', function (t) {
reconnect: true reconnect: true
}) })
clt.on('setup', function (sclt, cb) { 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) t.error(err)
cb(err) cb(err)
}) })
@ -1426,7 +1426,7 @@ tap.test('no auto-reconnect on unbind', function (t) {
reconnect: true reconnect: true
}) })
clt.on('setup', function (sclt, cb) { 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) t.error(err)
cb(err) cb(err)
}) })

View File

@ -34,7 +34,7 @@ tap.beforeEach((done, t) => {
return next() return next()
}) })
server.search(suffix, function (req, res, next) { server.search(suffix, function (req, res) {
const entry = { const entry = {
dn: 'cn=foo, ' + suffix, dn: 'cn=foo, ' + suffix,
attributes: { attributes: {

View File

@ -121,7 +121,7 @@ tap.test('route order', function (t) {
vasync.forEachParallel({ vasync.forEachParallel({
func: runSearch, func: runSearch,
inputs: [dnShort, dnMed, dnLong] inputs: [dnShort, dnMed, dnLong]
}, function (err, results) { }, function (err) {
t.error(err) t.error(err)
client.unbind() client.unbind()
server.close(() => t.end()) server.close(() => t.end())
@ -175,7 +175,7 @@ tap.test('route absent', function (t) {
}) })
} }
] ]
}, function (err, result) { }, function (err) {
t.notOk(err) t.notOk(err)
server.close(() => t.end()) server.close(() => t.end())
}) })