Skip to content

Commit d679ce8

Browse files
committed
fix(linting): no-unused-vars
1 parent 2fba4b7 commit d679ce8

31 files changed

+51
-51
lines changed

bin/npx-cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const removed = new Set([
2626

2727
const { definitions, shorthands } = require('@npmcli/config/lib/definitions')
2828
const npmSwitches = Object.entries(definitions)
29-
.filter(([key, { type }]) => type === Boolean ||
29+
.filter(([, { type }]) => type === Boolean ||
3030
(Array.isArray(type) && type.includes(Boolean)))
3131
.map(([key]) => key)
3232

docs/lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ const replaceConfig = (src, { path }) => {
119119
}
120120

121121
const allConfig = Object.entries(definitions).sort(sort)
122-
.map(([_, def]) => def.describe())
122+
.map(([, def]) => def.describe())
123123
.join('\n\n')
124124

125125
return src.replace(replacer, allConfig)

lib/commands/adduser.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class AddUser extends BaseCommand {
1212
'auth-type',
1313
]
1414

15-
async exec (args) {
15+
async exec () {
1616
const scope = this.npm.config.get('scope')
1717
let registry = this.npm.config.get('registry')
1818

lib/commands/ci.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class CI extends ArboristWorkspaceCmd {
8181
await time.start('npm-ci:rm', async () => {
8282
const path = `${where}/node_modules`
8383
// get the list of entries so we can skip the glob for performance
84-
const entries = await fs.readdir(path, null).catch(er => [])
84+
const entries = await fs.readdir(path, null).catch(() => [])
8585
return Promise.all(entries.map(f => fs.rm(`${path}/${f}`,
8686
{ force: true, recursive: true })))
8787
})

lib/commands/completion.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ const configCompl = opts => {
248248

249249
// expand with the valid values of various config values.
250250
// not yet implemented.
251-
const configValueCompl = opts => []
251+
const configValueCompl = () => []
252252

253253
// check if the thing is a flag or not.
254254
const isFlag = word => {
@@ -265,7 +265,7 @@ const isFlag = word => {
265265

266266
// complete against the npm commands
267267
// if they all resolve to the same thing, just return the thing it already is
268-
const cmdCompl = (opts, npm) => {
268+
const cmdCompl = (opts) => {
269269
const allCommands = commands.concat(Object.keys(aliases))
270270
const matches = allCommands.filter(c => c.startsWith(opts.partialWord))
271271
if (!matches.length) {

lib/commands/dedupe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Dedupe extends ArboristWorkspaceCmd {
2121
...super.params,
2222
]
2323

24-
async exec (args) {
24+
async exec () {
2525
if (this.npm.global) {
2626
const er = new Error('`npm dedupe` does not work in global mode.')
2727
er.code = 'EDEDUPEGLOBAL'

lib/commands/diff.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class Diff extends BaseCommand {
7878

7979
// get the package name from the packument at `path`
8080
// throws if no packument is present OR if it does not have `name` attribute
81-
async packageName (path) {
81+
async packageName () {
8282
let name
8383
try {
8484
const { content: pkg } = await pkgJson.normalize(this.prefix)
@@ -103,7 +103,7 @@ class Diff extends BaseCommand {
103103
// no arguments, defaults to comparing cwd
104104
// to its latest published registry version
105105
if (!a) {
106-
const pkgName = await this.packageName(this.prefix)
106+
const pkgName = await this.packageName()
107107
return [
108108
`${pkgName}@${this.npm.config.get('tag')}`,
109109
`file:${this.prefix.replace(/#/g, '%23')}`,

lib/commands/doctor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ class Doctor extends BaseCommand {
254254
}
255255

256256
if (st.isDirectory()) {
257-
const entries = await readdir(f).catch(er => {
257+
const entries = await readdir(f).catch(() => {
258258
ok = false
259259
log.warn('doctor', 'checkFilesPermission', 'error reading directory ' + f)
260260
return []

lib/commands/find-dupes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class FindDupes extends ArboristWorkspaceCmd {
1919
...super.params,
2020
]
2121

22-
async exec (args) {
22+
async exec () {
2323
this.npm.config.set('dry-run', true)
2424
return this.npm.exec('dedupe', [])
2525
}

lib/commands/help-search.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class HelpSearch extends BaseCommand {
2222
// preserve glob@8 behavior
2323
files = files.sort((a, b) => a.localeCompare(b, 'en'))
2424
const data = await this.readFiles(files)
25-
const results = await this.searchFiles(args, data, files)
25+
const results = await this.searchFiles(args, data)
2626
const formatted = this.formatResults(args, results)
2727
if (!formatted.trim()) {
2828
output.standard(`No matches in help for: ${args.join(' ')}\n`)
@@ -40,7 +40,7 @@ class HelpSearch extends BaseCommand {
4040
return res
4141
}
4242

43-
async searchFiles (args, data, files) {
43+
async searchFiles (args, data) {
4444
const results = []
4545
for (const [file, content] of Object.entries(data)) {
4646
const lowerCase = content.toLowerCase()

lib/commands/login.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Login extends BaseCommand {
1212
'auth-type',
1313
]
1414

15-
async exec (args) {
15+
async exec () {
1616
const scope = this.npm.config.get('scope')
1717
let registry = this.npm.config.get('registry')
1818

lib/commands/logout.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Logout extends BaseCommand {
1111
'scope',
1212
]
1313

14-
async exec (args) {
14+
async exec () {
1515
const registry = this.npm.config.get('registry')
1616
const scope = this.npm.config.get('scope')
1717
const regRef = scope ? `${scope}:registry` : 'registry'

lib/commands/outdated.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class Outdated extends ArboristWorkspaceCmd {
160160
this.edges.add(edge)
161161
}
162162

163-
getWorkspacesEdges (node) {
163+
getWorkspacesEdges () {
164164
if (this.npm.global) {
165165
return
166166
}

lib/commands/ping.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Ping extends BaseCommand {
88
static params = ['registry']
99
static name = 'ping'
1010

11-
async exec (args) {
11+
async exec () {
1212
const cleanRegistry = redact(this.npm.config.get('registry'))
1313
log.notice('PING', cleanRegistry)
1414
const start = Date.now()

lib/commands/prefix.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Prefix extends BaseCommand {
77
static params = ['global']
88
static usage = ['[-g]']
99

10-
async exec (args) {
10+
async exec () {
1111
return output.standard(this.npm.prefix)
1212
}
1313
}

lib/commands/profile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ class Profile extends BaseCommand {
357357
}
358358
}
359359

360-
async disable2fa (args) {
360+
async disable2fa () {
361361
const conf = { ...this.npm.flatOptions }
362362
const info = await npmProfile.get(conf)
363363

lib/commands/publish.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ class Publish extends BaseCommand {
149149
return pkgContents
150150
}
151151

152-
async execWorkspaces (args) {
152+
async execWorkspaces () {
153153
// Suppresses JSON output in publish() so we can handle it here
154154
this.suppressOutput = true
155155

lib/commands/run-script.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class RunScript extends BaseCommand {
2424
const argv = opts.conf.argv.remain
2525
if (argv.length === 2) {
2626
const { content: { scripts = {} } } = await pkgJson.normalize(npm.localPrefix)
27-
.catch(er => ({ content: {} }))
27+
.catch(() => ({ content: {} }))
2828
if (opts.isFish) {
2929
return Object.keys(scripts).map(s => `${s}\t${scripts[s].slice(0, 30)}`)
3030
}
@@ -185,7 +185,7 @@ class RunScript extends BaseCommand {
185185
return allScripts
186186
}
187187

188-
async runWorkspaces (args, filters) {
188+
async runWorkspaces (args) {
189189
const res = []
190190
await this.setWorkspaces()
191191

@@ -205,7 +205,7 @@ class RunScript extends BaseCommand {
205205
}
206206
}
207207

208-
async listWorkspaces (args, filters) {
208+
async listWorkspaces (args) {
209209
await this.setWorkspaces()
210210

211211
if (this.npm.silent) {

lib/commands/token.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class Token extends BaseCommand {
125125
}
126126
}
127127

128-
async create (args) {
128+
async create () {
129129
const json = this.npm.config.get('json')
130130
const parseable = this.npm.config.get('parseable')
131131
const cidr = this.npm.config.get('cidr')

lib/commands/whoami.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Whoami extends BaseCommand {
77
static name = 'whoami'
88
static params = ['registry']
99

10-
async exec (args) {
10+
async exec () {
1111
const username = await getIdentity(this.npm, { ...this.npm.flatOptions })
1212
output.standard(
1313
this.npm.config.get('json') ? JSON.stringify(username) : username

lib/utils/auth.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const adduser = async (npm, { creds, ...opts }) => {
3636
// password, it's effectively a login, and if that account has otp you'll
3737
// be prompted for it.
3838
res = await otplease(npm, opts, (reqOpts) =>
39-
profile.adduserCouch(username, email, password, opts)
39+
profile.adduserCouch(username, email, password, reqOpts)
4040
)
4141
}
4242

lib/utils/explain-dep.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const explainLinksIn = ({ linksIn }, depth, chalk) => {
4444
return str.split('\n').join('\n ')
4545
}
4646

47-
const explainDependents = ({ name, dependents }, depth, chalk) => {
47+
const explainDependents = ({ dependents }, depth, chalk) => {
4848
if (!dependents || !dependents.length || depth <= 0) {
4949
return ''
5050
}

mock-registry/lib/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class MockRegistry {
225225
})
226226
}
227227

228-
webadduser ({ username, password, token = 'npm_default-test-token' }) {
228+
webadduser ({ token = 'npm_default-test-token' }) {
229229
const doneUrl = new URL('/npm-cli-test/done', this.origin).href
230230
const loginUrl = new URL('/npm-cli-test/login', this.origin).href
231231
this.nock = this.nock

test/lib/cli/exit-handler.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ t.test('log files fail to write', async (t) => {
388388
'{LIB}/utils/log-file.js': tmock(t, '{LIB}/utils/log-file.js', {
389389
'fs-minipass': {
390390
...fsMiniPass,
391-
WriteStreamSync: (file, ...rest) => {
391+
WriteStreamSync: (file) => {
392392
if (file.includes('LOGS_DIR')) {
393393
throw new Error('err')
394394
}

test/lib/commands/ci.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ t.test('--no-audit and --ignore-scripts', async t => {
142142
'package-lock.json': JSON.stringify(packageLock),
143143
},
144144
})
145-
require('nock').emitter.on('no match', req => {
145+
require('nock').emitter.on('no match', () => {
146146
t.fail('Should not audit')
147147
})
148148
const manifest = registry.manifest({ name: 'abbrev' })

test/lib/commands/profile.js

+14-14
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ t.test('enable-2fa', async t => {
540540

541541
t.test('from basic username/password auth', async t => {
542542
const npmProfile = {
543-
async createToken (pass) {
543+
async createToken () {
544544
return {}
545545
},
546546
}
@@ -587,7 +587,7 @@ t.test('enable-2fa', async t => {
587587
async get () {
588588
return userProfile
589589
},
590-
async set (newProfile, conf) {
590+
async set (newProfile) {
591591
t.match(
592592
newProfile,
593593
{
@@ -659,7 +659,7 @@ t.test('enable-2fa', async t => {
659659
},
660660
}
661661
},
662-
async set (newProfile, conf) {
662+
async set (newProfile) {
663663
setCount++
664664

665665
// when profile response shows that 2fa is pending the
@@ -747,7 +747,7 @@ t.test('enable-2fa', async t => {
747747
},
748748
}
749749
},
750-
async set (newProfile, conf) {
750+
async set () {
751751
return {
752752
...userProfile,
753753
tfa: 'http://foo?secret=1234',
@@ -759,7 +759,7 @@ t.test('enable-2fa', async t => {
759759
async password () {
760760
return 'password1234'
761761
},
762-
async otp (label) {
762+
async otp () {
763763
return '123456'
764764
},
765765
}
@@ -786,7 +786,7 @@ t.test('enable-2fa', async t => {
786786
async get () {
787787
return userProfile
788788
},
789-
async set (newProfile, conf) {
789+
async set () {
790790
return {
791791
...userProfile,
792792
tfa: null,
@@ -809,7 +809,7 @@ t.test('enable-2fa', async t => {
809809
config: { otp: '123456' },
810810
})
811811

812-
npm.config.getCredentialsByURI = reg => {
812+
npm.config.getCredentialsByURI = () => {
813813
return { token: 'token' }
814814
}
815815

@@ -830,7 +830,7 @@ t.test('enable-2fa', async t => {
830830
tfa: undefined,
831831
}
832832
},
833-
async set (newProfile, conf) {
833+
async set () {
834834
return {
835835
...userProfile,
836836
tfa: null,
@@ -852,7 +852,7 @@ t.test('enable-2fa', async t => {
852852
readUserInfo,
853853
})
854854

855-
npm.config.getCredentialsByURI = reg => {
855+
npm.config.getCredentialsByURI = () => {
856856
return { token: 'token' }
857857
}
858858

@@ -873,7 +873,7 @@ t.test('enable-2fa', async t => {
873873
tfa: undefined,
874874
}
875875
},
876-
async set (newProfile, conf) {
876+
async set () {
877877
return {
878878
...userProfile,
879879
tfa: null,
@@ -895,7 +895,7 @@ t.test('enable-2fa', async t => {
895895
readUserInfo,
896896
})
897897

898-
npm.config.getCredentialsByURI = reg => {
898+
npm.config.getCredentialsByURI = () => {
899899
return { token: 'token' }
900900
}
901901

@@ -933,7 +933,7 @@ t.test('disable-2fa', async t => {
933933
async get () {
934934
return userProfile
935935
},
936-
async set (newProfile, conf) {
936+
async set (newProfile) {
937937
t.same(
938938
newProfile,
939939
{
@@ -1014,7 +1014,7 @@ t.test('disable-2fa', async t => {
10141014
async get () {
10151015
return userProfile
10161016
},
1017-
async set (newProfile, conf) {
1017+
async set (newProfile) {
10181018
t.same(
10191019
newProfile,
10201020
{
@@ -1032,7 +1032,7 @@ t.test('disable-2fa', async t => {
10321032
async password () {
10331033
return 'password1234'
10341034
},
1035-
async otp (label) {
1035+
async otp () {
10361036
throw new Error('should not ask for otp')
10371037
},
10381038
}

0 commit comments

Comments
 (0)