diff --git a/biome.json b/biome.json index 0c7acf3c..4ccad49c 100644 --- a/biome.json +++ b/biome.json @@ -7,7 +7,7 @@ }, "files": { "ignoreUnknown": false, - "ignore": [] + "ignore": ["src/**/*.css","src/public/**/*", "dist/**/*", "node_modules/**/*"] }, "formatter": { "enabled": true, diff --git a/src/components/ArchivePanel.astro b/src/components/ArchivePanel.astro index 102a53a3..24159c8c 100644 --- a/src/components/ArchivePanel.astro +++ b/src/components/ArchivePanel.astro @@ -1,67 +1,67 @@ --- -import { UNCATEGORIZED } from '@constants/constants' -import I18nKey from '../i18n/i18nKey' -import { i18n } from '../i18n/translation' -import { getSortedPosts } from '../utils/content-utils' -import { getPostUrlBySlug } from '../utils/url-utils' +import { UNCATEGORIZED } from "@constants/constants"; +import I18nKey from "../i18n/i18nKey"; +import { i18n } from "../i18n/translation"; +import { getSortedPosts } from "../utils/content-utils"; +import { getPostUrlBySlug } from "../utils/url-utils"; interface Props { - keyword?: string - tags?: string[] - categories?: string[] + keyword?: string; + tags?: string[]; + categories?: string[]; } -const { tags, categories } = Astro.props +const { tags, categories } = Astro.props; -let posts = await getSortedPosts() +let posts = await getSortedPosts(); if (Array.isArray(tags) && tags.length > 0) { - posts = posts.filter( - post => - Array.isArray(post.data.tags) && - post.data.tags.some(tag => tags.includes(tag)), - ) + posts = posts.filter( + (post) => + Array.isArray(post.data.tags) && + post.data.tags.some((tag) => tags.includes(tag)), + ); } if (Array.isArray(categories) && categories.length > 0) { - posts = posts.filter( - post => - (post.data.category && categories.includes(post.data.category)) || - (!post.data.category && categories.includes(UNCATEGORIZED)), - ) + posts = posts.filter( + (post) => + (post.data.category && categories.includes(post.data.category)) || + (!post.data.category && categories.includes(UNCATEGORIZED)), + ); } const groups: { year: number; posts: typeof posts }[] = (() => { - const groupedPosts = posts.reduce( - (grouped: { [year: number]: typeof posts }, post) => { - const year = post.data.published.getFullYear() - if (!grouped[year]) { - grouped[year] = [] - } - grouped[year].push(post) - return grouped - }, - {}, - ) + const groupedPosts = posts.reduce( + (grouped: { [year: number]: typeof posts }, post) => { + const year = post.data.published.getFullYear(); + if (!grouped[year]) { + grouped[year] = []; + } + grouped[year].push(post); + return grouped; + }, + {}, + ); - // convert the object to an array - const groupedPostsArray = Object.keys(groupedPosts).map(key => ({ - year: Number.parseInt(key), - posts: groupedPosts[Number.parseInt(key)], - })) + // convert the object to an array + const groupedPostsArray = Object.keys(groupedPosts).map((key) => ({ + year: Number.parseInt(key), + posts: groupedPosts[Number.parseInt(key)], + })); - // sort years by latest first - groupedPostsArray.sort((a, b) => b.year - a.year) - return groupedPostsArray -})() + // sort years by latest first + groupedPostsArray.sort((a, b) => b.year - a.year); + return groupedPostsArray; +})(); function formatDate(date: Date) { - const month = (date.getMonth() + 1).toString().padStart(2, '0') - const day = date.getDate().toString().padStart(2, '0') - return `${month}-${day}` + const month = (date.getMonth() + 1).toString().padStart(2, "0"); + const day = date.getDate().toString().padStart(2, "0"); + return `${month}-${day}`; } function formatTag(tag: string[]) { - return tag.map(t => `#${t}`).join(' ') + return tag.map((t) => `#${t}`).join(" "); } --- diff --git a/src/components/ConfigCarrier.astro b/src/components/ConfigCarrier.astro index 3cecd5b0..68b3dde4 100644 --- a/src/components/ConfigCarrier.astro +++ b/src/components/ConfigCarrier.astro @@ -1,6 +1,6 @@ --- -import { siteConfig } from '../config' +import { siteConfig } from "../config"; ---