From 78461649639dba10f9ade8b1dba9e8f2c69a4144 Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Thu, 3 Jul 2025 18:23:00 +0300 Subject: Add husky pre-commit --- src/loaders/pleroma.ts | 29 ++++++++++++++++------------- src/plugins/remark-admonitions.ts | 2 +- src/styles/global.css | 1 + 3 files changed, 18 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/loaders/pleroma.ts b/src/loaders/pleroma.ts index feb11c8..952e491 100644 --- a/src/loaders/pleroma.ts +++ b/src/loaders/pleroma.ts @@ -1,7 +1,7 @@ import type { Loader } from "astro/loaders"; import { XMLParser } from "fast-xml-parser"; -import TurndownService from "turndown"; import { marked } from "marked"; +import TurndownService from "turndown"; interface PleromaFeedConfig { instanceUrl: string; @@ -199,12 +199,12 @@ function markdownToHtml(markdown: string): string { breaks: true, // Convert line breaks to
gfm: true, // GitHub flavored markdown }); - + // Convert markdown to HTML const html = marked.parse(markdown); - + // Return as string (marked.parse can return string or Promise) - return typeof html === 'string' ? html : ''; + return typeof html === "string" ? html : ""; } function extractTitle(content: string): string { @@ -259,7 +259,7 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { if (response.ok) { break; // Success, exit retry loop } - throw new Error(`HTTP ${response.status}: ${response.statusText}`); + throw new Error(`HTTP ${response.status}: ${response.statusText}`); } catch (error) { lastError = error; logger.warn(`Attempt ${attempt} failed: ${error}`); @@ -312,16 +312,19 @@ export function pleromaLoader(config: PleromaFeedConfig): Loader { const postId = entry.id.split("/").pop() || entry.id; // Extract source URL from the entry - const sourceUrl = entry.link?.find(link => link["@_rel"] === "alternate")?.["@_href"] || entry.id; + const sourceUrl = + entry.link?.find((link) => link["@_rel"] === "alternate")?.["@_href"] || entry.id; // Extract image attachments - const attachments = entry.link?.filter(link => - link["@_rel"] === "enclosure" && - link["@_type"]?.startsWith("image/") - ).map(link => ({ - url: link["@_href"], - type: link["@_type"] - })) || []; + const attachments = + entry.link + ?.filter( + (link) => link["@_rel"] === "enclosure" && link["@_type"]?.startsWith("image/"), + ) + .map((link) => ({ + url: link["@_href"], + type: link["@_type"], + })) || []; // Create note entry store.set({ diff --git a/src/plugins/remark-admonitions.ts b/src/plugins/remark-admonitions.ts index 1f718ca..09bb284 100644 --- a/src/plugins/remark-admonitions.ts +++ b/src/plugins/remark-admonitions.ts @@ -49,7 +49,7 @@ function transformUnhandledDirective( } /** From Astro Starlight: Function that generates an mdast HTML tree ready for conversion to HTML by rehype. */ -// biome-ignore lint/suspicious/noExplicitAny: +// biome-ignore lint/suspicious/noExplicitAny: mdast types require any for flexibility function h(el: string, attrs: Properties = {}, children: any[] = []): P { const { properties, tagName } = _h(el, attrs); return { diff --git a/src/styles/global.css b/src/styles/global.css index bf46988..5f5cdb6 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -42,6 +42,7 @@ } @view-transition { + /* biome-ignore lint/correctness/noUnknownProperty: View Transitions API property */ navigation: auto; } -- cgit v1.2.3