Skip to content

Commit 237ab40

Browse files
korosuke613kiba-renovate[bot]
authored andcommitted
refactor: format on biome 1.6 for astro
1 parent cb7c33c commit 237ab40

File tree

16 files changed

+262
-281
lines changed

16 files changed

+262
-281
lines changed

.eslintrc

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,10 @@
22
// Configuration for JavaScript files
33
"extends": [
44
"airbnb-base",
5-
"plugin:prettier/recommended",
65
"plugin:astro/recommended",
76
"plugin:storybook/recommended"
87
],
9-
"rules": {
10-
"prettier/prettier": [
11-
"error",
12-
{
13-
"singleQuote": true,
14-
"endOfLine": "auto"
15-
}
16-
]
17-
},
8+
"rules": {},
189
"ignorePatterns": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx", "**/*.mjs"],
1910
"overrides": [
2011
// Configuration for Astro
@@ -34,6 +25,14 @@
3425
"ignore": ["@/*", "astro:content", "astro:assets"]
3526
}
3627
],
28+
"import/order": "off",
29+
"quotes": "off",
30+
"indent": "off",
31+
"max-len": "off",
32+
"object-curly-newline": "off",
33+
"operator-linebreak": "off",
34+
"implicit-arrow-linebreak": "off",
35+
"function-paren-newline": "off",
3736
"import/extensions": [
3837
"error",
3938
"ignorePackages",

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"[astro]": {
2626
"editor.formatOnSave": true,
27-
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
27+
"editor.defaultFormatter": "astro-build.astro-vscode",
2828
"editor.codeActionsOnSave": {
2929
"source.fixAll.eslint": "explicit"
3030
}

src/pages/blogs/[...page].astro

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
---
2-
import Blogs from '@/templates/Blogs.astro';
3-
import type { BlogPage } from '@/types/IBlogPage';
4-
import { getSortedBlogData } from '@/utils/Blog';
2+
import Blogs from "@/templates/Blogs.astro";
3+
import type { BlogPage } from "@/types/IBlogPage";
4+
import { getSortedBlogData } from "@/utils/Blog";
5+
import type { GetStaticPathsOptions } from "astro";
56
6-
type GetStaticPaths = {
7-
paginate: any;
8-
}; // Overrides `GetStaticPathsOptions` types from Astro
9-
10-
export async function getStaticPaths({ paginate }: GetStaticPaths) {
7+
export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
118
const sortedBlogs = await getSortedBlogData();
129
1310
return paginate(sortedBlogs, { pageSize: 9 });

src/pages/blogs/tag/[tag]/[...page].astro

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
---
2-
import Blogs from '@/templates/Blogs.astro';
3-
import type { BlogPage } from '@/types/IBlogPage';
4-
import { getSortedBlogData } from '@/utils/Blog';
5-
import { escapeTag, readTags } from '@/utils/Tag';
2+
import Blogs from "@/templates/Blogs.astro";
3+
import type { BlogPage } from "@/types/IBlogPage";
4+
import { getSortedBlogData } from "@/utils/Blog";
5+
import { escapeTag, readTags } from "@/utils/Tag";
6+
import type { GetStaticPathsOptions } from "astro";
67
7-
type GetStaticPaths = {
8-
paginate: any;
9-
}; // Overrides `GetStaticPathsOptions` types from Astro
10-
11-
export async function getStaticPaths({ paginate }: GetStaticPaths) {
8+
export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
129
const sorteBlogs = await getSortedBlogData();
1310
1411
const tags = (await readTags()).blogs;
1512
if (tags === undefined) {
16-
throw new Error('readed tags is undefined');
13+
throw new Error("readed tags is undefined");
1714
}
1815
1916
return Object.keys(tags).flatMap((tagName) => {
@@ -36,7 +33,7 @@ interface Props {
3633
const { page } = Astro.props as Props;
3734
const { tag } = Astro.params;
3835
39-
const originTag = (tag as string).replace('_', '/');
36+
const originTag = (tag as string).replace("_", "/");
4037
---
4138

4239
<meta name="robots" content="noindex" />

src/pages/blogs/year/[year]/[...page].astro

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
---
2-
import Blogs from '@/templates/Blogs.astro';
3-
import type { BlogPage } from '@/types/IBlogPage';
4-
import { getSortedBlogData } from '@/utils/Blog';
5-
import { readYears } from '@/utils/Year';
2+
import Blogs from "@/templates/Blogs.astro";
3+
import type { BlogPage } from "@/types/IBlogPage";
4+
import { getSortedBlogData } from "@/utils/Blog";
5+
import { readYears } from "@/utils/Year";
6+
import type { GetStaticPathsOptions } from "astro";
67
7-
type GetStaticPaths = {
8-
paginate: any;
9-
}; // Overrides `GetStaticPathsOptions` types from Astro
10-
11-
export async function getStaticPaths({ paginate }: GetStaticPaths) {
8+
export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
129
const sortedBlogs = await getSortedBlogData();
1310
1411
const years = await readYears();

src/pages/index.astro

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
---
2-
import { getCollection } from 'astro:content';
2+
import { getCollection } from "astro:content";
33
4-
import { RecentBlogs } from '@/partials/RecentBlogs';
5-
import { RecentPickup } from '@/partials/RecentPickup';
6-
import { RecentPosts } from '@/partials/RecentPosts';
7-
import Base from '@/templates/Base.astro';
4+
import { RecentBlogs } from "@/partials/RecentBlogs";
5+
import { RecentPickup } from "@/partials/RecentPickup";
6+
import { RecentPosts } from "@/partials/RecentPosts";
7+
import Base from "@/templates/Base.astro";
88
9-
import SelfIntroduction from '@/templates/SelfIntroduction.astro';
10-
import type { IPost } from '@/types/IArticleFrontmatter';
11-
import { AppConfig } from '@/utils/AppConfig';
12-
import { getSortedBlogData } from '@/utils/Blog';
13-
import { sortByDate, sortByOrder } from '@/utils/Posts';
14-
import { DormitoryIntroduction } from '@/utils/StaticPages';
15-
import { readTags } from '@/utils/Tag';
9+
import SelfIntroduction from "@/templates/SelfIntroduction.astro";
10+
import type { IPost } from "@/types/IArticleFrontmatter";
11+
import { AppConfig } from "@/utils/AppConfig";
12+
import { getSortedBlogData } from "@/utils/Blog";
13+
import { sortByDate, sortByOrder } from "@/utils/Posts";
14+
import { DormitoryIntroduction } from "@/utils/StaticPages";
15+
import { readTags } from "@/utils/Tag";
1616
1717
const tags = await readTags();
1818
19-
const allPosts: IPost[] = await getCollection('posts', ({ data }) => {
20-
return data.draft !== true;
21-
});
19+
const allPosts: IPost[] = await getCollection(
20+
"posts",
21+
({ data }) => data.draft !== true,
22+
);
2223
allPosts.push(DormitoryIntroduction);
2324
2425
const nonDraftPosts = allPosts.filter((post) => !post.data.draft);
2526
const sortedPosts = sortByDate(nonDraftPosts);
2627
const lastThreePosts = sortedPosts.slice(0, 3);
2728
2829
const nonDraftPickup = allPosts.filter(
29-
(post) => post.data.tags.includes('Pickup ⭐️') && !post.data.draft,
30+
(post) => post.data.tags.includes("Pickup ⭐️") && !post.data.draft,
3031
);
3132
const sortedPickup = sortByOrder(nonDraftPickup);
3233
const lastThreePickup = sortedPickup.slice(0, 3);

src/pages/posts/[...page].astro

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
---
22
// import type { CollectionEntry } from 'astro:content';
3-
import { getCollection } from 'astro:content';
3+
import { getCollection } from "astro:content";
44
5-
import Content from '@/templates/Content.astro';
5+
import Content from "@/templates/Content.astro";
66
import type {
77
ArticleFrontmatterPage,
88
IPost,
9-
} from '@/types/IArticleFrontmatter';
10-
import { sortByDate } from '@/utils/Posts';
11-
import { DormitoryIntroduction } from '@/utils/StaticPages';
12-
13-
type GetStaticPaths = {
14-
paginate: any;
15-
}; // Overrides `GetStaticPathsOptions` types from Astro
9+
} from "@/types/IArticleFrontmatter";
10+
import { sortByDate } from "@/utils/Posts";
11+
import { DormitoryIntroduction } from "@/utils/StaticPages";
12+
import type { GetStaticPathsOptions } from "astro";
1613
1714
export async function getNonDraftPosts() {
18-
const allPosts: IPost[] = await getCollection('posts', ({ data }) => {
19-
return data.draft !== true;
20-
});
15+
const allPosts: IPost[] = await getCollection(
16+
"posts",
17+
({ data }) => data.draft !== true,
18+
);
2119
allPosts.push(DormitoryIntroduction);
2220
2321
return allPosts;
2422
}
2523
26-
export async function getStaticPaths({ paginate }: GetStaticPaths) {
24+
export async function getStaticPaths({ paginate }: GetStaticPathsOptions) {
2725
const nonDraftPosts = await getNonDraftPosts();
2826
const sortedPosts = sortByDate(nonDraftPosts);
2927

src/pages/posts/[...slug].astro

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
---
2-
import { getCollection } from 'astro:content';
3-
import type { CollectionEntry } from 'astro:content';
2+
import { getCollection } from "astro:content";
3+
import type { CollectionEntry } from "astro:content";
44
5-
import { ContentPost } from '@/partials/ContentPost';
6-
import Base from '@/templates/Base.astro';
7-
import { AppConfig } from '@/utils/AppConfig';
8-
import { readTags } from '@/utils/Tag';
9-
import { getSimilarPosts } from '@/utils/TextSimilarity';
10-
import { getCommitHistories } from '@/utils/CommitHistories';
11-
import { DormitoryIntroduction } from '@/utils/StaticPages';
5+
import { ContentPost } from "@/partials/ContentPost";
6+
import Base from "@/templates/Base.astro";
7+
import { AppConfig } from "@/utils/AppConfig";
8+
import { getCommitHistories } from "@/utils/CommitHistories";
9+
import { DormitoryIntroduction } from "@/utils/StaticPages";
10+
import { readTags } from "@/utils/Tag";
11+
import { getSimilarPosts } from "@/utils/TextSimilarity";
1212
1313
export async function getStaticPaths() {
14-
const blogEntries = await getCollection('posts', ({ data }) => {
15-
return data.draft !== true;
16-
});
14+
const blogEntries = await getCollection(
15+
"posts",
16+
({ data }) => data.draft !== true,
17+
);
1718
return blogEntries.map((entry) => ({
1819
params: { slug: entry.slug },
1920
props: { entry },
@@ -26,22 +27,20 @@ const { Content, headings } = await entry.render();
2627
const title = `${entry.data.title} - ${AppConfig.site_name}`;
2728
const tags = await readTags();
2829
29-
const entries = await getCollection('posts', ({ data }) => {
30-
return data.draft !== true;
31-
});
30+
const entries = await getCollection("posts", ({ data }) => data.draft !== true);
3231
// 国際交流宿舎の紹介用の特別措置
33-
entries.push(DormitoryIntroduction as unknown as CollectionEntry<'posts'>);
32+
entries.push(DormitoryIntroduction as unknown as CollectionEntry<"posts">);
3433
3534
const similars = getSimilarPosts(entry, entries);
3635
3736
const filePath = `src/content/posts/${entry.id}`;
3837
const histories = await getCommitHistories(filePath);
3938
4039
const ogpUrl = entry.data.imgSrc
41-
? new URL(entry.data.imgSrc, 'https://korosuke613.dev/').toString()
40+
? new URL(entry.data.imgSrc, "https://korosuke613.dev/").toString()
4241
: undefined;
4342
44-
const description = entry.data.description || '';
43+
const description = entry.data.description || "";
4544
---
4645

4746
<Base
@@ -53,7 +52,7 @@ const description = entry.data.description || '';
5352
>
5453
<ContentPost
5554
frontmatter={entry}
56-
contentCategory={'Posts'}
55+
contentCategory={"Posts"}
5756
headings={headings}
5857
similars={similars}
5958
histories={histories}

0 commit comments

Comments
 (0)