Skip to content

Commit

Permalink
build: lint astro files
Browse files Browse the repository at this point in the history
  • Loading branch information
anglepoised committed Jan 11, 2024
1 parent 21d32bc commit d712886
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 23 deletions.
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions src/components/BaseHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,4 @@ const {
<script
data-goatcounter="https://anglepoised.goatcounter.com/count"
async
src="https://gc.zgo.at/count.js"
></script>
src="https://gc.zgo.at/count.js"></script>
2 changes: 1 addition & 1 deletion src/layouts/error.astro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const {
} = Astro.props;
---

<!DOCTYPE html>
<!doctype html>
<html lang="en-gb">
<head>
<BaseHead title={title} description={description} notCanonical />
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/page.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -33,7 +33,7 @@ const {
} = Astro.props;
---

<!DOCTYPE html>
<!doctype html>
<html lang="en-gb">
<head>
<BaseHead title={title} description={description} />
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/posts/bookmark.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -40,7 +40,7 @@ const {
} = Astro.props;
---

<!DOCTYPE html>
<!doctype html>
<html lang="en-gb">
<head>
<BaseHead title={title} description={description} />
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/posts/post.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -33,7 +33,7 @@ const {
} = Astro.props;
---

<!DOCTYPE html>
<!doctype html>
<html lang="en-gb">
<head>
<BaseHead title={title} description={description} />
Expand Down
6 changes: 3 additions & 3 deletions src/layouts/posts/quote.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -33,7 +33,7 @@ const {
} = Astro.props;
---

<!DOCTYPE html>
<!doctype html>
<html lang="en-gb">
<head>
<BaseHead title={title} description={description} />
Expand Down
6 changes: 3 additions & 3 deletions src/pages/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
---

<!DOCTYPE html>
<!doctype html>
<html lang="en-gb">
<head>
<BaseHead title={} description={SITE_DESCRIPTION} />
Expand Down Expand Up @@ -57,7 +57,7 @@ const posts = (await Astro.glob("./notes/**/*.{md,mdx}")).sort(
year: "numeric",
month: "short",
day: "numeric",
}
},
)}
</time>
<a href={post.url}>{post.frontmatter.title}</a>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/notes/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
---

<!DOCTYPE html>
<!doctype html>
<html lang="en-gb">
<head>
<BaseHead title="Notes" description={SITE_DESCRIPTION} />
Expand Down Expand Up @@ -49,7 +49,7 @@ const posts = (await Astro.glob("./**/*.{md,mdx}")).sort(
year: "numeric",
month: "short",
day: "numeric",
}
},
)}
</time>
<a href={post.url}>{post.frontmatter.title}</a>
Expand Down

0 comments on commit d712886

Please sign in to comment.