diff --git a/completion/plugin-commands-completion/src/complete.ts b/completion/plugin-commands-completion/src/complete.ts index b2058d81e5f..3243fd24b29 100644 --- a/completion/plugin-commands-completion/src/complete.ts +++ b/completion/plugin-commands-completion/src/complete.ts @@ -66,7 +66,7 @@ export async function complete ( } else if (ctx.completionByCommandName[input.cmd]) { try { completions = await ctx.completionByCommandName[input.cmd](input.options, input.params) - } catch (err) { + } catch { // Ignore } } diff --git a/config/config/src/index.ts b/config/config/src/index.ts index ef3507ae823..c0e9e87ea06 100644 --- a/config/config/src/index.ts +++ b/config/config/src/index.ts @@ -105,7 +105,7 @@ export async function getConfig (opts: { if (node.toUpperCase() !== process.execPath.toUpperCase()) { process.execPath = node } - } catch (err) { } // eslint-disable-line:no-empty + } catch { } // eslint-disable-line:no-empty if (cliOptions.dir) { cliOptions.dir = await realpathMissing(cliOptions.dir) diff --git a/config/config/src/readLocalConfig.ts b/config/config/src/readLocalConfig.ts index 397ce56c651..c96bcc9cf6c 100644 --- a/config/config/src/readLocalConfig.ts +++ b/config/config/src/readLocalConfig.ts @@ -21,9 +21,7 @@ export async function readLocalConfig (prefix: string): Promise { if (typeof val === 'string') { try { config[envReplace(key, process.env)] = envReplace(val, process.env) - } catch (err) { - // ignore - } + } catch {} } } return config diff --git a/env/plugin-commands-env/src/utils.ts b/env/plugin-commands-env/src/utils.ts index ad0660e1868..bf888a4b46d 100644 --- a/env/plugin-commands-env/src/utils.ts +++ b/env/plugin-commands-env/src/utils.ts @@ -9,7 +9,7 @@ export async function getNodeExecPathAndTargetDir (pnpmHomeDir: string): Promise let nodeCurrentDir: string | undefined try { nodeCurrentDir = await fs.readlink(nodeCurrentDirLink) - } catch (err) { + } catch { nodeCurrentDir = undefined } return { nodePath, nodeLink: nodeCurrentDir ? getNodeExecPathInNodeDir(nodeCurrentDir) : undefined } diff --git a/exec/plugin-commands-script-runners/src/exec.ts b/exec/plugin-commands-script-runners/src/exec.ts index 00cd7ccd48c..3e2cf44921e 100644 --- a/exec/plugin-commands-script-runners/src/exec.ts +++ b/exec/plugin-commands-script-runners/src/exec.ts @@ -348,7 +348,7 @@ async function createExecCommandNotFoundHint ( let nearestScript: string | null | undefined try { nearestScript = getNearestScript(programName, (await readProjectManifestOnly(opts.dir)).scripts) - } catch (_err) {} + } catch {} if (nearestScript) { return `Did you mean "pnpm ${nearestScript}"?` } diff --git a/fetching/git-fetcher/src/index.ts b/fetching/git-fetcher/src/index.ts index fded5d9a498..ff47c214d62 100644 --- a/fetching/git-fetcher/src/index.ts +++ b/fetching/git-fetcher/src/index.ts @@ -75,7 +75,7 @@ function shouldUseShallow (repoUrl: string, allowedHosts: Set): boolean if (allowedHosts.has(host)) { return true } - } catch (e) { + } catch { // URL might be malformed } return false diff --git a/pkg-manager/core/test/install/hoist.ts b/pkg-manager/core/test/install/hoist.ts index 19ea9b8d085..9788d99c818 100644 --- a/pkg-manager/core/test/install/hoist.ts +++ b/pkg-manager/core/test/install/hoist.ts @@ -268,7 +268,7 @@ test('should remove aliased hoisted dependencies', async () => { try { await resolveLinkTarget('./node_modules/dep') throw new Error('should have failed') - } catch (e) {} + } catch {} const modules = project.readModulesManifest() expect(modules).toBeTruthy() diff --git a/pkg-manager/hoist/src/index.ts b/pkg-manager/hoist/src/index.ts index 1155bebb3e8..757bdc52b8d 100644 --- a/pkg-manager/hoist/src/index.ts +++ b/pkg-manager/hoist/src/index.ts @@ -294,7 +294,7 @@ async function symlinkHoistedDependency ( let existingSymlink!: string try { existingSymlink = await resolveLinkTarget(dest) - } catch (err) { + } catch { hoistLogger.debug({ skipped: dest, reason: 'a directory is present at the target location', diff --git a/pkg-manager/package-requester/src/equalOrSemverEqual.ts b/pkg-manager/package-requester/src/equalOrSemverEqual.ts index 6dc4ce6357f..a6a329b16c3 100644 --- a/pkg-manager/package-requester/src/equalOrSemverEqual.ts +++ b/pkg-manager/package-requester/src/equalOrSemverEqual.ts @@ -4,7 +4,7 @@ export function equalOrSemverEqual (version1: string, version2: string): boolean if (version1 === version2) return true try { return semver.eq(version1, version2, { loose: true }) - } catch (err) { + } catch { return false } } diff --git a/pnpm/artifacts/exe/scripts/build-artifacts.ts b/pnpm/artifacts/exe/scripts/build-artifacts.ts index 58a7390038b..2fc812cf8a9 100644 --- a/pnpm/artifacts/exe/scripts/build-artifacts.ts +++ b/pnpm/artifacts/exe/scripts/build-artifacts.ts @@ -11,7 +11,7 @@ function build (target: string) { } try { fs.unlinkSync(artifactFile) - } catch (err) {} + } catch {} execa.sync('pkg', ['../../dist/pnpm.cjs', `--config=../../package-${target}.json`], { cwd: path.join(__dirname, '..'), stdio: 'inherit', diff --git a/pnpm/src/checkForUpdates.ts b/pnpm/src/checkForUpdates.ts index da725352a11..841c408e6f3 100644 --- a/pnpm/src/checkForUpdates.ts +++ b/pnpm/src/checkForUpdates.ts @@ -18,7 +18,7 @@ export async function checkForUpdates (config: Config): Promise { let state: State | undefined try { state = await loadJsonFile(stateFile) - } catch (err) {} + } catch {} if ( state?.lastUpdateCheck && diff --git a/pnpm/src/errorHandler.ts b/pnpm/src/errorHandler.ts index 3d2eb1a9a2e..c20f373e568 100644 --- a/pnpm/src/errorHandler.ts +++ b/pnpm/src/errorHandler.ts @@ -51,11 +51,11 @@ async function killProcesses (status: number): Promise { for (const pid of descendentProcesses) { try { process.kill(pid) - } catch (err) { + } catch { // ignore error here } } - } catch (err) { + } catch { // ignore error here } process.exit(status) diff --git a/pnpm/src/main.ts b/pnpm/src/main.ts index 778c1334772..0348a8f6505 100644 --- a/pnpm/src/main.ts +++ b/pnpm/src/main.ts @@ -182,7 +182,7 @@ export async function main (inputArgv: string[]): Promise { Target location: ${config.bin} `) } - } catch (err) { + } catch { // if pnpm not found, then ignore } } diff --git a/resolving/git-resolver/src/parsePref.ts b/resolving/git-resolver/src/parsePref.ts index 22a338ca65c..e0949537bda 100644 --- a/resolving/git-resolver/src/parsePref.ts +++ b/resolving/git-resolver/src/parsePref.ts @@ -102,7 +102,7 @@ async function fromHostedGit (hosted: any): Promise { // esli if (response.ok) { fetchSpec = httpsUrl } - } catch (e) { + } catch { // ignore } } @@ -130,7 +130,7 @@ async function isRepoPublic (httpsUrl: string): Promise { try { const response = await fetch(httpsUrl.replace(/\.git$/, ''), { method: 'HEAD', follow: 0, retry: { retries: 0 } }) return response.ok - } catch (_err) { + } catch { return false } } @@ -139,7 +139,7 @@ async function accessRepository (repository: string): Promise { try { await git(['ls-remote', '--exit-code', repository, 'HEAD'], { retries: 0 }) return true - } catch (err: any) { // eslint-disable-line + } catch { // eslint-disable-line return false } } diff --git a/store/server/test/index.ts b/store/server/test/index.ts index f3567ca98a4..f781bcb7851 100644 --- a/store/server/test/index.ts +++ b/store/server/test/index.ts @@ -202,7 +202,7 @@ test('disable server upload', async () => { sideEffectsCacheKey: fakeEngine, filesIndexFile, }) - } catch (e) { + } catch { thrown = true } expect(thrown).toBeTruthy() diff --git a/store/store-path/src/index.ts b/store/store-path/src/index.ts index 6b6b02b954b..179647b215e 100644 --- a/store/store-path/src/index.ts +++ b/store/store-path/src/index.ts @@ -68,7 +68,7 @@ async function storePathRelativeToHome (pkgRoot: string, relStore: string, homed return storeInHomeDir } return path.join(mountpoint, '.pnpm-store', STORE_VERSION) - } catch (err) { + } catch { // this is an unlikely situation but if there is no way to find // a linkable place on the disk, create the store in homedir return storeInHomeDir @@ -83,7 +83,7 @@ async function canLinkToSubdir (fileToLink: string, dir: string): Promise { // sometimes might not remove the temporary file in time // and fs.rmdir can only remove an empty directory. await rimraf(dir) - } catch (err) { + } catch { // ignore } } diff --git a/workspace/find-workspace-dir/test/index.ts b/workspace/find-workspace-dir/test/index.ts index 9dd62b83806..acd11a941b1 100644 --- a/workspace/find-workspace-dir/test/index.ts +++ b/workspace/find-workspace-dir/test/index.ts @@ -10,7 +10,7 @@ function isFileSystemCaseSensitive () { try { fs.realpathSync.native(process.cwd().toUpperCase()) return false - } catch (_) { + } catch { return true } }