Skip to content

Commit

Permalink
fix: remove unused parameters catch statements (#7795)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea authored Oct 3, 2024
1 parent 977fd57 commit 534ad77
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions lib/commands/cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const searchCachePackage = async (path, parsed, cacheKeys) => {
try {
details = await cacache.get(path, key)
packument = jsonParse(details.data)
} catch (_) {
} catch {
// if we couldn't parse the packument, abort
continue
}
Expand Down Expand Up @@ -131,7 +131,7 @@ class Cache extends BaseCommand {
let entry
try {
entry = await cacache.get(cachePath, key)
} catch (err) {
} catch {
log.warn('cache', `Not Found: ${key}`)
break
}
Expand Down
10 changes: 5 additions & 5 deletions lib/commands/diff.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Diff extends BaseCommand {
try {
const { content: pkg } = await pkgJson.normalize(this.prefix)
name = pkg.name
} catch (e) {
} catch {
log.verbose('diff', 'could not read project dir package.json')
}

Expand Down Expand Up @@ -117,7 +117,7 @@ class Diff extends BaseCommand {
try {
const { content: pkg } = await pkgJson.normalize(this.prefix)
pkgName = pkg.name
} catch (e) {
} catch {
log.verbose('diff', 'could not read project dir package.json')
noPackageJson = true
}
Expand Down Expand Up @@ -156,7 +156,7 @@ class Diff extends BaseCommand {
node = actualTree &&
actualTree.inventory.query('name', spec.name)
.values().next().value
} catch (e) {
} catch {
log.verbose('diff', 'failed to load actual install tree')
}

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

Expand Down Expand Up @@ -265,7 +265,7 @@ class Diff extends BaseCommand {
}
const arb = new Arborist(opts)
actualTree = await arb.loadActual(opts)
} catch (e) {
} catch {
log.verbose('diff', 'failed to load actual install tree')
}

Expand Down
2 changes: 1 addition & 1 deletion lib/commands/dist-tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ class DistTag extends BaseCommand {
try {
output.standard(`${name}:`)
await this.list(npa(name), this.npm.flatOptions)
} catch (err) {
} catch {
// set the exitCode directly, but ignore the error
// since it will have already been logged by this.list()
process.exitCode = 1
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/doctor.js
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class Doctor extends BaseCommand {

try {
await access(f, mask)
} catch (er) {
} catch {
ok = false
const msg = `Missing permissions on ${f} (expect: ${maskLabel(mask)})`
log.error('doctor', 'checkFilesPermission', msg)
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/explain.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Explain extends ArboristWorkspaceCmd {
// otherwise, try to select all matching nodes
try {
return this.getNodesByVersion(tree, arg)
} catch (er) {
} catch {
return []
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class Init extends BaseCommand {
// top-level package.json
try {
statSync(resolve(workspacePath, 'package.json'))
} catch (err) {
} catch {
return
}

Expand Down
4 changes: 2 additions & 2 deletions lib/commands/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Install extends ArboristWorkspaceCmd {
const contents = await readdir(join(partialPath, sibling))
const result = (contents.indexOf('package.json') !== -1)
return result
} catch (er) {
} catch {
return false
}
}
Expand All @@ -86,7 +86,7 @@ class Install extends ArboristWorkspaceCmd {
}
// no matches
return []
} catch (er) {
} catch {
return [] // invalid dir: no matching
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/ls.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ const isGitNode = (node) => {
try {
const { type } = npa(node.resolved)
return type === 'git' || type === 'hosted'
} catch (err) {
} catch {
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/commands/repo.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const unknownHostedUrl = url => {
const proto = /(git\+)http:$/.test(protocol) ? 'http:' : 'https:'
const path = pathname.replace(/\.git$/, '')
return `${proto}//${hostname}${path}`
} catch (e) {
} catch {
return null
}
}
4 changes: 2 additions & 2 deletions lib/utils/sbom-cyclonedx.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const toCyclonedxItem = (node, { packageType }) => {
}

parsedLicense = parseLicense(license)
} catch (err) {
} catch {
parsedLicense = null
}

Expand Down Expand Up @@ -192,7 +192,7 @@ const isGitNode = (node) => {
try {
const { type } = npa(node.resolved)
return type === 'git' || type === 'hosted'
} catch (err) {
} catch {
/* istanbul ignore next */
return false
}
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/sbom-spdx.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ const isGitNode = (node) => {
try {
const { type } = npa(node.resolved)
return type === 'git' || type === 'hosted'
} catch (err) {
} catch {
/* istanbul ignore next */
return false
}
Expand Down

0 comments on commit 534ad77

Please sign in to comment.