lint fix wip2

This commit is contained in:
Nicolas Cantu 2026-01-06 14:28:19 +01:00
parent 17219ea662
commit 20032c00ae
2 changed files with 12 additions and 8 deletions

View File

@ -115,7 +115,7 @@ export function getPurchasesForArticle(articleId: string, timeoutMs: number = 50
const sub = createSubscription(pool, [relayUrl], filters) const sub = createSubscription(pool, [relayUrl], filters)
let finished = false let finished = false
const done = async () => { const done = async (): Promise<void> => {
if (finished) { if (finished) {
return return
} }
@ -124,7 +124,7 @@ export function getPurchasesForArticle(articleId: string, timeoutMs: number = 50
resolve(results) resolve(results)
} }
sub.on('event', async (event: Event) => { sub.on('event', async (event: Event): Promise<void> => {
const parsed = await parsePurchaseFromEvent(event) const parsed = await parsePurchaseFromEvent(event)
if (parsed?.articleId === articleId) { if (parsed?.articleId === articleId) {
// Cache the parsed purchase // Cache the parsed purchase
@ -155,7 +155,7 @@ export function getPurchasesByPayer(payerPubkey: string, timeoutMs: number = 500
const sub = createSubscription(pool, [relayUrl], filters) const sub = createSubscription(pool, [relayUrl], filters)
let finished = false let finished = false
const done = async () => { const done = async (): Promise<void> => {
if (finished) { if (finished) {
return return
} }
@ -164,7 +164,7 @@ export function getPurchasesByPayer(payerPubkey: string, timeoutMs: number = 500
resolve(results) resolve(results)
} }
sub.on('event', async (event: Event) => { sub.on('event', async (event: Event): Promise<void> => {
const parsed = await parsePurchaseFromEvent(event) const parsed = await parsePurchaseFromEvent(event)
if (parsed) { if (parsed) {
// Cache the parsed purchase // Cache the parsed purchase
@ -175,7 +175,9 @@ export function getPurchasesByPayer(payerPubkey: string, timeoutMs: number = 500
} }
}) })
sub.on('eose', () => done()) sub.on('eose', (): void => {
void done()
})
setTimeout(() => done(), timeoutMs).unref?.() setTimeout(() => done(), timeoutMs).unref?.()
}) })
} }

View File

@ -113,7 +113,7 @@ export function getSponsoringByAuthor(authorPubkey: string, timeoutMs: number =
const sub = createSubscription(pool, [relayUrl], filters) const sub = createSubscription(pool, [relayUrl], filters)
let finished = false let finished = false
const done = async () => { const done = async (): Promise<void> => {
if (finished) { if (finished) {
return return
} }
@ -122,7 +122,7 @@ export function getSponsoringByAuthor(authorPubkey: string, timeoutMs: number =
resolve(results) resolve(results)
} }
sub.on('event', async (event: Event) => { sub.on('event', async (event: Event): Promise<void> => {
const parsed = await parseSponsoringFromEvent(event) const parsed = await parseSponsoringFromEvent(event)
if (parsed?.authorPubkey === authorPubkey) { if (parsed?.authorPubkey === authorPubkey) {
// Cache the parsed sponsoring // Cache the parsed sponsoring
@ -133,7 +133,9 @@ export function getSponsoringByAuthor(authorPubkey: string, timeoutMs: number =
} }
}) })
sub.on('eose', () => done()) sub.on('eose', (): void => {
void done()
})
setTimeout(() => done(), timeoutMs).unref?.() setTimeout(() => done(), timeoutMs).unref?.()
}) })
} }