From 0471e05ef3dc19c1bc1b23512518495b484a4c20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Mon, 21 Oct 2024 00:30:34 +0200 Subject: [PATCH] Fix lint errors --- handlers/nprofile.ts | 3 --- handlers/npub.ts | 3 --- handlers/username.ts | 2 -- html.ts | 3 +-- ldap.ts | 6 ++++-- main_test.ts | 6 ------ 6 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 main_test.ts diff --git a/handlers/nprofile.ts b/handlers/nprofile.ts index 5a889d9..15bc048 100644 --- a/handlers/nprofile.ts +++ b/handlers/nprofile.ts @@ -2,11 +2,8 @@ import { Context } from "@oak/oak"; import { nip19 } from "@nostr/tools"; import { log } from "../log.ts"; import { lookupUsernameByPubkey } from "../ldap.ts"; -import { fetchProfileEvent } from "../nostr.ts"; -import { profilePageHtml } from "../html.ts"; const nprofileHandler = async function (ctx: Context) { - const { request } = ctx; const nprofile = ctx.params.path; try { diff --git a/handlers/npub.ts b/handlers/npub.ts index 9cb32f5..69ebd77 100644 --- a/handlers/npub.ts +++ b/handlers/npub.ts @@ -2,11 +2,8 @@ import { Context } from "@oak/oak"; import { nip19 } from "@nostr/tools"; import { log } from "../log.ts"; import { lookupUsernameByPubkey } from "../ldap.ts"; -import { fetchProfileEvent } from "../nostr.ts"; -import { profilePageHtml } from "../html.ts"; const npubHandler = async function (ctx: Context) { - const { request } = ctx; const npub = ctx.params.path; try { diff --git a/handlers/username.ts b/handlers/username.ts index f4d9f98..326a419 100644 --- a/handlers/username.ts +++ b/handlers/username.ts @@ -1,12 +1,10 @@ import { Context } from "@oak/oak"; -import { nip19 } from "@nostr/tools"; import { log } from "../log.ts"; import { lookupPubkeyByUsername } from "../ldap.ts"; import { fetchArticlesByAuthor, fetchProfileEvent } from "../nostr.ts"; import { profilePageHtml } from "../html.ts"; const usernameHandler = async function (ctx: Context) { - const { request } = ctx; const username = ctx.params.path.replace(/^(@|~)/, ""); const pubkey = await lookupPubkeyByUsername(username); diff --git a/html.ts b/html.ts index 00165d1..082dcc8 100644 --- a/html.ts +++ b/html.ts @@ -1,6 +1,5 @@ import { render as renderMarkdown } from "@deno/gfm"; import { nip19 } from "@nostr/tools"; -import { log } from "./log.ts"; export function htmlLayout(title: string, body: string) { return ` @@ -164,7 +163,7 @@ function articleListItemHtml(articleEvent: object) { const naddr = nip19.naddrEncode({ identifier: identifier, pubkey: articleEvent.pubkey, - kind: articleEvent.kind + kind: articleEvent.kind, }); const titleTag = articleEvent.tags.find((t) => t[0] === "title"); const title = titleTag ? titleTag[1] : "Untitled"; diff --git a/ldap.ts b/ldap.ts index 37cb118..a9db92e 100644 --- a/ldap.ts +++ b/ldap.ts @@ -30,8 +30,9 @@ export async function lookupPubkeyByUsername(username: string) { log(ex, "red"); } finally { await client.unbind(); - return pubkey; } + + return pubkey; } export async function lookupUsernameByPubkey(pubkey: string) { @@ -50,6 +51,7 @@ export async function lookupUsernameByPubkey(pubkey: string) { log(ex, "red"); } finally { await client.unbind(); - return username; } + + return username; } diff --git a/main_test.ts b/main_test.ts deleted file mode 100644 index 2d83169..0000000 --- a/main_test.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { assertEquals } from "@std/assert"; -// import { add } from "./main.ts"; - -// Deno.test(function addTest() { -// assertEquals(add(2, 3), 5); -// });