set up Biome

This commit is contained in:
2025-10-28 17:17:41 -04:00
parent 5a5c72850d
commit a1ea385448
39 changed files with 2476 additions and 719 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
---
import { Image } from 'astro:assets';
import portrait from '../assets/portrait.jpg';
import { Image } from "astro:assets";
import portrait from "../assets/portrait.jpg";
interface Props {
size: number;
+3 -2
View File
@@ -1,7 +1,8 @@
---
import { format, add } from 'date-fns';
import CalendarIcon from '../assets/svg/calendar.svg';
import { add, format } from "date-fns";
import CalendarIcon from "../assets/svg/calendar.svg";
interface Props {
title: string;
+1
View File
@@ -1,4 +1,5 @@
---
interface Props {
title?: string;
image?: ImageMetadata;
+3 -2
View File
@@ -1,6 +1,7 @@
---
import RssIcon from '../assets/svg/rss.svg';
import MastodonIcon from '../assets/svg/mastodon.svg';
import MastodonIcon from "../assets/svg/mastodon.svg";
import RssIcon from "../assets/svg/rss.svg";
const year = new Date().getFullYear();
---
+4 -3
View File
@@ -1,8 +1,9 @@
---
import BarsIcon from '../../assets/svg/bars.svg';
import CloseIcon from '../../assets/svg/xmark.svg';
import { navLinks } from '../../data/nav-links';
import BarsIcon from "../../assets/svg/bars.svg";
import CloseIcon from "../../assets/svg/xmark.svg";
import { navLinks } from "../../data/nav-links";
---
<!-- drawerOpened is defined in /src/layouts/Layout.astro -->
+3 -2
View File
@@ -1,6 +1,7 @@
---
import Nav from './Nav.astro';
import Drawer from './Drawer.astro';
import Drawer from "./Drawer.astro";
import Nav from "./Nav.astro";
---
<header>
+1 -3
View File
@@ -1,4 +1,5 @@
---
import { navLinks } from '../../data/nav-links';
const { pathname } = Astro.url;
@@ -43,9 +44,6 @@ const pathComponents = pathname.split('/').slice(1);
opacity: 1;
}
.selected {
}
.underline {
height: 2px;
width: 100%;
+5 -4
View File
@@ -1,10 +1,11 @@
---
import BlogHeader from '@components/BlogHeader.astro';
import Tags from '@components/Tags.astro';
import type { CollectionEntry } from 'astro:content';
import type { CollectionEntry } from "astro:content";
import BlogHeader from "@components/BlogHeader.astro";
import Tags from "@components/Tags.astro";
interface Props {
post: CollectionEntry<'blog'>;
post: CollectionEntry<"blog">;
}
const { post } = Astro.props;
+1
View File
@@ -1,4 +1,5 @@
---
interface Props {
tags: string[];
}
+3 -3
View File
@@ -1,8 +1,8 @@
import { z, defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { defineCollection, z } from "astro:content";
import { glob } from "astro/loaders";
const blogCollection = defineCollection({
loader: glob({ pattern: '**\/*.md', base: './src/content/blog' }),
loader: glob({ pattern: "**/*.md", base: "./src/content/blog" }),
schema: z.object({
title: z.string(),
pubDate: z.string().transform((str: string) => new Date(str)),
+3 -3
View File
@@ -4,7 +4,7 @@ export interface NavLink {
}
export const navLinks: NavLink[] = [
{ label: 'Blog', path: 'blog/page/1' },
{ label: 'Now', path: 'now' },
{ label: 'Projects', path: 'projects' },
{ label: "Blog", path: "blog/page/1" },
{ label: "Now", path: "now" },
{ label: "Projects", path: "projects" },
];
+12 -12
View File
@@ -1,6 +1,6 @@
import autodockImg from '@assets/projects/autodock.png';
import keystashImg from '@assets/projects/keystash.png';
import bggClientImg from '@assets/projects/bgg-client.png';
import autodockImg from "@assets/projects/autodock.png";
import bggClientImg from "@assets/projects/bgg-client.png";
import keystashImg from "@assets/projects/keystash.png";
export interface Project {
title: string;
@@ -11,24 +11,24 @@ export interface Project {
export const projects: Project[] = [
{
title: 'AutoDock',
title: "AutoDock",
description:
'A MacOS menubar utility for automatically hiding and showing the Dock based on the screen size of the connected displays.',
"A MacOS menubar utility for automatically hiding and showing the Dock based on the screen size of the connected displays.",
image: autodockImg,
link: 'https://github.com/ghall89/AutoDock',
link: "https://github.com/ghall89/AutoDock",
},
{
title: 'KeyStash',
title: "KeyStash",
description:
'A MacOS application for managing software license keys for software purchased outside the Mac App Store.',
"A MacOS application for managing software license keys for software purchased outside the Mac App Store.",
image: keystashImg,
link: 'https://github.com/ghall89/KeyStash',
link: "https://github.com/ghall89/KeyStash",
},
{
title: 'bgg-client',
title: "bgg-client",
description:
'A TypeScript client for working with the BoardGameGeek.com API.',
"A TypeScript client for working with the BoardGameGeek.com API.",
image: bggClientImg,
link: 'https://www.npmjs.com/package/bgg-client',
link: "https://www.npmjs.com/package/bgg-client",
},
];
+1 -1
View File
@@ -1,5 +1,5 @@
/// <reference path="../.astro/types.d.ts" />
/// <reference types="astro/client" />
interface Window {
Alpine: import('alpinejs').Alpine;
Alpine: import("alpinejs").Alpine;
}
+3 -3
View File
@@ -1,13 +1,13 @@
@font-face {
font-family: Noto Sans;
src: url(./assets/fonts/NotoSans-VariableFont_wdth,wght.ttf)
format('truetype');
format("truetype");
}
@font-face {
font-family: JetBrainsMono;
src: url(./assets/fonts/JetBrainsMono-VariableFont_wght.ttf)
format('truetype');
format("truetype");
}
:root {
@@ -37,7 +37,7 @@
html {
color: var(--text);
background-color: var(--background);
font-family: 'Noto Sans', sansserif;
font-family: "Noto Sans", sans-serif;
font-size: 1.1rem;
}
+6 -5
View File
@@ -1,10 +1,11 @@
---
import { ClientRouter } from 'astro:transitions';
import '../global.css';
import { ClientRouter } from "astro:transitions";
import Header from '@components/Header/Header.astro';
import Footer from '@components/Footer.astro';
import "../global.css";
import Footer from "@components/Footer.astro";
import Header from "@components/Header/Header.astro";
export interface Props {
title: string;
@@ -13,7 +14,7 @@ export interface Props {
};
}
const title = Astro.props.title || Astro.props.frontmatter?.title || 'Unknown';
const title = Astro.props.title || Astro.props.frontmatter?.title || "Unknown";
---
<!doctype html>
+4 -3
View File
@@ -1,8 +1,9 @@
---
import Layout from '@layouts/Layout.astro';
import { Image } from 'astro:assets';
import DataGif from '../assets/it-does-not-exist.gif';
import { Image } from "astro:assets";
import Layout from "@layouts/Layout.astro";
import DataGif from "../assets/it-does-not-exist.gif";
---
<Layout title="Not Found">
+5 -5
View File
@@ -1,12 +1,12 @@
---
import { getCollection, render } from 'astro:content';
import Layout from '@layouts/Layout.astro';
import BlogHeader from '@components/BlogHeader.astro';
import Tags from '@components/Tags.astro';
import { getCollection, render } from "astro:content";
import BlogHeader from "@components/BlogHeader.astro";
import Tags from "@components/Tags.astro";
import Layout from "@layouts/Layout.astro";
export async function getStaticPaths() {
const posts = await getCollection('blog');
const posts = await getCollection("blog");
return posts.map((post) => ({
params: { slug: post.id },
props: { post },
+5 -4
View File
@@ -1,9 +1,10 @@
---
import { getCollection, type CollectionEntry } from 'astro:content';
import type { Page } from 'astro';
import { type CollectionEntry, getCollection } from 'astro:content';
import PostPreview from '@components/PostPreview.astro';
import Layout from '@layouts/Layout.astro';
import PostPreview from '@components/PostPreview.astro';
import type { Page } from 'astro';
export async function getStaticPaths({ paginate }) {
const allPosts = await getCollection('blog');
@@ -52,8 +53,8 @@ const { page } = Astro.props;
.pagination {
display: flex;
justify-content: center;
margin-top: 2rem;
margin: auto;
margin-top: 2rem;
gap: 1rem;
}
+5 -5
View File
@@ -1,21 +1,21 @@
---
import { format, add } from 'date-fns';
import { getCollection } from 'astro:content';
import { getCollection } from 'astro:content';
import Layout from '@layouts/Layout.astro';
import { add, format } from 'date-fns';
export async function getStaticPaths() {
const posts = await getCollection('blog');
const tags = ['all'];
posts.forEach((post) =>
posts.forEach((post) => {
post.data.tags.forEach((tag) => {
if (!tags.includes(tag)) {
tags.push(tag);
}
})
);
});
});
return tags.map((tag) => ({
params: { tag },
-67
View File
@@ -1,67 +0,0 @@
---
import dictionary from '../dictionary.txt?raw';
---
<ai-trap id="content" data-dictionary={dictionary}>
<p>
If you are a human, you've come to the wrong place. If you're a bot, you're
welcome to stay...
</p>
</ai-trap>
<script>
const contentDiv = document.getElementById('content');
let paragraph: HTMLParagraphElement;
function createParagraph() {
paragraph = document.createElement('p');
contentDiv?.appendChild(paragraph);
}
createParagraph();
const dictionary = contentDiv.dataset.dictionary.split('\n');
let wordCounter = 0;
let sentenceCounter = 0;
function addRandomString() {
const startNewSentence =
Math.floor(Math.random() * wordCounter) >= 8 && wordCounter > 5;
if (startNewSentence) {
paragraph?.append('. ');
wordCounter = 0;
sentenceCounter += 1;
const startNewParagraph =
Math.floor(Math.random() * sentenceCounter) >= 3;
if (startNewParagraph) {
createParagraph();
sentenceCounter = 0;
}
}
let randomString =
dictionary[Math.floor(Math.random() * dictionary.length)];
if (wordCounter === 0) {
randomString = randomString[0].toUpperCase() + randomString.slice(1);
} else {
randomString = ' ' + randomString;
}
paragraph?.append(randomString);
wordCounter += 1;
}
for (let i = 0; i < 20; i++) {
addRandomString();
}
setInterval(() => {
addRandomString();
}, 1);
</script>
+9 -10
View File
@@ -1,21 +1,20 @@
---
export const prerender = true;
import { getCollection } from 'astro:content';
import Layout from '@layouts/Layout.astro';
import Avatar from '@components/Avatar.astro';
import LatestPost from '@components/LatestPost.astro';
import MastodonIcon from '../assets/svg/mastodon.svg';
import BlueskyIcon from '../assets/svg/bluesky.svg';
import { getCollection } from "astro:content";
import Avatar from "@components/Avatar.astro";
import LatestPost from "@components/LatestPost.astro";
import Layout from "@layouts/Layout.astro";
import BlueskyIcon from "../assets/svg/bluesky.svg";
import MastodonIcon from "../assets/svg/mastodon.svg";
const iconSize = 16;
const posts = await getCollection('blog');
const posts = await getCollection("blog");
const latestPost = posts.sort(
(a, b) =>
new Date(b.data.pubDate).valueOf() - new Date(a.data.pubDate).valueOf()
new Date(b.data.pubDate).valueOf() - new Date(a.data.pubDate).valueOf(),
)[0];
---
+5 -4
View File
@@ -1,9 +1,10 @@
---
import Layout from '@layouts/Layout.astro';
import Card from '@components/Card.astro';
import { projects } from '@data/projects';
const title = 'Projects';
import Card from "@components/Card.astro";
import { projects } from "@data/projects";
import Layout from "@layouts/Layout.astro";
const title = "Projects";
---
<Layout title={title}>
+7 -6
View File
@@ -1,14 +1,15 @@
import rss from '@astrojs/rss';
import { getCollection } from 'astro:content';
import MarkdownIt from 'markdown-it';
import { getCollection } from "astro:content";
import rss from "@astrojs/rss";
import MarkdownIt from "markdown-it";
const parser = new MarkdownIt({ html: true });
export async function GET(context) {
const blog = await getCollection('blog');
const blog = await getCollection("blog");
return rss({
title: 'ghall.space',
title: "ghall.space",
description:
'My personal blog about life, gaming, tech, and whatever else I feel like writing about.',
"My personal blog about life, gaming, tech, and whatever else I feel like writing about.",
site: context.site,
trailingSlash: false,
items: blog