From 326c7a34829810f934ba8dd51d010ef03d619702 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Fri, 3 May 2024 14:15:15 -0700 Subject: [PATCH] fix(linting): no-unused-vars --- lib/content/read.js | 2 +- lib/content/write.js | 2 +- lib/entry-index.js | 2 +- lib/verify.js | 6 +++--- test/content/read.js | 6 +++--- test/entry-index.js | 6 +++--- test/rm.js | 2 +- test/verify.js | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/content/read.js b/lib/content/read.js index a1fa8a0..5f6192c 100644 --- a/lib/content/read.js +++ b/lib/content/read.js @@ -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) }) } diff --git a/lib/content/write.js b/lib/content/write.js index 09ca4e4..e7187ab 100644 --- a/lib/content/write.js +++ b/lib/content/write.js @@ -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)) { diff --git a/lib/entry-index.js b/lib/entry-index.js index 722a37a..5bc2189 100644 --- a/lib/entry-index.js +++ b/lib/entry-index.js @@ -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) { diff --git a/lib/verify.js b/lib/verify.js index 62e85c9..d7423da 100644 --- a/lib/verify.js +++ b/lib/verify.js @@ -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() } } @@ -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. diff --git a/test/content/read.js b/test/content/read.js index 7ba83f2..5b103f0 100644 --- a/test/content/read.js +++ b/test/content/read.js @@ -26,7 +26,7 @@ const getReadStatFailure = (t, err) => getRead(t, { }, 'fs/promises': { ...fs.promises, - stat: async (path) => { + stat: async () => { throw err }, }, @@ -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 }, }, @@ -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 } }, }, diff --git a/test/entry-index.js b/test/entry-index.js index 744b2ea..07a5fab 100644 --- a/test/entry-index.js +++ b/test/entry-index.js @@ -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 }, }, @@ -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' }, }), @@ -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 }, }, diff --git a/test/rm.js b/test/rm.js index 783bf83..0593ea0 100644 --- a/test/rm.js +++ b/test/rm.js @@ -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) => { diff --git a/test/verify.js b/test/verify.js index a3f8333..72627e3 100644 --- a/test/verify.js +++ b/test/verify.js @@ -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 }, }), @@ -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 }, }),