Skip to content

Commit

Permalink
fix(linting): no-unused-vars
Browse files Browse the repository at this point in the history
  • Loading branch information
wraithgar committed Apr 30, 2024
1 parent a661137 commit c31333f
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
6 changes: 3 additions & 3 deletions workspaces/arborist/lib/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ module.exports = cls => class IdealTreeBuilder extends cls {
}
const dir = resolve(nm, name)
const st = await lstat(dir)
.catch(/* istanbul ignore next */ er => null)
.catch(/* istanbul ignore next */ () => null)
if (st && st.isSymbolicLink()) {
const target = await readlink(dir)
const real = resolve(dirname(dir), target).replace(/#/g, '%23')
Expand Down Expand Up @@ -1024,7 +1024,7 @@ This is a one-time fix-up, please be patient...
for (const e of this.#problemEdges(placed)) {
promises.push(() =>
this.#fetchManifest(npa.resolve(e.name, e.spec, fromPath(placed, e)))
.catch(er => null)
.catch(() => null)
)
}
},
Expand Down Expand Up @@ -1273,7 +1273,7 @@ This is a one-time fix-up, please be patient...
})
}

#linkFromSpec (name, spec, parent, edge) {
#linkFromSpec (name, spec, parent) {
const realpath = spec.fetchSpec
const { installLinks, legacyPeerDeps } = this
return rpj(realpath + '/package.json').catch(() => ({})).then(pkg => {
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/lib/arborist/isolated-reifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ module.exports = cls => class IsolatedReifier extends cls {
return { edges, nodes }
}

async [_createIsolatedTree] (idealTree) {
async [_createIsolatedTree] () {
await this[_makeIdealGraph](this.options)

const proxiedIdealTree = this.idealGraph
Expand Down
4 changes: 2 additions & 2 deletions workspaces/arborist/lib/arborist/load-actual.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ module.exports = cls => class ActualLoader extends cls {
await this.#loadFSChildren(node.target)
return Promise.all(
[...node.target.children.entries()]
.filter(([name, kid]) => !did.has(kid.realpath))
.map(([name, kid]) => this.#loadFSTree(kid))
.filter(([, kid]) => !did.has(kid.realpath))
.map(([, kid]) => this.#loadFSTree(kid))
)
}
}
Expand Down
10 changes: 5 additions & 5 deletions workspaces/arborist/lib/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ module.exports = cls => class Reifier extends cls {
// this is currently technical debt which will be resolved in a refactor
// of Node/Link trees
log.warn('reify', 'The "linked" install strategy is EXPERIMENTAL and may contain bugs.')
this.idealTree = await this[_createIsolatedTree](this.idealTree)
this.idealTree = await this[_createIsolatedTree]()
}
await this[_diffTrees]()
await this[_reifyPackages]()
Expand Down Expand Up @@ -540,7 +540,7 @@ module.exports = cls => class Reifier extends cls {
.map(([from, to]) => this[_renamePath](to, from))
return promiseAllRejectLate(movePromises)
// ignore subsequent rollback errors
.catch(er => {})
.catch(() => {})
.then(timeEnd)
.then(() => {
throw er
Expand Down Expand Up @@ -608,7 +608,7 @@ module.exports = cls => class Reifier extends cls {
continue
}
dirsChecked.add(d)
const st = await lstat(d).catch(er => null)
const st = await lstat(d).catch(() => null)
// this can happen if we have a link to a package with a name
// that the filesystem treats as if it is the same thing.
// would be nice to have conditional istanbul ignores here...
Expand Down Expand Up @@ -779,7 +779,7 @@ module.exports = cls => class Reifier extends cls {
return
}
await debug(async () => {
const st = await lstat(node.path).catch(e => null)
const st = await lstat(node.path).catch(() => null)
if (st && !st.isDirectory()) {
debug.log('unpacking into a non-directory', node)
throw Object.assign(new Error('ENOTDIR: not a directory'), {
Expand Down Expand Up @@ -815,7 +815,7 @@ module.exports = cls => class Reifier extends cls {
// if the node is optional, then the failure of the promise is nonfatal
// just add it and its optional set to the trash list.
[_handleOptionalFailure] (node, p) {
return (node.optional ? p.catch(er => {
return (node.optional ? p.catch(() => {
const set = optionalSet(node)
for (node of set) {
log.verbose('reify', 'failed optional dependency', node.path)
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/lib/dep-valid.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const linkValid = (child, requested, requestor) => {
return isLink && relative(child.realpath, requested.fetchSpec) === ''
}

const tarballValid = (child, requested, requestor) => {
const tarballValid = (child, requested) => {
if (child.isLink) {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/lib/inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class Inventory extends Map {
return super.get(node.location) === node
}

set (k, v) {
set () {
throw new Error('direct set() not supported, use inventory.add(node)')
}
}
Expand Down
12 changes: 6 additions & 6 deletions workspaces/arborist/lib/query-selector-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,27 +650,27 @@ class Results {
// operators for attribute selectors
const attributeOperators = {
// attribute value is equivalent
'=' ({ attr, value, insensitive }) {
'=' ({ attr, value }) {
return attr === value
},
// attribute value contains word
'~=' ({ attr, value, insensitive }) {
'~=' ({ attr, value }) {
return (attr.match(/\w+/g) || []).includes(value)
},
// attribute value contains string
'*=' ({ attr, value, insensitive }) {
'*=' ({ attr, value }) {
return attr.includes(value)
},
// attribute value is equal or starts with
'|=' ({ attr, value, insensitive }) {
'|=' ({ attr, value }) {
return attr.startsWith(`${value}-`)
},
// attribute value starts with
'^=' ({ attr, value, insensitive }) {
'^=' ({ attr, value }) {
return attr.startsWith(value)
},
// attribute value ends with
'$=' ({ attr, value, insensitive }) {
'$=' ({ attr, value }) {
return attr.endsWith(value)
},
}
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/test/arborist/build-ideal-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ t.test('fail on malformed package.json', t => {
)
})

t.test('ignore mismatched engine for optional dependencies', async t => {
t.test('ignore mismatched engine for optional dependencies', async () => {
const path = resolve(fixtures, 'optional-engine-specification')
await buildIdeal(path, {
...OPT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const rpj = require('read-package-json-fast')
const t = require('tap')
const rpjMock = Object.assign((...args) => rpj(...args), {
...rpj,
normalize: (...args) => {
normalize: () => {
throw new Error('boom')
},
})
Expand Down
2 changes: 1 addition & 1 deletion workspaces/arborist/test/arborist/rebuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ t.test('rebuild node-gyp dependencies lacking both preinstall and install script
t.test('do not rebuild node-gyp dependencies with gypfile:false', async t => {
// use require-inject so we don't need an actual massive binary dep fixture
const Arborist = t.mock('../../lib/arborist/index.js', {
'@npmcli/run-script': async opts => {
'@npmcli/run-script': async () => {
throw new Error('should not run any scripts')
},
})
Expand Down
6 changes: 3 additions & 3 deletions workspaces/arborist/test/arborist/reify.js
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ t.test('rollbacks', { buffered: false }, t => {
const check = warningTracker()
return t.rejects(a.reify({
update: ['@isaacs/testing-bundledeps-parent'],
}).then(tree => 'it worked'), new Error('poop'))
}).then(() => 'it worked'), new Error('poop'))
// eslint-disable-next-line promise/always-return
.then(() => {
const warnings = check()
Expand Down Expand Up @@ -843,7 +843,7 @@ t.test('rollbacks', { buffered: false }, t => {
a[kLoadBundles] = (depth, bundlesByDepth) => {
const kRN = Symbol.for('reifyNode')
const reifyNode = a[kRN]
a[kRN] = node => {
a[kRN] = () => {
a[kRN] = reifyNode
return Promise.reject(new Error('poop'))
}
Expand All @@ -861,7 +861,7 @@ t.test('rollbacks', { buffered: false }, t => {
a[kUnpack] = () => {
const kReify = Symbol.for('reifyNode')
const reifyNode = a[kReify]
a[kReify] = node => {
a[kReify] = () => {
a[kReify] = reifyNode
return Promise.reject(new Error('poop'))
}
Expand Down

0 comments on commit c31333f

Please sign in to comment.