From d712886b91a6c41681a56b438540ebaa15d83228 Mon Sep 17 00:00:00 2001 From: Paul Love Date: Thu, 11 Jan 2024 11:03:40 +0000 Subject: [PATCH] build: lint astro files --- .prettierrc.json | 11 +++++++++++ package.json | 4 ++-- src/components/BaseHead.astro | 3 +-- src/layouts/error.astro | 2 +- src/layouts/page.astro | 6 +++--- src/layouts/posts/bookmark.astro | 6 +++--- src/layouts/posts/post.astro | 6 +++--- src/layouts/posts/quote.astro | 6 +++--- src/pages/index.astro | 6 +++--- src/pages/notes/index.astro | 6 +++--- 10 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 .prettierrc.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 000000000..d87faa5de --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,11 @@ +{ + "plugins": ["prettier-plugin-astro"], + "overrides": [ + { + "files": "*.astro", + "options": { + "parser": "astro" + } + } + ] +} diff --git a/package.json b/package.json index 225881b0b..1eb1826e6 100644 --- a/package.json +++ b/package.json @@ -51,7 +51,7 @@ "?dev": "Start Astro development server.", "dev": "astro dev", "?format": "Runs all code formatters.", - "format": "yarn internal:prettier \"./*.{js,json,md,mdx}\" \"./**/*.{js,json,md,mdx}\" --write", + "format": "yarn internal:prettier \"./*.{astro,js,json,md,mdx}\" \"./**/*.{astro,js,json,md,mdx}\" --write", "?info": "Display information about the scripts.", "info": "npm-scripts-info", "internal:prettier": "prettier", @@ -60,7 +60,7 @@ "?lint": "Lint all files", "lint": "npm-run-all lint:*", "lint:commits": "./node_modules/.bin/commitlint --from=origin/main", - "lint:format": "yarn internal:prettier --list-different \"./*.{js,json,md,mdx}\" \"./**/*.{js,json,md,mdx}\"", + "lint:format": "yarn internal:prettier --list-different \"./*.{astro,js,json,md,mdx}\" \"./**/*.{astro,js,json,md,mdx}\"", "?new:bookmark": "Generate a new bookmark scaffold", "new:bookmark": "hygen bookmark new", "?new:post": "Generate a new post scaffold", diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 0ebf3f184..f317354de 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -70,5 +70,4 @@ const { + src="https://gc.zgo.at/count.js"> diff --git a/src/layouts/error.astro b/src/layouts/error.astro index dc381778d..6ac0dc4c7 100644 --- a/src/layouts/error.astro +++ b/src/layouts/error.astro @@ -14,7 +14,7 @@ const { } = Astro.props; --- - + diff --git a/src/layouts/page.astro b/src/layouts/page.astro index 7f8a4ba83..6d5f51454 100644 --- a/src/layouts/page.astro +++ b/src/layouts/page.astro @@ -11,11 +11,11 @@ const dateOptions: Intl.DateTimeFormatOptions = { }; const pubDateLocal = new Date(frontmatter.datePublished).toLocaleDateString( "en-GB", - dateOptions + dateOptions, ); const updatedDateLocal = new Date(frontmatter.dateUpdated).toLocaleDateString( "en-GB", - dateOptions + dateOptions, ); export interface Props { content: { @@ -33,7 +33,7 @@ const { } = Astro.props; --- - + diff --git a/src/layouts/posts/bookmark.astro b/src/layouts/posts/bookmark.astro index d806467b3..0d9c6c552 100644 --- a/src/layouts/posts/bookmark.astro +++ b/src/layouts/posts/bookmark.astro @@ -11,11 +11,11 @@ const dateOptions: Intl.DateTimeFormatOptions = { }; const pubDateLocal = new Date(frontmatter.datePublished).toLocaleDateString( "en-GB", - dateOptions + dateOptions, ); const updatedDateLocal = new Date(frontmatter.dateUpdated).toLocaleDateString( "en-GB", - dateOptions + dateOptions, ); export interface Props { content: { @@ -40,7 +40,7 @@ const { } = Astro.props; --- - + diff --git a/src/layouts/posts/post.astro b/src/layouts/posts/post.astro index ae750d71d..33e3dde58 100644 --- a/src/layouts/posts/post.astro +++ b/src/layouts/posts/post.astro @@ -11,11 +11,11 @@ const dateOptions: Intl.DateTimeFormatOptions = { }; const pubDateLocal = new Date(frontmatter.datePublished).toLocaleDateString( "en-GB", - dateOptions + dateOptions, ); const updatedDateLocal = new Date(frontmatter.dateUpdated).toLocaleDateString( "en-GB", - dateOptions + dateOptions, ); export interface Props { content: { @@ -33,7 +33,7 @@ const { } = Astro.props; --- - + diff --git a/src/layouts/posts/quote.astro b/src/layouts/posts/quote.astro index a2b8b4c5e..6753fc2c6 100644 --- a/src/layouts/posts/quote.astro +++ b/src/layouts/posts/quote.astro @@ -11,11 +11,11 @@ const dateOptions: Intl.DateTimeFormatOptions = { }; const pubDateLocal = new Date(frontmatter.datePublished).toLocaleDateString( "en-GB", - dateOptions + dateOptions, ); const updatedDateLocal = new Date(frontmatter.dateUpdated).toLocaleDateString( "en-GB", - dateOptions + dateOptions, ); export interface Props { content: { @@ -33,7 +33,7 @@ const { } = Astro.props; --- - + diff --git a/src/pages/index.astro b/src/pages/index.astro index dd746582d..4cfe9e010 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -8,11 +8,11 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../config"; const posts = (await Astro.glob("./notes/**/*.{md,mdx}")).sort( (a, b) => new Date(b.frontmatter.datePublished).valueOf() - - new Date(a.frontmatter.datePublished).valueOf() + new Date(a.frontmatter.datePublished).valueOf(), ); --- - + @@ -57,7 +57,7 @@ const posts = (await Astro.glob("./notes/**/*.{md,mdx}")).sort( year: "numeric", month: "short", day: "numeric", - } + }, )} {post.frontmatter.title} diff --git a/src/pages/notes/index.astro b/src/pages/notes/index.astro index 8a81e9f30..1dc020220 100644 --- a/src/pages/notes/index.astro +++ b/src/pages/notes/index.astro @@ -8,11 +8,11 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../../config"; const posts = (await Astro.glob("./**/*.{md,mdx}")).sort( (a, b) => new Date(b.frontmatter.datePublished).valueOf() - - new Date(a.frontmatter.datePublished).valueOf() + new Date(a.frontmatter.datePublished).valueOf(), ); --- - + @@ -49,7 +49,7 @@ const posts = (await Astro.glob("./**/*.{md,mdx}")).sort( year: "numeric", month: "short", day: "numeric", - } + }, )} {post.frontmatter.title}