mirror of
https://github.com/theoludwig/theoludwig.git
synced 2026-02-20 03:09:20 +01:00
chore: migrate from ESLint/Prettier to Oxc
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
import typescriptESLint from "typescript-eslint"
|
||||
import { defineConfig } from "eslint/config"
|
||||
import config from "@repo/config-eslint"
|
||||
|
||||
export default defineConfig(...config, {
|
||||
files: ["**/*.ts", "**/*.tsx"],
|
||||
languageOptions: {
|
||||
parser: typescriptESLint.parser,
|
||||
parserOptions: {
|
||||
projectService: true,
|
||||
tsconfigRootDir: import.meta.dirname,
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -9,46 +9,42 @@
|
||||
"./BlogPostUI": "./src/BlogPostUI.tsx"
|
||||
},
|
||||
"scripts": {
|
||||
"lint:eslint": "eslint src --max-warnings 0",
|
||||
"lint:typescript": "tsc --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@giscus/react": "catalog:",
|
||||
"@mdx-js/mdx": "catalog:",
|
||||
"@repo/config-tailwind": "workspace:*",
|
||||
"@repo/utils": "workspace:*",
|
||||
"@repo/i18n": "workspace:*",
|
||||
"@repo/ui": "workspace:*",
|
||||
"@giscus/react": "catalog:",
|
||||
"@repo/utils": "workspace:*",
|
||||
"@shikijs/rehype": "catalog:",
|
||||
"@mdx-js/mdx": "catalog:",
|
||||
"gray-matter": "catalog:",
|
||||
"katex": "catalog:",
|
||||
"next": "catalog:",
|
||||
"next-intl": "catalog:",
|
||||
"next-mdx-remote": "catalog:",
|
||||
"react": "catalog:",
|
||||
"react-dom": "catalog:",
|
||||
"react-icons": "catalog:",
|
||||
"rehype-katex": "catalog:",
|
||||
"rehype-raw": "catalog:",
|
||||
"rehype-slug": "catalog:",
|
||||
"remark-gfm": "catalog:",
|
||||
"remark-math": "catalog:",
|
||||
"shiki": "catalog:",
|
||||
"next": "catalog:",
|
||||
"next-mdx-remote": "catalog:",
|
||||
"next-intl": "catalog:",
|
||||
"react": "catalog:",
|
||||
"react-dom": "catalog:",
|
||||
"react-icons": "catalog:"
|
||||
"shiki": "catalog:"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@repo/config-eslint": "workspace:*",
|
||||
"@repo/config-typescript": "workspace:*",
|
||||
"@storybook/nextjs": "catalog:",
|
||||
"@tailwindcss/postcss": "catalog:",
|
||||
"@total-typescript/ts-reset": "catalog:",
|
||||
"@types/node": "catalog:",
|
||||
"@types/react": "catalog:",
|
||||
"@types/react-dom": "catalog:",
|
||||
"@total-typescript/ts-reset": "catalog:",
|
||||
"storybook": "catalog:",
|
||||
"@storybook/nextjs": "catalog:",
|
||||
"eslint": "catalog:",
|
||||
"postcss": "catalog:",
|
||||
"storybook": "catalog:",
|
||||
"tailwindcss": "catalog:",
|
||||
"@tailwindcss/postcss": "catalog:",
|
||||
"typescript-eslint": "catalog:",
|
||||
"typescript": "catalog:"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,10 +173,7 @@ We have to keep it as simple as possible, not to implement features that are not
|
||||
import fs from "node:fs"
|
||||
import path from "node:path"
|
||||
|
||||
const createFile = async (
|
||||
name: string,
|
||||
isTemporary: boolean = false,
|
||||
): Promise<void> => {
|
||||
const createFile = async (name: string, isTemporary: boolean = false): Promise<void> => {
|
||||
if (isTemporary) {
|
||||
return await fs.promises.writeFile(path.join("temporary", name), "")
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,10 +2,6 @@
|
||||
"extends": "@repo/config-typescript/tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
||||
"types": [
|
||||
"@total-typescript/ts-reset",
|
||||
"@types/node",
|
||||
"@repo/i18n/messages.d.ts"
|
||||
]
|
||||
"types": ["@total-typescript/ts-reset", "@types/node", "@repo/i18n/messages.d.ts"]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user