Skip to content

Commit 87ec032

Browse files
committed
fix formatting pass
1 parent 397d0e3 commit 87ec032

32 files changed

+475
-423
lines changed

.cursor/worktrees.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
{
2-
"setup-worktree": [
3-
"pnpm install"
4-
]
2+
"setup-worktree": ["pnpm install"]
53
}

astro.config.mjs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
1-
import { defineConfig } from "astro/config";
21
import mdx from "@astrojs/mdx";
32
import sitemap from "@astrojs/sitemap";
4-
import ogImagesIntegration from "./scripts/og-images-integration.ts";
5-
6-
import rehypeShiki from "@shikijs/rehype";
7-
import rehypeMermaid from "./lib/rehypeMermaid.ts";
8-
import rehypeExcalidraw from "./lib/rehypeExcalidraw.ts";
9-
103
// Remark plugins
114
import remarkFigureCaption from "@microflash/remark-figure-caption";
12-
import remarkGfm from "remark-gfm";
5+
import rehypeShiki from "@shikijs/rehype";
6+
import { defineConfig } from "astro/config";
137
import callouts from "remark-callouts";
8+
import remarkGfm from "remark-gfm";
149
import wikilinks from "remark-wiki-link";
10+
import rehypeExcalidraw from "./lib/rehypeExcalidraw.ts";
11+
import rehypeMermaid from "./lib/rehypeMermaid.ts";
12+
import ogImagesIntegration from "./scripts/og-images-integration.ts";
1513

1614
const baseURL = "https://respawn.io";
1715

@@ -38,7 +36,10 @@ const pageResolver = (name) => [name];
3836

