Skip to content

Commit

Permalink
feat: lint with biome
Browse files Browse the repository at this point in the history
  • Loading branch information
artabr committed Dec 1, 2024
1 parent 09656ee commit bac04ef
Show file tree
Hide file tree
Showing 46 changed files with 1,251 additions and 1,249 deletions.
72 changes: 37 additions & 35 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
{
"$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,
"security": {
"noDangerouslySetInnerHtml": "warn"
},
"a11y": {
"useSemanticElements": "warn",
"useKeyWithClickEvents": "warn"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
"vcs": {
"enabled": false,
"clientKind": "git",
"useIgnoreFile": false
},
"files": {
"ignoreUnknown": false,
"ignore": []
},
"formatter": {
"enabled": true,
"useEditorconfig": true,
"indentStyle": "space",
"indentWidth": 2
},
"organizeImports": {
"enabled": true
},
"linter": {
"enabled": true,
"rules": {
"recommended": true,
"security": {
"noDangerouslySetInnerHtml": "warn"
},
"a11y": {
"useSemanticElements": "warn",
"useKeyWithClickEvents": "warn"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}
4 changes: 2 additions & 2 deletions src/app/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getAuthorBio } from '@/lib/fetch-utils';
import { AboutPage } from '@/components/AboutPage';

export default async function About() {
const data = await getAuthorBio();
const data = await getAuthorBio();

return <AboutPage {...data} />;
return <AboutPage {...data} />;
}
16 changes: 8 additions & 8 deletions src/app/blog/(posts)/[slug]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import { getFileBySlug } from '@/lib/mdx';
import { SinglePost } from '@/components/SinglePost';

async function getData(slug: string) {
return getFileBySlug('blog', slug);
return getFileBySlug('blog', slug);
}

export default async function Blog({ params }: { params: { slug: string } }) {
const data = await getData(params.slug);
const { authorName } = await getAuthorInfo();
const data = await getData(params.slug);
const { authorName } = await getAuthorInfo();

return <SinglePost {...data} authorName={authorName} />;
return <SinglePost {...data} authorName={authorName} />;
}

export async function generateStaticParams() {
const blogs = await getBlogs();
const blogs = await getBlogs();

return blogs.posts.map((post) => ({
slug: slugify(post.slug ?? ''),
}));
return blogs.posts.map((post) => ({
slug: slugify(post.slug ?? ''),
}));
}
50 changes: 25 additions & 25 deletions src/app/blog/(taxonomies)/categories/[category]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,34 @@ import { Pagination } from '@/components/Pagination';
import { Paginator } from '@/components/Paginator';

export default async function Categories({
params,
params,
}: { params: { category: string } }) {
const allPosts = await getAllFilesMetadata<PostInfo>('blog');
const allPostsByCategory = allPosts.filter((post) =>
post.categories?.map((item) => slugify(item)).includes(params.category),
);
const data = allPostsByCategory.slice(0, POSTS_PER_PAGE);
const { authorName } = await getAuthorInfo();

return (
<>
<div className="row">
<Paginator pages={data} authorName={authorName} />
</div>
<div className="row">
<Pagination
itemsNumber={allPostsByCategory.length}
parentPath={`blog/categories/${params.category}`}
/>
</div>
</>
);
const allPosts = await getAllFilesMetadata<PostInfo>('blog');
const allPostsByCategory = allPosts.filter((post) =>
post.categories?.map((item) => slugify(item)).includes(params.category),
);
const data = allPostsByCategory.slice(0, POSTS_PER_PAGE);
const { authorName } = await getAuthorInfo();

return (
<>
<div className="row">
<Paginator pages={data} authorName={authorName} />
</div>
<div className="row">
<Pagination
itemsNumber={allPostsByCategory.length}
parentPath={`blog/categories/${params.category}`}
/>
</div>
</>
);
}

export async function generateStaticParams() {
const blogs = await getBlogs();
const blogs = await getBlogs();

return blogs.categories.map((category) => ({
category: slugify(category ?? ''),
}));
return blogs.categories.map((category) => ({
category: slugify(category ?? ''),
}));
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,41 +12,41 @@ import { Pagination } from '@/components/Pagination';
import { Paginator } from '@/components/Paginator';

export default async function Pages({
params,
params,
}: { params: { category: string; page: string } }) {
const allPosts = await getAllFilesMetadata<PostInfo>('blog');
const pageIndex = Number.parseInt(params.page, 10) - 1;
const allPostsByCategory = allPosts.filter((post) =>
post.categories?.map((item) => slugify(item)).includes(params.category),
);
const data = allPostsByCategory.slice(
pageIndex * POSTS_PER_PAGE,
(pageIndex + 1) * POSTS_PER_PAGE,
);
const { authorName } = await getAuthorInfo();

return (
<>
<div className="row">
<Paginator pages={data} authorName={authorName} />
</div>
<div className="row">
<Pagination
itemsNumber={allPostsByCategory.length}
currentPage={Number(params.page)}
parentPath={`blog/categories/${params.category}`}
/>
</div>
</>
);
const allPosts = await getAllFilesMetadata<PostInfo>('blog');
const pageIndex = Number.parseInt(params.page, 10) - 1;
const allPostsByCategory = allPosts.filter((post) =>
post.categories?.map((item) => slugify(item)).includes(params.category),
);
const data = allPostsByCategory.slice(
pageIndex * POSTS_PER_PAGE,
(pageIndex + 1) * POSTS_PER_PAGE,
);
const { authorName } = await getAuthorInfo();

return (
<>
<div className="row">
<Paginator pages={data} authorName={authorName} />
</div>
<div className="row">
<Pagination
itemsNumber={allPostsByCategory.length}
currentPage={Number(params.page)}
parentPath={`blog/categories/${params.category}`}
/>
</div>
</>
);
}

export async function generateStaticParams() {
const blogs = await getBlogs();
const blogs = await getBlogs();

return getPageNumbers(blogs.posts.length)
.slice(1)
.map((page) => ({
page,
}));
return getPageNumbers(blogs.posts.length)
.slice(1)
.map((page) => ({
page,
}));
}
24 changes: 12 additions & 12 deletions src/app/blog/(taxonomies)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { Sidebar } from '@/app/components/Sidebar';

export default async function TaxonomiesLayout({
children,
children,
}: { children: React.ReactNode }) {
return (
<section className="section pb-0">
<div className="container">
<div className="row">
<div className="col-lg-8 mb-5 mb-lg-0">{children}</div>
{/* @ts-expect-error Async Server Component */}
<Sidebar />
</div>
</div>
</section>
);
return (
<section className="section pb-0">
<div className="container">
<div className="row">
<div className="col-lg-8 mb-5 mb-lg-0">{children}</div>
{/* @ts-expect-error Async Server Component */}
<Sidebar />
</div>
</div>
</section>
);
}
58 changes: 29 additions & 29 deletions src/app/blog/(taxonomies)/pages/[page]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,37 @@ import { Pagination } from '@/components/Pagination';
import { Paginator } from '@/components/Paginator';

export default async function Pages({ params }: { params: { page: string } }) {
const allPosts = await getAllFilesMetadata<PostInfo>('blog');
const pageIndex = Number.parseInt(params.page, 10) - 1;

const data = allPosts.slice(
pageIndex * POSTS_PER_PAGE,
(pageIndex + 1) * POSTS_PER_PAGE,
);
const { authorName } = await getAuthorInfo();

return (
<>
<div className="row">
<Paginator pages={data} authorName={authorName} />
</div>
<div className="row">
<Pagination
itemsNumber={allPosts.length}
currentPage={Number(params.page)}
parentPath="blog"
/>
</div>
</>
);
const allPosts = await getAllFilesMetadata<PostInfo>('blog');
const pageIndex = Number.parseInt(params.page, 10) - 1;

const data = allPosts.slice(
pageIndex * POSTS_PER_PAGE,
(pageIndex + 1) * POSTS_PER_PAGE,
);
const { authorName } = await getAuthorInfo();

return (
<>
<div className="row">
<Paginator pages={data} authorName={authorName} />
</div>
<div className="row">
<Pagination
itemsNumber={allPosts.length}
currentPage={Number(params.page)}
parentPath="blog"
/>
</div>
</>
);
}

export async function generateStaticParams() {
const blogs = await getBlogs();
const blogs = await getBlogs();

return getPageNumbers(blogs.posts.length)
.slice(1)
.map((page) => ({
page,
}));
return getPageNumbers(blogs.posts.length)
.slice(1)
.map((page) => ({
page,
}));
}
Loading

0 comments on commit bac04ef

Please sign in to comment.