From 60cb02f9ddd5e51650a4d938323659dc8f3b814d Mon Sep 17 00:00:00 2001 From: Yarmo Mackenbach Date: Fri, 21 Jun 2024 16:18:54 +0200 Subject: [PATCH] feat: apply eslint fixes --- src/api/v3/keyoxide_profile.js | 2 +- src/index.js | 10 ++++++++-- src/log.js | 4 ++-- src/server/openpgpProfiles.js | 2 +- src/server/utils.js | 2 +- 5 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/api/v3/keyoxide_profile.js b/src/api/v3/keyoxide_profile.js index 3c56e39..15c1028 100644 --- a/src/api/v3/keyoxide_profile.js +++ b/src/api/v3/keyoxide_profile.js @@ -65,7 +65,7 @@ const doVerification = async (profile) => { const claim = user.claims[iClaim] promises.push( - new Promise((resolve, reject) => { + new Promise((resolve) => { (async () => { await claim.verify(verificationOptions) results.push([iUser, iClaim, claim]) diff --git a/src/index.js b/src/index.js index fb0aa89..67df0a1 100644 --- a/src/index.js +++ b/src/index.js @@ -49,13 +49,19 @@ let gitBranch = process.env.CI_COMMIT_BRANCH ?? process.env.COMMIT_BRANCH if (!gitBranch) { try { gitBranch = execSync('git rev-parse --abbrev-ref HEAD').toString().trim() - } catch (_) {} + } catch (_err) { + logger.debug('Could not get git branch', + { component: 'http_server', action: 'init' }) + } } let gitHash = process.env.CI_COMMIT_SHA ?? process.env.COMMIT_SHA if (!gitHash) { try { gitHash = execSync('git rev-parse HEAD').toString().trim() - } catch (_) {} + } catch (_err) { + logger.debug('Could not get git hash', + { component: 'http_server', action: 'init' }) + } } const app = express() diff --git a/src/log.js b/src/log.js index afff79e..1206314 100644 --- a/src/log.js +++ b/src/log.js @@ -32,7 +32,7 @@ import * as httpContext from 'express-http-context2' import * as dotenv from 'dotenv' dotenv.config() -const anonymize = format((info, opts) => { +const anonymize = format((info) => { if (process.env.NODE_ENV !== 'development') { info.profile_id = undefined info.keyserver_domain = undefined @@ -44,7 +44,7 @@ const anonymize = format((info, opts) => { return info }) -const addRequestData = format((info, opts) => { +const addRequestData = format((info) => { if (httpContext.get('requestId')) info.request_id = httpContext.get('requestId') if (httpContext.get('requestPath')) info.request_path = httpContext.get('requestPath') if (httpContext.get('requestIp')) info.request_ip = httpContext.get('requestIp') diff --git a/src/server/openpgpProfiles.js b/src/server/openpgpProfiles.js index b5180e2..750a982 100644 --- a/src/server/openpgpProfiles.js +++ b/src/server/openpgpProfiles.js @@ -256,7 +256,7 @@ const fetchKeybase = (username, fingerprint) => { profile = await doipjs.openpgp.fetchKeybase(username, fingerprint) fetchURL = `https://keybase.io/${username}/pgp_keys.asc?fingerprint=${fingerprint}` } catch (error) { - return reject(new Error('No public keys could be fetched from Keybase')) + return reject(new Error(`No public keys could be fetched from Keybase (${error})`)) } if (!profile) { diff --git a/src/server/utils.js b/src/server/utils.js index 3699c7b..bdefac6 100644 --- a/src/server/utils.js +++ b/src/server/utils.js @@ -43,7 +43,7 @@ export function generatePageTitle (type, data) { case 'profile': try { return `${data.personas[data.primaryPersonaIndex].name} - Keyoxide` - } catch (error) { + } catch (_err) { return 'Profile - Keyoxide' }