3937
const remarkPlugins = [
4038
remarkGfm,
41-
[remarkFigureCaption, { captionClassName: "text-center italic mx-auto block" }],
39+
[
40+
remarkFigureCaption,
41+
{ captionClassName: "text-center italic mx-auto block" },
42+
],
4243
[wikilinks, { pageResolver, hrefTemplate, aliasDivider: "|" }],
4344
callouts,
4445
];
@@ -62,11 +63,7 @@ const rehypePlugins = [
6263

6364
export default defineConfig({
6465
site: baseURL,
65-
integrations: [
66-
mdx(),
67-
sitemap(),
68-
ogImagesIntegration(),
69-
],
66+
integrations: [mdx(), sitemap(), ogImagesIntegration()],
7067
markdown: {
7168
remarkPlugins,
7269
rehypePlugins,

biome.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@
66
"useIgnoreFile": false
77
},
88
"files": {
9-
"ignoreUnknown": false,
10-
"includes": ["**", "!**/.astro", "!**/node_modules", "!**/public"]
9+
"ignoreUnknown": true,
10+
"includes": [
11+
"**",
12+
"!**/.astro",
13+
"!**/node_modules",
14+
"!**/public",
15+
"!**/dist"
16+
]
1117
},
1218
"formatter": {
1319
"enabled": true,
@@ -17,10 +23,15 @@
1723
"linter": {
1824
"enabled": true,
1925
"rules": {
20-
"recommended": true
26+
"recommended": true,
27+
"correctness": {
28+
"noUnusedVariables": "off",
29+
"noUnusedImports": "off"
30+
}
2131
}
2232
},
2333
"javascript": {
34+
"globals": ["Astro"],
2435
"formatter": {
2536
"quoteStyle": "double"
2637
}

lib/markdownToHTML-astro.ts

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
// Provides a utility function to convert a markdown to HTML,
22
// without MDX component support
33

4-
import { resolve } from 'node:path';
5-
import { VFile } from 'vfile';
6-
import type { CollectionEntry } from 'astro:content';
7-
8-
import rehypeStringify from 'rehype-stringify';
4+
import type { CollectionEntry } from "astro:content";
5+
import { resolve } from "node:path";
6+
import rehypeStringify from "rehype-stringify";
97
import remarkEmbedImages from "remark-embed-images";
10-
import remarkParse from 'remark-parse';
11-
import remarkRehype from 'remark-rehype';
12-
import { unified } from 'unified';
8+
import remarkParse from "remark-parse";
9+
import remarkRehype from "remark-rehype";
10+
import { unified } from "unified";
11+
import { VFile } from "vfile";
1312

14-
import { rehypePlugins, remarkPlugins } from './unifiedPlugins';
13+
import { rehypePlugins, remarkPlugins } from "./unifiedPlugins";
1514

1615
const wrapInArticle = (html: string) => `<article>${html}</article>`;
1716

18-
export async function markdownToHTML(post: CollectionEntry<'posts'>) {
17+
export async function markdownToHTML(post: CollectionEntry<"posts">) {
1918
const processor = unified();
2019
const plugins = [
2120
remarkParse,
@@ -30,7 +29,7 @@ export async function markdownToHTML(post: CollectionEntry<'posts'>) {
3029
if (Array.isArray(plugin)) {
3130
processor.use(plugin[0], plugin[1]);
3231
} else {
33-
// @ts-ignore
32+
// @ts-expect-error
3433
processor.use(plugin);
3534
}
3635
});
@@ -40,8 +39,8 @@ export async function markdownToHTML(post: CollectionEntry<'posts'>) {
4039
path: resolve("src/content/posts", `${post.id}`),
4140
});
4241

43-
// @ts-ignore
42+
// @ts-expect-error
4443
const result = await processor.process(file);
45-
// @ts-ignore
44+
// @ts-expect-error
4645
return wrapInArticle(result.value.toString());
4746
}

lib/rehypeExcalidraw.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import { visit } from "unist-util-visit";
21
import { existsSync, readFileSync } from "fs";
3-
import { join, dirname } from "path";
4-
import type { Plugin } from "unified";
52
import type { Root } from "hast";
3+
import { dirname, join } from "path";
4+
import type { Plugin } from "unified";
5+
import { visit } from "unist-util-visit";
66

77
// Options for the Excalidraw plugin
88
interface ExcalidrawOptions {
@@ -14,7 +14,7 @@ interface ExcalidrawOptions {
1414
const rehypeExcalidraw: Plugin<[ExcalidrawOptions?], Root> = (options = {}) => {
1515
return (tree, file) => {
1616
// Track paragraphs that contain Excalidraw diagrams
17-
let paragraphsToReplace = [];
17+
const paragraphsToReplace = [];
1818

1919
// Find paragraphs containing Excalidraw diagrams
2020
visit(tree, "element", (node) => {
@@ -49,12 +49,12 @@ const rehypeExcalidraw: Plugin<[ExcalidrawOptions?], Root> = (options = {}) => {
4949
const lightSvgContent = readFileSync(lightSvgPath, "utf-8");
5050
const darkSvgContent = readFileSync(darkSvgPath, "utf-8");
5151

52-
const lightDataUrl = `data:image/svg+xml;base64,${Buffer.from(lightSvgContent).toString(
53-
"base64",
54-
)}`;
55-
const darkDataUrl = `data:image/svg+xml;base64,${Buffer.from(darkSvgContent).toString(
56-
"base64",
57-
)}`;
52+
const lightDataUrl = `data:image/svg+xml;base64,${Buffer.from(
53+
lightSvgContent,
54+
).toString("base64")}`;
55+
const darkDataUrl = `data:image/svg+xml;base64,${Buffer.from(
56+
darkSvgContent,
57+
).toString("base64")}`;
5858

5959
paragraph.tagName = "div";
6060
paragraph.properties = {
@@ -85,7 +85,10 @@ const rehypeExcalidraw: Plugin<[ExcalidrawOptions?], Root> = (options = {}) => {
8585
];
8686
}
8787
} catch (error) {
88-
console.error(`Failed to process Excalidraw diagram ${diagramName}:`, error);
88+
console.error(
89+
`Failed to process Excalidraw diagram ${diagramName}:`,
90+
error,
91+
);
8992
}
9093
}
9194

0 commit comments

Comments
 (0)