diff --git a/components/git/land.js b/components/git/land.js index efa0fae2..a8e29f95 100644 --- a/components/git/land.js +++ b/components/git/land.js @@ -181,7 +181,7 @@ async function main(state, argv, cli, dir) { } try { session.restore(); - } catch (err) { // JSON error? + } catch { // JSON error? if (state === ABORT) { await session.abort(); return; diff --git a/eslint.config.js b/eslint.config.js index 890d83b4..828a8af6 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -39,6 +39,12 @@ export default [ { ignoreRegExpLiterals: true, ignoreUrls: true }, ], '@stylistic/object-property-newline': 'off', + 'no-unused-vars': ['error', { + args: 'none', + caughtErrors: 'all', + ignoreRestSiblings: true, + vars: 'all', + }], 'promise/always-return': ['error', { ignoreLastCallback: true }], 'n/no-process-exit': 'off', 'n/no-unsupported-features/node-builtins': 'off', diff --git a/lib/auth.js b/lib/auth.js index 41f7d0a9..f4dde3c0 100644 --- a/lib/auth.js +++ b/lib/auth.js @@ -76,7 +76,7 @@ async function auth( let token; try { ({ username, token } = getMergedConfig()); - } catch (e) { + } catch { // Ignore error and prompt } @@ -127,7 +127,7 @@ async function auth( let token; try { token = await encryptValue(credentials.token); - } catch (err) { + } catch { console.warn('Failed encrypt token, storing unencrypted instead'); token = credentials.token; } diff --git a/lib/backport_session.js b/lib/backport_session.js index 9b611e51..c8a112e2 100644 --- a/lib/backport_session.js +++ b/lib/backport_session.js @@ -27,7 +27,7 @@ export default class BackportSession extends Session { logs = runSync('git', ['log', `-${num}`, '--format=%h', rev, '--', file] ).trim(); - } catch (e) { + } catch { return null; } if (!logs) { @@ -282,7 +282,7 @@ export default class BackportSession extends Session { ['rev-parse', '--verify', '--quiet', branch] ); return true; - } catch (e) { + } catch { return false; } } diff --git a/lib/ci/run_ci.js b/lib/ci/run_ci.js index b8fbc848..dc6c81ee 100644 --- a/lib/ci/run_ci.js +++ b/lib/ci/run_ci.js @@ -38,7 +38,7 @@ export class RunPRJob { try { const { crumb } = await this.request.json(CI_CRUMB_URL); return crumb; - } catch (e) { + } catch { return false; } } diff --git a/lib/landing_session.js b/lib/landing_session.js index a509db8d..d0366af2 100644 --- a/lib/landing_session.js +++ b/lib/landing_session.js @@ -286,7 +286,7 @@ export default class LandingSession extends Session { } }); return this.final(); - } catch (e) { + } catch { await runAsync('git', ['rebase', '--abort']); const count = subjects.length; cli.log(`Couldn't rebase ${count} commits in the PR automatically`); diff --git a/lib/prepare_security.js b/lib/prepare_security.js index 0917a86c..9d033643 100644 --- a/lib/prepare_security.js +++ b/lib/prepare_security.js @@ -309,7 +309,7 @@ export default class PrepareSecurityRelease extends SecurityRelease { return body.substring(index); } return body; - } catch (error) { + } catch { this.cli.error(`Could not retrieve the security issue template from ${url}`); } } diff --git a/lib/security-release/security-release.js b/lib/security-release/security-release.js index f20d75f4..b663ad90 100644 --- a/lib/security-release/security-release.js +++ b/lib/security-release/security-release.js @@ -121,7 +121,7 @@ export async function commitAndPushVulnerabilitiesJSON( ['push', '-u', 'origin', NEXT_SECURITY_RELEASE_BRANCH], `This pushes the security release branch to origin/${NEXT_SECURITY_RELEASE_BRANCH}.` ); - } catch (error) { + } catch { cli.warn('Rebasing...'); // try to pull rebase and push again await runSecurityGitCommand( diff --git a/lib/security_blog.js b/lib/security_blog.js index ff173746..c4a01efc 100644 --- a/lib/security_blog.js +++ b/lib/security_blog.js @@ -362,7 +362,7 @@ export default class SecurityBlog extends SecurityRelease { const date = await this.promptAnnouncementDate(cli); validateDate(date); return new Date(date).toISOString(); - } catch (error) { + } catch { return PLACEHOLDERS.annoucementDate; } } diff --git a/lib/session.js b/lib/session.js index 20358c7a..cc71ba6b 100644 --- a/lib/session.js +++ b/lib/session.js @@ -160,7 +160,7 @@ export default class Session { let sess; try { sess = this.session; - } catch (err) { + } catch { return fs.rmSync(this.sessionPath, { recursive: true, force: true }); } diff --git a/lib/update-v8/backport.js b/lib/update-v8/backport.js index ea76b07a..77102b6e 100644 --- a/lib/update-v8/backport.js +++ b/lib/update-v8/backport.js @@ -261,7 +261,7 @@ async function applyPatch(ctx, task, patch, method = 'apply') { ['-p1', '--3way', '--directory=deps/v8'], patch.data /* input */ ); - } catch (e) { + } catch { patch.hadConflicts = true; return task.prompt(ListrEnquirerPromptAdapter).run({ type: 'input', diff --git a/lib/update-v8/common.js b/lib/update-v8/common.js index 2a8b1d1d..adc8f908 100644 --- a/lib/update-v8/common.js +++ b/lib/update-v8/common.js @@ -46,7 +46,7 @@ export async function checkCwd(ctx) { isNode = true; ctx.nodeMajorVersion = parseInt(match[1], 10); } - } catch (e) { + } catch { // ignore } if (!isNode) { diff --git a/lib/update-v8/majorUpdate.js b/lib/update-v8/majorUpdate.js index 18371f35..12da6f3e 100644 --- a/lib/update-v8/majorUpdate.js +++ b/lib/update-v8/majorUpdate.js @@ -58,7 +58,7 @@ function checkoutBranch() { ctx.newVersion = version.split('.').map((s) => parseInt(s, 10)); try { await ctx.execGitV8('branch', '-D', ctx.branch); - } catch (e) { + } catch { // ignore } await ctx.execGitV8('branch', ctx.branch, `origin/${ctx.branch}`); diff --git a/lib/update_security_release.js b/lib/update_security_release.js index 9690766d..5fd6db89 100644 --- a/lib/update_security_release.js +++ b/lib/update_security_release.js @@ -66,7 +66,7 @@ export default class UpdateSecurityRelease extends SecurityRelease { try { validateDate(releaseDate); - } catch (error) { + } catch { cli.error('Invalid date format. Please use the format yyyy/mm/dd.'); process.exit(1); } @@ -350,7 +350,7 @@ export default class UpdateSecurityRelease extends SecurityRelease { h1Report.data.relationships.severity?.data.attributes.cvss_vector_string, rating: h1Report.data.relationships.severity?.data.attributes.rating }; - } catch (error) { + } catch { this.cli.error(`Couldnt not retrieve severity from report ${id}, skipping...`); return false; }