mirror of
https://github.com/theoludwig/theoludwig.git
synced 2026-02-28 16:01:00 +01:00
chore: migrate from ESLint/Prettier to Oxc
This commit is contained in:
@@ -17,8 +17,7 @@ export const BLOG_POST_MOCK = {
|
||||
"\nHello, world! 👋\n\n## Introduction\n\nThis blog is here to document my journey of learning computer science.",
|
||||
frontmatter: {
|
||||
title: "👋 Hello, world!",
|
||||
description:
|
||||
"First post of the blog, introduction and explanation of how this blog is made.",
|
||||
description: "First post of the blog, introduction and explanation of how this blog is made.",
|
||||
isPublished: true,
|
||||
publishedOn: "2022-02-20T08:00:18.758Z",
|
||||
},
|
||||
|
||||
@@ -14,10 +14,9 @@ import "katex/dist/katex.min.css"
|
||||
import { BlogPostComments } from "./BlogPostComments.tsx"
|
||||
|
||||
const Heading: React.FC<
|
||||
React.DetailedHTMLProps<
|
||||
React.HTMLAttributes<HTMLHeadingElement>,
|
||||
HTMLHeadingElement
|
||||
> & { as: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" }
|
||||
React.DetailedHTMLProps<React.HTMLAttributes<HTMLHeadingElement>, HTMLHeadingElement> & {
|
||||
as: "h1" | "h2" | "h3" | "h4" | "h5" | "h6"
|
||||
}
|
||||
> = (props) => {
|
||||
const { children, as, id = "", ...rest } = props
|
||||
|
||||
@@ -37,9 +36,7 @@ export interface BlogPostContentProps {
|
||||
content: string
|
||||
}
|
||||
|
||||
export const BlogPostContent: React.FC<BlogPostContentProps> = async (
|
||||
props,
|
||||
) => {
|
||||
export const BlogPostContent: React.FC<BlogPostContentProps> = async (props) => {
|
||||
const { content } = props
|
||||
|
||||
return (
|
||||
@@ -90,13 +87,7 @@ export const BlogPostContent: React.FC<BlogPostContentProps> = async (
|
||||
const source = src.replace("../../../apps/website/public/", "/")
|
||||
return (
|
||||
<span className="flex flex-col items-center justify-center">
|
||||
<Image
|
||||
src={source}
|
||||
alt={alt}
|
||||
width={1000}
|
||||
height={1000}
|
||||
className="size-auto"
|
||||
/>
|
||||
<Image src={source} alt={alt} width={1000} height={1000} className="size-auto" />
|
||||
</span>
|
||||
)
|
||||
},
|
||||
@@ -109,9 +100,7 @@ export const BlogPostContent: React.FC<BlogPostContentProps> = async (
|
||||
if (hrefString.startsWith("../posts/")) {
|
||||
return (
|
||||
<Link
|
||||
href={hrefString
|
||||
.replace("../posts/", "/blog/")
|
||||
.replace(".md", "")}
|
||||
href={hrefString.replace("../posts/", "/blog/").replace(".md", "")}
|
||||
{...rest}
|
||||
/>
|
||||
)
|
||||
|
||||
@@ -19,9 +19,7 @@ export const BlogPostUI: React.FC<BlogPostUIProps> = (props) => {
|
||||
<Typography variant="h2" as="h1">
|
||||
{blogPost.frontmatter.title}
|
||||
</Typography>
|
||||
<p className="mt-2">
|
||||
{getISODate(new Date(blogPost.frontmatter.publishedOn))}
|
||||
</p>
|
||||
<p className="mt-2">{getISODate(new Date(blogPost.frontmatter.publishedOn))}</p>
|
||||
</div>
|
||||
<BlogPostContent content={blogPost.content} />
|
||||
</MainLayout>
|
||||
|
||||
@@ -14,9 +14,7 @@ export const BlogPosts: React.FC<BlogPostsProps> = (props) => {
|
||||
return (
|
||||
<ul className="list-none">
|
||||
{posts.map((post) => {
|
||||
const postPublishedOn = getISODate(
|
||||
new Date(post.frontmatter.publishedOn),
|
||||
)
|
||||
const postPublishedOn = getISODate(new Date(post.frontmatter.publishedOn))
|
||||
|
||||
return (
|
||||
<li key={post.slug}>
|
||||
|
||||
@@ -4,14 +4,7 @@ import path from "node:path"
|
||||
import matter from "gray-matter"
|
||||
import type { BlogPost, FrontMatter } from "./BlogPost.tsx"
|
||||
|
||||
export const BLOG_POSTS_PATH = path.join(
|
||||
process.cwd(),
|
||||
"..",
|
||||
"..",
|
||||
"packages",
|
||||
"blog",
|
||||
"posts",
|
||||
)
|
||||
export const BLOG_POSTS_PATH = path.join(process.cwd(), "..", "..", "packages", "blog", "posts")
|
||||
|
||||
export const getBlogPosts = async (): Promise<BlogPost[]> => {
|
||||
const blogPosts = await fs.promises.readdir(BLOG_POSTS_PATH)
|
||||
@@ -48,9 +41,7 @@ export const getBlogPosts = async (): Promise<BlogPost[]> => {
|
||||
return blogPostsSortedByPublicationDate
|
||||
}
|
||||
|
||||
export const getBlogPostBySlug = async (
|
||||
slug: string,
|
||||
): Promise<BlogPost | undefined> => {
|
||||
export const getBlogPostBySlug = async (slug: string): Promise<BlogPost | undefined> => {
|
||||
const blogPosts = await getBlogPosts()
|
||||
const blogPost = blogPosts.find((blogPost) => {
|
||||
return blogPost.slug === slug
|
||||
|
||||
Reference in New Issue
Block a user