From 7ed39cd0df999706141384271fe0f567240781eb Mon Sep 17 00:00:00 2001 From: BuyMyMojo Date: Thu, 19 Dec 2024 11:53:42 +1100 Subject: [PATCH] style: Try biome --- biome.json | 30 +++++++ src/components/EmbedCode.astro | 2 +- src/components/Greeting.jsx | 31 ++++--- src/content.config.ts | 18 ++-- src/layouts/BaseLayout.astro | 2 +- src/pages/about.astro | 28 +++--- src/pages/posts/[...slug].astro | 13 +-- src/pages/rss.xml.js | 28 +++--- src/pages/tags/[tag].astro | 26 +++--- src/pages/tags/index.astro | 4 +- src/styles/aria.css | 150 ++++++++++++++++---------------- 11 files changed, 180 insertions(+), 152 deletions(-) create mode 100644 biome.json diff --git a/biome.json b/biome.json new file mode 100644 index 0000000..2eb0751 --- /dev/null +++ b/biome.json @@ -0,0 +1,30 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.4/schema.json", + "vcs": { + "enabled": false, + "clientKind": "git", + "useIgnoreFile": false + }, + "files": { + "ignoreUnknown": false, + "ignore": [] + }, + "formatter": { + "enabled": true, + "indentStyle": "tab" + }, + "organizeImports": { + "enabled": true + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double" + } + } +} diff --git a/src/components/EmbedCode.astro b/src/components/EmbedCode.astro index 53c1bbc..760070c 100644 --- a/src/components/EmbedCode.astro +++ b/src/components/EmbedCode.astro @@ -1,7 +1,7 @@ --- const description = "Just my little website do be gay and do crime on~"; const embedImage = "https://aria.coffee/static/img/sites/avatar.png"; -const embedColour = "#380A84" +const embedColour = "#380A84"; const { pageTitle } = Astro.props; --- diff --git a/src/components/Greeting.jsx b/src/components/Greeting.jsx index be1c37c..caf15ac 100644 --- a/src/components/Greeting.jsx +++ b/src/components/Greeting.jsx @@ -1,17 +1,20 @@ -import { useState } from 'preact/hooks'; +import { useState } from "preact/hooks"; -export default function Greeting({messages}) { +export default function Greeting({ messages }) { + const randomMessage = () => + messages[Math.floor(Math.random() * messages.length)]; - const randomMessage = () => messages[(Math.floor(Math.random() * messages.length))]; + const [greeting, setGreeting] = useState(messages[0]); - const [greeting, setGreeting] = useState(messages[0]); - - return ( -
-

{greeting}! Thank you for visiting!

- -
- ); -} \ No newline at end of file + return ( +
+

{greeting}! Thank you for visiting!

+ +
+ ); +} diff --git a/src/content.config.ts b/src/content.config.ts index aaf1e09..a8e84d9 100644 --- a/src/content.config.ts +++ b/src/content.config.ts @@ -4,14 +4,14 @@ import { glob } from "astro/loaders"; import { z, defineCollection } from "astro:content"; // Define a `loader` and `schema` for each collection const blog = defineCollection({ - loader: glob({ pattern: '**/[^_]*.md', base: "./src/blog" }), - schema: z.object({ - title: z.string(), - pubDate: z.date(), - description: z.string(), - author: z.string(), - tags: z.array(z.string()) - }) + loader: glob({ pattern: "**/[^_]*.md", base: "./src/blog" }), + schema: z.object({ + title: z.string(), + pubDate: z.date(), + description: z.string(), + author: z.string(), + tags: z.array(z.string()), + }), }); // Export a single `collections` object to register your collection(s) -export const collections = { blog }; \ No newline at end of file +export const collections = { blog }; diff --git a/src/layouts/BaseLayout.astro b/src/layouts/BaseLayout.astro index 741b9ff..46ebf16 100644 --- a/src/layouts/BaseLayout.astro +++ b/src/layouts/BaseLayout.astro @@ -1,5 +1,5 @@ --- -import NavHeader from "../components/NavHeader.astro" +import NavHeader from "../components/NavHeader.astro"; import Favicon from "../components/Favicon.astro"; import Footer from "../components/Footer.astro"; import "../styles/aria.css"; diff --git a/src/pages/about.astro b/src/pages/about.astro index e6faa48..1eb922c 100644 --- a/src/pages/about.astro +++ b/src/pages/about.astro @@ -7,25 +7,25 @@ import "../styles/aria.css"; const pageTitle = "About Aria"; const identity = { - firstName: "Aria", - country: "Australia", - occupation: "Phone & Computer Repair Tech", - hobbies: ["gaming", "software/game development", "3D printing"], + firstName: "Aria", + country: "Australia", + occupation: "Phone & Computer Repair Tech", + hobbies: ["gaming", "software/game development", "3D printing"], }; const skills = ["Rust", "GDScript", "FFMPEG"]; const currentSystem = { - name: "I/O", - operatingSystem: "EndeavourOS", - host: "X570 Phantom Gaming 4", - shell: "zsh", - mainDisplay: "Gigabyte M27U", - mainDisplayRtings: "https://www.rtings.com/monitor/reviews/gigabyte/m27u", - cpu: "AMD Ryzen 9 5900X", - gpu: "AMD Radeon RX 7800 XT", - ram: "48GB", - localIP: "192.168.20.2", + name: "I/O", + operatingSystem: "EndeavourOS", + host: "X570 Phantom Gaming 4", + shell: "zsh", + mainDisplay: "Gigabyte M27U", + mainDisplayRtings: "https://www.rtings.com/monitor/reviews/gigabyte/m27u", + cpu: "AMD Ryzen 9 5900X", + gpu: "AMD Radeon RX 7800 XT", + ram: "48GB", + localIP: "192.168.20.2", }; const skillColor = "#F5A8B7"; diff --git a/src/pages/posts/[...slug].astro b/src/pages/posts/[...slug].astro index 57adc48..08bdaaa 100644 --- a/src/pages/posts/[...slug].astro +++ b/src/pages/posts/[...slug].astro @@ -1,12 +1,13 @@ --- -import { getCollection, render } from 'astro:content'; -import MarkdownPostLayout from '../../layouts/MarkdownPostLayout.astro'; +import { getCollection, render } from "astro:content"; +import MarkdownPostLayout from "../../layouts/MarkdownPostLayout.astro"; export async function getStaticPaths() { - const posts = await getCollection('blog'); - return posts.map(post => ({ - params: { slug: post.id }, props: { post }, - })); + const posts = await getCollection("blog"); + return posts.map((post) => ({ + params: { slug: post.id }, + props: { post }, + })); } const { post } = Astro.props; diff --git a/src/pages/rss.xml.js b/src/pages/rss.xml.js index b77004d..15144ce 100644 --- a/src/pages/rss.xml.js +++ b/src/pages/rss.xml.js @@ -1,18 +1,18 @@ -import rss from '@astrojs/rss'; +import rss from "@astrojs/rss"; import { getCollection } from "astro:content"; export async function GET(context) { - const posts = await getCollection("blog"); - return rss({ - title: "Aria | Blog", - description: "Just me being a silly little thing", - site: context.site, - items: posts.map((post) => ({ - title: post.data.title, - pubDate: post.data.pubDate, - description: post.data.description, - link: `/posts/${post.id}/`, - })), - customData: `en-us`, - }); + const posts = await getCollection("blog"); + return rss({ + title: "Aria | Blog", + description: "Just me being a silly little thing", + site: context.site, + items: posts.map((post) => ({ + title: post.data.title, + pubDate: post.data.pubDate, + description: post.data.description, + link: `/posts/${post.id}/`, + })), + customData: `en-us`, + }); } diff --git a/src/pages/tags/[tag].astro b/src/pages/tags/[tag].astro index 05e7817..c154976 100644 --- a/src/pages/tags/[tag].astro +++ b/src/pages/tags/[tag].astro @@ -6,21 +6,21 @@ import BlogEntry from "../../components/BlogEntry.astro"; import Partition from "../../components/Partition.astro"; export async function getStaticPaths() { - const allPosts = await getCollection("blog"); + const allPosts = await getCollection("blog"); - const uniqueTags = [ - ...new Set(allPosts.map((post: any) => post.data.tags).flat()), - ]; + const uniqueTags = [ + ...new Set(allPosts.map((post: any) => post.data.tags).flat()), + ]; - return uniqueTags.map((tag) => { - const filteredPosts = allPosts.filter((post: any) => - post.data.tags.includes(tag) - ); - return { - params: { tag }, - props: { posts: filteredPosts }, - }; - }); + return uniqueTags.map((tag) => { + const filteredPosts = allPosts.filter((post: any) => + post.data.tags.includes(tag), + ); + return { + params: { tag }, + props: { posts: filteredPosts }, + }; + }); } const { tag } = Astro.params; diff --git a/src/pages/tags/index.astro b/src/pages/tags/index.astro index 3cc3d3a..6a54dd6 100644 --- a/src/pages/tags/index.astro +++ b/src/pages/tags/index.astro @@ -4,9 +4,7 @@ import { getCollection } from "astro:content"; import BaseLayout from "../../layouts/BaseLayout.astro"; import Partition from "../../components/Partition.astro"; const allPosts = await getCollection("blog"); -const tags = [ - ...new Set(allPosts.map((post: any) => post.data.tags).flat()), -]; +const tags = [...new Set(allPosts.map((post: any) => post.data.tags).flat())]; const pageTitle = "Tag Index"; --- diff --git a/src/styles/aria.css b/src/styles/aria.css index 8dcdd7c..bf98287 100644 --- a/src/styles/aria.css +++ b/src/styles/aria.css @@ -1,124 +1,120 @@ @font-face { - font-family: "Noto Sans"; - src: - local("Noto Sans"), - url("/static/fonts/NotoSans-Regular.ttf") format("truetype"); + font-family: "Noto Sans"; + src: local("Noto Sans"), url("/static/fonts/NotoSans-Regular.ttf") + format("truetype"); } @font-face { - font-family: "Comic Shanns"; - src: - local("Comic Shanns Regular"), - url("/static/fonts/comic shanns.otf") format("opentype"), - url("/static/fonts/comic shanns 2.ttf") format("truetype"); + font-family: "Comic Shanns"; + src: local("Comic Shanns Regular"), url("/static/fonts/comic shanns.otf") + format("opentype"), url("/static/fonts/comic shanns 2.ttf") + format("truetype"); } @font-face { - font-family: "Comic Mono"; - src: - local("Comic Mono"), - url("/static/fonts/ComicMono.ttf") format("ttf"), - url("https://dtinth.github.io/comic-mono-font/ComicMono.ttf") format("truetype") + font-family: "Comic Mono"; + src: local("Comic Mono"), url("/static/fonts/ComicMono.ttf") format("ttf"), + url("https://dtinth.github.io/comic-mono-font/ComicMono.ttf") + format("truetype"); } :root { - --first-colour: #16111a; - --second-colour: #21042c; - --third-colour: #2E236C; - --fourth-colour: #F5EFFF; + --first-colour: #16111a; + --second-colour: #21042c; + --third-colour: #2e236c; + --fourth-colour: #f5efff; - --border: #27272a; + --border: #27272a; } html { - background-color: var(--first-colour); - font-family: "Comic Mono", "Comic Shanns", "Comic Sans", "Comic Sans MS", "Chalkboard", "ChalkboardSE-Regular", "Noto Sans", sans-serif; - font-size: larger; - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; + background-color: var(--first-colour); + font-family: "Comic Mono", "Comic Shanns", "Comic Sans", "Comic Sans MS", + "Chalkboard", "ChalkboardSE-Regular", "Noto Sans", sans-serif; + font-size: larger; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; } body { - /* margin: 0 auto; */ - /* width: 100%; */ - /* max-width: 40em; */ - padding: 2em; - /* padding: 1rem; */ - /* line-height: 1.5; */ - color: var(--fourth-colour); + /* margin: 0 auto; */ + /* width: 100%; */ + /* max-width: 40em; */ + padding: 2em; + /* padding: 1rem; */ + /* line-height: 1.5; */ + color: var(--fourth-colour); } @media screen and (max-width: 899px) { - body { - width: 95%; - padding-top: 0.5em; - padding-left: 0; - padding-right: 0; - flex-wrap: wrap; - } + body { + width: 95%; + padding-top: 0.5em; + padding-left: 0; + padding-right: 0; + flex-wrap: wrap; + } } - a { - color: var(--fourth-colour); - text-decoration: underline 2px; - text-underline-offset: 2px; - text-decoration-color: #00000000; + color: var(--fourth-colour); + text-decoration: underline 2px; + text-underline-offset: 2px; + text-decoration-color: #00000000; } - a:hover { - text-decoration-color: #fff; - transition: text-decoration-color 0.25s; + text-decoration-color: #fff; + transition: text-decoration-color 0.25s; } /* h1 { */ - /* margin: 1rem 0; */ - /* font-size: 2.5rem; */ +/* margin: 1rem 0; */ +/* font-size: 2.5rem; */ /* } */ /* footer { */ - /* display: flex; */ - /* gap: 1rem; */ - /* margin-top: 2rem; */ - /* background-color: var(--third-colour); */ - /* border-radius: 4px; */ - /* padding: 0.5rem; */ +/* display: flex; */ +/* gap: 1rem; */ +/* margin-top: 2rem; */ +/* background-color: var(--third-colour); */ +/* border-radius: 4px; */ +/* padding: 0.5rem; */ /* } */ .badge { - image-rendering: pixelated; - min-width: 88px; - min-height: 31px; - padding: 4px; + image-rendering: pixelated; + min-width: 88px; + min-height: 31px; + padding: 4px; } .linked-buttons { - outline-style: dashed; - width:fit-content; - display: inline-flex; + outline-style: dashed; + width: fit-content; + display: inline-flex; } .container { - background-color: var(--second-colour); - border-radius: 8px; - padding: 16px; - display:flex; - flex-direction: column; - /* flex: content; */ + background-color: var(--second-colour); + border-radius: 8px; + padding: 16px; + display: flex; + flex-direction: column; + /* flex: content; */ } .greetButton { - color: var(--fourth-colour); - background-color: var(--second-colour); - border-color: var(--second-colour); - transition-duration: 0.4s; + color: var(--fourth-colour); + background-color: var(--second-colour); + border-color: var(--second-colour); + transition-duration: 0.4s; } .greetButton:hover { - color: var(--third-colour); - background-color: var(--fourth-colour); - border-color: var(--fourth-colour); -} \ No newline at end of file + color: var(--third-colour); + background-color: var(--fourth-colour); + border-color: var(--fourth-colour); +}