fix: soo many lint errors

This commit is contained in:
Max Richter
2025-11-03 00:03:27 +01:00
parent c13420c3ab
commit 696082250d
41 changed files with 373 additions and 500 deletions

View File

@@ -11,11 +11,14 @@ import { Star } from "@components/Stars.tsx";
import { MetaTags } from "@components/MetaTags.tsx";
import { fetchResource } from "@lib/marka/index.ts";
import { ArticleResource } from "@lib/marka/schema.ts";
import { parseRating } from "@lib/helpers.ts";
export const handler: Handlers<{ article: ArticleResource; session: unknown }> =
{
async GET(_, ctx) {
const article = await fetchResource(`articles/${ctx.params.name}.md`);
const article = await fetchResource<ArticleResource>(
`articles/${ctx.params.name}.md`,
);
if (!article) {
return ctx.renderNotFound();
}
@@ -24,16 +27,22 @@ export const handler: Handlers<{ article: ArticleResource; session: unknown }> =
};
export default function Greet(
props: PageProps<{ article: Article; session: Record<string, string> }>,
props: PageProps<
{ article: ArticleResource; session: Record<string, string> }
>,
) {
const { article, session } = props.data;
const { author = "", date = "", articleBody = "" } = article?.content || {};
const { author, datePublished, reviewRating, articleBody = "" } =
article?.content || {};
const content = renderMarkdown(
removeImage(articleBody, article.image?.url),
);
const rating = reviewRating?.ratingValue &&
parseRating(reviewRating.ratingValue);
return (
<MainLayout
url={props.url}
@@ -62,36 +71,35 @@ export default function Greet(
</PageHero.Title>
<PageHero.Subline
entries={[
author && {
title: author,
href: `/?q=${encodeURIComponent(author)}`,
author?.name && {
title: author.name,
href: `/?q=${encodeURIComponent(author?.name)}`,
},
date.toString(),
datePublished?.toString(),
]}
>
{article.content.rating && <Star rating={article.content.rating} />}
{rating && <Star rating={rating} />}
</PageHero.Subline>
</PageHero.Footer>
</PageHero>
{article.content?.tags?.length > 0 && (
{article.content?.keywords?.length && (
<>
<br />
<HashTags tags={article.content.tags} />
<HashTags tags={article.content.keywords} />
</>
)}
<div class="px-8 text-white mt-10">
{isYoutubeLink(article.content.url) && (
{(article.content.url && isYoutubeLink(article.content.url)) && (
<YoutubePlayer link={article.content.url} />
)}
<pre
class="whitespace-break-spaces markdown-body"
data-color-mode="dark"
data-dark-theme="dark"
// deno-lint-ignore react-no-danger
dangerouslySetInnerHTML={{ __html: content || "" }}
>
{content || ""}
</pre>
/>
</div>
</MainLayout>
);