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: {
'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
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

View File

@ -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) {

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) {
return j

View File

@ -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

View File

@ -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)

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 (req.persistentSearch.value.returnECs) {
const attrs = obj.attributes

View File

@ -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)
}

View File

@ -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)
})

View File

@ -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: {

View File

@ -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())
})