Skip to content

Commit 1bd36c3

Browse files
fix biome
1 parent aa65a22 commit 1bd36c3

File tree

31 files changed

+191
-203
lines changed

31 files changed

+191
-203
lines changed

.vscode/settings.json

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
{
2+
"[javascript]": {
3+
"editor.defaultFormatter": "biomejs.biome"
4+
},
5+
"editor.codeActionsOnSave": {
6+
"source.action.useSortedKeys.biome": "explicit",
7+
"source.fixAll.biome": "explicit"
8+
},
9+
"editor.defaultFormatter": "biomejs.biome",
210
"editor.formatOnSave": true,
311
"javascript.updateImportsOnFileMove.enabled": "always",
4-
"typescript.updateImportsOnFileMove.enabled": "always",
5-
"editor.formatOnPaste": true,
6-
"editor.wordWrap": "wordWrapColumn",
7-
"editor.wordWrapColumn": 100,
8-
"[markdown]": {
9-
"editor.wordWrap": "off"
10-
}
12+
"typescript.updateImportsOnFileMove.enabled": "always"
1113
}

app/article/[[...categories]]/page.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
import type { Metadata } from 'next';
2+
import type { FC } from 'react';
13
import { CategoriesSelector } from '~/components/Common/CategoriesSelector/index.tsx';
24
import { ArticleCard } from '~/components/Post/ArticleCard/index.tsx';
35
import { getPostsMetadata } from '~/lib/post.ts';
4-
import type { FC } from 'react';
5-
import type { Metadata } from 'next';
66

77
type CategoriesParams = {
88
categories?: string[];
@@ -37,7 +37,7 @@ const CATEGORIES = [
3737
export const generateStaticParams = () => {
3838
const params = [
3939
{ categories: [] }, // For the base route without any categories
40-
...CATEGORIES.slice(1).map(category => ({ categories: [category.slug] })), // For each individual category
40+
...CATEGORIES.slice(1).map((category) => ({ categories: [category.slug] })), // For each individual category
4141
];
4242

4343
return params;
@@ -49,8 +49,8 @@ export const generateMetadata = async ({
4949
const currentCategories = (await params).categories || [];
5050

5151
return {
52-
title: `Articles${currentCategories.length > 0 ? ` - ${currentCategories.join(', ')}` : ''}`,
5352
description: 'Here you can find all the articles available on the website.',
53+
title: `Articles${currentCategories.length > 0 ? ` - ${currentCategories.join(', ')}` : ''}`,
5454
};
5555
};
5656

@@ -66,8 +66,8 @@ const Page: FC<PageProps> = async ({ params }) => {
6666
filter them by category using the dropdown below.
6767
</p>
6868
<CategoriesSelector
69-
currentCategories={currentCategories}
7069
categories={CATEGORIES}
70+
currentCategories={currentCategories}
7171
/>
7272
{postsMetadata.length === 0 ? (
7373
<div className="mt-8">
@@ -77,7 +77,7 @@ const Page: FC<PageProps> = async ({ params }) => {
7777
</div>
7878
) : (
7979
<div className="grid grid-cols-1 justify-center gap-4 md:grid-cols-2 lg:grid-cols-3">
80-
{postsMetadata.map(post => (
80+
{postsMetadata.map((post) => (
8181
<ArticleCard key={post.slug} {...post} />
8282
))}
8383
</div>

app/article/post/[article]/page.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
import type { Metadata } from 'next';
12
import { notFound } from 'next/navigation';
3+
import type { FC } from 'react';
4+
import { ArticleHeader } from '~/components/Post/ArticleHeader/index.tsx';
25
import { getContent } from '~/lib/content.ts';
36
import { getAllPosts } from '~/lib/post.ts';
4-
import { ArticleHeader } from '~/components/Post/ArticleHeader/index.tsx';
5-
import type { FC } from 'react';
6-
import type { Metadata } from 'next';
77
import type { PostFrontmatter } from '~/types/frontmatter';
88
import '~/styles/markdown.css';
99

@@ -18,7 +18,7 @@ type PageProps = {
1818
export async function generateStaticParams() {
1919
const posts = await getAllPosts();
2020

21-
return posts.map(post => {
21+
return posts.map((post) => {
2222
const article = post.split('.').slice(0, -1).join('.');
2323
return { article };
2424
});
@@ -37,8 +37,8 @@ export async function generateMetadata({
3737
const { frontmatter } = mdxResult;
3838

3939
return {
40-
title: frontmatter.title,
4140
description: frontmatter.description,
41+
title: frontmatter.title,
4242
};
4343
}
4444

@@ -55,9 +55,9 @@ const Page: FC<PageProps> = async ({ params }) => {
5555
return (
5656
<main className="container mx-auto px-4">
5757
<ArticleHeader
58-
title={frontmatter.title}
59-
description={frontmatter.description}
6058
authors={frontmatter.authors}
59+
description={frontmatter.description}
60+
title={frontmatter.title}
6161
/>
6262
<article className="md-content">{content}</article>
6363
</main>

app/layout.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import classNames from 'classnames';
2-
import { GeistSans } from 'geist/font/sans';
32
import { GeistMono } from 'geist/font/mono';
4-
import { Header } from '~/components/Sections/Header/index.tsx';
5-
import type { FC, PropsWithChildren } from 'react';
3+
import { GeistSans } from 'geist/font/sans';
64
import type { Metadata } from 'next';
5+
import type { FC, PropsWithChildren } from 'react';
6+
import { Header } from '~/components/Sections/Header/index.tsx';
77
import '~/styles/globals.css';
88

99
const metadata: Metadata = {
10-
title: 'Nodejs-Loaders',
1110
description: 'A collection of loaders for Node.js',
11+
title: 'Nodejs-Loaders',
1212
};
1313

1414
const RootLayout: FC<PropsWithChildren> = ({ children }) => (

app/not-found.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { NotFoundSection } from '~/components/Sections/NotFound';
21
import type { FC } from 'react';
2+
import { NotFoundSection } from '~/components/Sections/NotFound';
33

44
const NotFoundPage: FC = () => <NotFoundSection />;
55

app/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import type { FC } from 'react';
12
import { Hero } from '~/components/Landing/Hero/index.tsx';
23
import { LatestArticleSection } from '~/components/Landing/LastestArticleSection/index.tsx';
3-
import type { FC } from 'react';
44

55
const Page: FC = () => (
66
<main>

app/robots.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ export const dynamic = 'force-static';
55

66
export default function robots(): MetadataRoute.Robots {
77
return {
8+
host: 'https://nodejs-loaders.github.io',
89
rules: {
9-
userAgent: '*',
1010
allow: '/',
11+
userAgent: '*',
1112
},
12-
host: 'https://nodejs-loaders.github.io',
1313
};
1414
}

biome.jsonc

Lines changed: 54 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,75 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3-
"files": {
4-
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.css", "**/*.json"],
5-
"ignore": ["./node_modules", "./.next", "./out"]
2+
"$schema": "https://biomejs.dev/schemas/2.1.2/schema.json",
3+
"assist": {
4+
"actions": {
5+
"source": {
6+
"organizeImports": {
7+
"level": "on",
8+
"options": {
9+
"groups": [
10+
":NODE:",
11+
":PACKAGE:",
12+
":ALIAS:",
13+
":PATH:",
14+
{ "type": true }
15+
]
16+
}
17+
},
18+
"useSortedAttributes": "on",
19+
"useSortedKeys": "on",
20+
"useSortedProperties": "on"
21+
}
22+
},
23+
"enabled": true
624
},
7-
"organizeImports": {
8-
"enabled": false
25+
"css": {
26+
"formatter": {
27+
"enabled": true
28+
},
29+
"linter": {
30+
"enabled": true
31+
}
32+
},
33+
"files": {
34+
"includes": [
35+
"**/*.ts",
36+
"**/*.tsx",
37+
"**/*.js",
38+
"**/*.css",
39+
"**/*.json",
40+
"!out/**",
41+
"!.next"
42+
]
943
},
1044
"formatter": {
1145
"enabled": true,
1246
"useEditorconfig": true
1347
},
14-
"linter": {
15-
"rules": {
16-
"recommended": false,
17-
"nursery": {
18-
"useSortedClasses": "error",
19-
"noCommonJs": "error",
20-
"noEnum": "error",
21-
"noUnknownTypeSelector": "error"
22-
},
23-
"complexity": {
24-
"noUselessThisAlias": "error",
25-
"noUselessTypeConstraint": "error"
26-
},
27-
"correctness": {
28-
"noUnusedVariables": "error",
29-
"useArrayLiterals": "off",
30-
"noUnknownFunction": "error",
31-
"noUnknownUnit": "error",
32-
"useImportExtensions": "error"
33-
},
34-
"style": {
35-
"noNamespace": "error",
36-
"useAsConstAssertion": "error",
37-
"useBlockStatements": "off",
38-
"useNodeAssertStrict": "warn",
39-
"useNodejsImportProtocol": "error",
40-
"useImportType": "error"
41-
},
42-
"suspicious": {
43-
"noExplicitAny": "error",
44-
"noExtraNonNullAssertion": "error",
45-
"noMisleadingInstantiator": "error",
46-
"noUnsafeDeclarationMerging": "error",
47-
"useNamespaceKeyword": "error",
48-
"noEmptyBlock": "error",
49-
"noDuplicateAtImportRules": "error",
50-
"noDuplicateObjectKeys": "error"
51-
}
52-
}
53-
},
5448
"javascript": {
5549
"formatter": {
5650
"jsxQuoteStyle": "double",
57-
"quoteProperties": "asNeeded",
58-
"trailingCommas": "es5",
59-
"semicolons": "always",
60-
"arrowParentheses": "asNeeded",
61-
"bracketSameLine": false,
6251
"quoteStyle": "single",
63-
"attributePosition": "auto",
64-
"bracketSpacing": true
52+
"semicolons": "always"
6553
}
6654
},
67-
"css": {
68-
"linter": {
69-
"enabled": true
70-
},
55+
"json": {
7156
"formatter": {
7257
"enabled": true
7358
},
74-
"parser": {
75-
"cssModules": true
59+
"linter": {
60+
"enabled": true
7661
}
7762
},
78-
"json": {
79-
"formatter": {
80-
"enabled": true
63+
"linter": {
64+
"rules": {
65+
"a11y": {
66+
"noSvgWithoutTitle": "off"
67+
},
68+
"recommended": true,
69+
"style": {
70+
"noDescendingSpecificity": "off",
71+
"useNodeAssertStrict": "error"
72+
}
8173
}
8274
}
8375
}

components/Common/AuthorsList/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1+
import type { FC } from 'react';
12
import { getGitHubAvatarUrl, getGithubProfileUrl } from '~/utils/gitHubUtils';
23
import { getAcronymFromString } from '~/utils/stringUtils';
3-
import { Avatar, AvatarImage, AvatarFallback } from '../Avatar/index.tsx';
4-
import type { FC } from 'react';
4+
import { Avatar, AvatarFallback, AvatarImage } from '../Avatar/index.tsx';
55

66
type AuthorsListProps = {
77
// xxx, yyy, zzz
88
authors: string;
99
};
1010

1111
export const AuthorsList: FC<AuthorsListProps> = ({ authors }) => {
12-
const authorsList = authors.split(', ').map(author => (
12+
const authorsList = authors.split(', ').map((author) => (
1313
<Avatar key={author}>
1414
<a
1515
href={getGithubProfileUrl(author)}
16-
target="_blank"
1716
rel="noopener noreferrer"
17+
target="_blank"
1818
>
19-
<AvatarImage src={getGitHubAvatarUrl(author)} alt={author} />
19+
<AvatarImage alt={author} src={getGitHubAvatarUrl(author)} />
2020
<AvatarFallback>{getAcronymFromString(author)}</AvatarFallback>
2121
</a>
2222
</Avatar>

components/Common/Avatar/index.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ const Avatar = ({
99
...props
1010
}: ComponentProps<typeof AvatarPrimitive.Root>) => (
1111
<AvatarPrimitive.Root
12-
ref={ref}
1312
className={classNames(
1413
className,
15-
'flex size-10 shrink-0 overflow-hidden rounded-md shadow-green-300 shadow-sm outline-2 outline-green-300 transition-shadow hover:shadow-green-400 hover:shadow-md dark:shadow-green-800 dark:outline-green-800 hover:dark:shadow-green-700'
14+
'flex size-10 shrink-0 overflow-hidden rounded-md shadow-green-300 shadow-sm outline-2 outline-green-300 transition-shadow hover:shadow-green-400 hover:shadow-md dark:shadow-green-800 dark:outline-green-800 hover:dark:shadow-green-700',
1615
)}
16+
ref={ref}
1717
{...props}
1818
/>
1919
);
@@ -26,8 +26,8 @@ const AvatarImage = ({
2626
...props
2727
}: ComponentProps<typeof AvatarPrimitive.Image>) => (
2828
<AvatarPrimitive.Image
29-
ref={ref}
3029
className={classNames('aspect-square size-full', className)}
30+
ref={ref}
3131
{...props}
3232
/>
3333
);
@@ -40,11 +40,11 @@ const AvatarFallback = ({
4040
...props
4141
}: ComponentProps<typeof AvatarPrimitive.Fallback>) => (
4242
<AvatarPrimitive.Fallback
43-
ref={ref}
4443
className={classNames(
4544
'flex size-full items-center justify-center rounded-md bg-green-100 font-bold text-base text-black dark:bg-green-800 dark:text-white',
46-
className
45+
className,
4746
)}
47+
ref={ref}
4848
{...props}
4949
/>
5050
);

0 commit comments

Comments
 (0)