Skip to content

Commit

Permalink
fix(linting): no-unused-vars
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed May 4, 2024
1 parent 4a66453 commit 326c7a3
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/content/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function readStream (cache, integrity, opts = {}) {
module.exports.copy = copy

function copy (cache, integrity, dest) {
return withContentSri(cache, integrity, (cpath, sri) => {
return withContentSri(cache, integrity, (cpath) => {
return fs.copyFile(cpath, dest)
})
}
Expand Down
2 changes: 1 addition & 1 deletion lib/content/write.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ async function makeTmp (cache, opts) {
}
}

async function moveToDestination (tmp, cache, sri, opts) {
async function moveToDestination (tmp, cache, sri) {
const destination = contentPath(cache, sri)
const destDir = path.dirname(destination)
if (moveOperations.has(destination)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/entry-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ async function bucketEntries (bucket, filter) {
return _bucketEntries(data, filter)
}

function _bucketEntries (data, filter) {
function _bucketEntries (data) {
const entries = []
data.split('\n').forEach((entry) => {
if (!entry) {
Expand Down
6 changes: 3 additions & 3 deletions lib/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ async function verify (cache, opts) {
return stats
}

async function markStartTime (cache, opts) {
async function markStartTime () {
return { startTime: new Date() }
}

async function markEndTime (cache, opts) {
async function markEndTime () {
return { endTime: new Date() }
}

Expand Down Expand Up @@ -213,7 +213,7 @@ async function rebuildIndex (cache, opts) {
return stats
}

async function rebuildBucket (cache, bucket, stats, opts) {
async function rebuildBucket (cache, bucket, stats) {
await truncate(bucket._path)
// This needs to be serialized because cacache explicitly
// lets very racy bucket conflicts clobber each other.
Expand Down
6 changes: 3 additions & 3 deletions test/content/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const getReadStatFailure = (t, err) => getRead(t, {
},
'fs/promises': {
...fs.promises,
stat: async (path) => {
stat: async () => {
throw err
},
},
Expand Down Expand Up @@ -153,7 +153,7 @@ t.test('read: error while parsing provided integrity data', function (t) {
const INTEGRITY = 'sha1-deadbeef'
const mockedRead = getRead(t, {
ssri: {
parse (sri) {
parse () {
throw genericError
},
},
Expand Down Expand Up @@ -221,7 +221,7 @@ t.test('read: opening large files', function (t) {
const mockedRead = getRead(t, {
'fs/promises': {
...fs.promises,
stat: async (path) => {
stat: async () => {
return { size: Number.MAX_SAFE_INTEGER }
},
},
Expand Down
6 changes: 3 additions & 3 deletions test/entry-index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const getEntryIndex = (t, opts) => t.mock('../lib/entry-index', opts)
const getEntryIndexReadFileFailure = (t, err) => getEntryIndex(t, {
'fs/promises': {
...fs.promises,
readFile: async (path, encode) => {
readFile: async () => {
throw err
},
},
Expand Down Expand Up @@ -177,7 +177,7 @@ t.test('find: error on parsing json data', (t) => {
// mocks readFile in order to return a borked json payload
const { find } = getEntryIndex(t, {
'@npmcli/fs': Object.assign({}, require('@npmcli/fs'), {
readFile: async (path, encode) => {
readFile: async () => {
return '\ncec8d2e4685534ed189b563c8ee1cb1cb7c72874\t{"""// foo'
},
}),
Expand Down Expand Up @@ -235,7 +235,7 @@ t.test('lsStream: unknown error reading dirs', (t) => {
const { lsStream } = getEntryIndex(t, {
'fs/promises': {
...fs.promises,
readdir: async (path) => {
readdir: async () => {
throw genericError
},
},
Expand Down
2 changes: 1 addition & 1 deletion test/rm.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ t.test('rm.content removes content, not entries', (t) => {
.then(() => {
return get(cache, KEY)
})
.then((res) => {
.then(() => {
throw new Error('unexpected success')
})
.catch((err) => {
Expand Down
4 changes: 2 additions & 2 deletions test/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ t.test('missing file error when validating cache content', async t => {
missingFileError.code = 'ENOENT'
const mockVerify = getVerify(t, {
'fs/promises': Object.assign({}, fs, {
stat: async (path) => {
stat: async () => {
throw missingFileError
},
}),
Expand All @@ -239,7 +239,7 @@ t.test('missing file error when validating cache content', async t => {
t.test('unknown error when validating content', async t => {
const mockVerify = getVerify(t, {
'fs/promises': Object.assign({}, fs, {
stat: async (path) => {
stat: async () => {
throw genericError
},
}),
Expand Down

0 comments on commit 326c7a3

Please sign in to comment.