Skip to content

Commit 534ad77

Browse files
authored
fix: remove unused parameters catch statements (#7795)
1 parent 977fd57 commit 534ad77

File tree

11 files changed

+18
-18
lines changed

11 files changed

+18
-18
lines changed

lib/commands/cache.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const searchCachePackage = async (path, parsed, cacheKeys) => {
3838
try {
3939
details = await cacache.get(path, key)
4040
packument = jsonParse(details.data)
41-
} catch (_) {
41+
} catch {
4242
// if we couldn't parse the packument, abort
4343
continue
4444
}
@@ -131,7 +131,7 @@ class Cache extends BaseCommand {
131131
let entry
132132
try {
133133
entry = await cacache.get(cachePath, key)
134-
} catch (err) {
134+
} catch {
135135
log.warn('cache', `Not Found: ${key}`)
136136
break
137137
}

lib/commands/diff.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class Diff extends BaseCommand {
8383
try {
8484
const { content: pkg } = await pkgJson.normalize(this.prefix)
8585
name = pkg.name
86-
} catch (e) {
86+
} catch {
8787
log.verbose('diff', 'could not read project dir package.json')
8888
}
8989

@@ -117,7 +117,7 @@ class Diff extends BaseCommand {
117117
try {
118118
const { content: pkg } = await pkgJson.normalize(this.prefix)
119119
pkgName = pkg.name
120-
} catch (e) {
120+
} catch {
121121
log.verbose('diff', 'could not read project dir package.json')
122122
noPackageJson = true
123123
}
@@ -156,7 +156,7 @@ class Diff extends BaseCommand {
156156
node = actualTree &&
157157
actualTree.inventory.query('name', spec.name)
158158
.values().next().value
159-
} catch (e) {
159+
} catch {
160160
log.verbose('diff', 'failed to load actual install tree')
161161
}
162162

@@ -230,7 +230,7 @@ class Diff extends BaseCommand {
230230
try {
231231
const { content: pkg } = await pkgJson.normalize(this.prefix)
232232
pkgName = pkg.name
233-
} catch (e) {
233+
} catch {
234234
log.verbose('diff', 'could not read project dir package.json')
235235
}
236236

@@ -265,7 +265,7 @@ class Diff extends BaseCommand {
265265
}
266266
const arb = new Arborist(opts)
267267
actualTree = await arb.loadActual(opts)
268-
} catch (e) {
268+
} catch {
269269
log.verbose('diff', 'failed to load actual install tree')
270270
}
271271

lib/commands/dist-tag.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ class DistTag extends BaseCommand {
182182
try {
183183
output.standard(`${name}:`)
184184
await this.list(npa(name), this.npm.flatOptions)
185-
} catch (err) {
185+
} catch {
186186
// set the exitCode directly, but ignore the error
187187
// since it will have already been logged by this.list()
188188
process.exitCode = 1

lib/commands/doctor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ class Doctor extends BaseCommand {
246246

247247
try {
248248
await access(f, mask)
249-
} catch (er) {
249+
} catch {
250250
ok = false
251251
const msg = `Missing permissions on ${f} (expect: ${maskLabel(mask)})`
252252
log.error('doctor', 'checkFilesPermission', msg)

lib/commands/explain.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class Explain extends ArboristWorkspaceCmd {
109109
// otherwise, try to select all matching nodes
110110
try {
111111
return this.getNodesByVersion(tree, arg)
112-
} catch (er) {
112+
} catch {
113113
return []
114114
}
115115
}

lib/commands/init.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class Init extends BaseCommand {
192192
// top-level package.json
193193
try {
194194
statSync(resolve(workspacePath, 'package.json'))
195-
} catch (err) {
195+
} catch {
196196
return
197197
}
198198

lib/commands/install.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class Install extends ArboristWorkspaceCmd {
6868
const contents = await readdir(join(partialPath, sibling))
6969
const result = (contents.indexOf('package.json') !== -1)
7070
return result
71-
} catch (er) {
71+
} catch {
7272
return false
7373
}
7474
}
@@ -86,7 +86,7 @@ class Install extends ArboristWorkspaceCmd {
8686
}
8787
// no matches
8888
return []
89-
} catch (er) {
89+
} catch {
9090
return [] // invalid dir: no matching
9191
}
9292
}

lib/commands/ls.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ const isGitNode = (node) => {
233233
try {
234234
const { type } = npa(node.resolved)
235235
return type === 'git' || type === 'hosted'
236-
} catch (err) {
236+
} catch {
237237
return false
238238
}
239239
}

lib/commands/repo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const unknownHostedUrl = url => {
4949
const proto = /(git\+)http:$/.test(protocol) ? 'http:' : 'https:'
5050
const path = pathname.replace(/\.git$/, '')
5151
return `${proto}//${hostname}${path}`
52-
} catch (e) {
52+
} catch {
5353
return null
5454
}
5555
}

lib/utils/sbom-cyclonedx.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ const toCyclonedxItem = (node, { packageType }) => {
9494
}
9595

9696
parsedLicense = parseLicense(license)
97-
} catch (err) {
97+
} catch {
9898
parsedLicense = null
9999
}
100100

@@ -192,7 +192,7 @@ const isGitNode = (node) => {
192192
try {
193193
const { type } = npa(node.resolved)
194194
return type === 'git' || type === 'hosted'
195-
} catch (err) {
195+
} catch {
196196
/* istanbul ignore next */
197197
return false
198198
}

lib/utils/sbom-spdx.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const isGitNode = (node) => {
173173
try {
174174
const { type } = npa(node.resolved)
175175
return type === 'git' || type === 'hosted'
176-
} catch (err) {
176+
} catch {
177177
/* istanbul ignore next */
178178
return false
179179
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy