Skip to content

Commit d629b75

Browse files
authored
repo: update biome.json to lint website (#2807)
Update biome.json and lint website Signed-off-by: gpbl <io@gpbl.dev>
1 parent 329fe4a commit d629b75

17 files changed

+142
-163
lines changed

biome.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
"files": {
99
"ignoreUnknown": false,
1010
"includes": [
11-
"*.md",
1211
"*.ts",
1312
"*.tsx",
1413
"*.js",
1514
"src/**/*.ts",
1615
"src/**/*.tsx",
1716
"examples/**/*.ts",
18-
"examples/**/*.tsx"
17+
"examples/**/*.tsx",
18+
"website/*.ts",
19+
"website/src/**/*.ts",
20+
"website/src/**/*.tsx",
21+
"examples-app/src/**/*.ts",
22+
"examples-app/src/**/*.tsx"
1923
]
2024
},
2125
"formatter": {

examples-app/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ function App() {
2323
}
2424
}, []);
2525

26+
// biome-ignore lint: suspicious/noDynamicNamespaceImportAccess: not a concern
2627
const Component: React.ComponentType = Examples[
2728
example as keyof typeof Examples
2829
] as React.ComponentType;

examples-app/src/main.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import ReactDOM from "react-dom/client";
55
import App from "./App.tsx";
66
import "./index.css";
77

8-
ReactDOM.createRoot(document.getElementById("root")!).render(
8+
ReactDOM.createRoot(document.getElementById("root") ?? document.body).render(
99
<React.StrictMode>
1010
<App />
11-
</React.StrictMode>
11+
</React.StrictMode>,
1212
);

react-day-picker.code-workspace

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,31 +25,16 @@
2525
],
2626
"settings": {
2727
"cSpell.enabled": true,
28-
"editor.defaultFormatter": "biomejs.biome",
29-
"editor.formatOnSave": true,
30-
"editor.formatOnType": true,
28+
"editor.codeActionsOnSave": {
29+
"source.organizeImports.biome": "explicit",
30+
"source.fixAll.biome": "explicit"
31+
},
3132
"editor.tabSize": 2,
3233
"npm.packageManager": "pnpm",
3334
"search.exclude": {
3435
"node_modules": true,
3536
"versioned_docs": true
3637
},
3738
"jest.runMode": "on-demand",
38-
"workbench.colorCustomizations": {
39-
"activityBar.background": "#005994",
40-
"activityBar.foreground": "#d8d8d8",
41-
"activityBar.inactiveForeground": "#d8d8d877",
42-
"activityBarBadge.background": "#dd006f",
43-
"activityBarBadge.foreground": "#e7e7e7"
44-
},
45-
"[typescript]": {
46-
"editor.defaultFormatter": "biomejs.biome"
47-
},
48-
"[typescriptreact]": {
49-
"editor.defaultFormatter": "biomejs.biome"
50-
},
51-
"[json]": {
52-
"editor.defaultFormatter": "biomejs.biome"
53-
}
5439
}
5540
}

website/docusaurus.config.ts

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const config: Config = {
1919

2020
i18n: {
2121
defaultLocale: "en",
22-
locales: ["en"]
22+
locales: ["en"],
2323
},
2424

2525
presets: [
@@ -33,25 +33,25 @@ const config: Config = {
3333
editUrl: "https://github.com/gpbl/react-day-picker/tree/main/website",
3434
remarkPlugins: [
3535
require("@docusaurus/remark-plugin-npm2yarn"),
36-
[require("remark-github"), { repository: "gpbl/react-day-picker" }]
36+
[require("remark-github"), { repository: "gpbl/react-day-picker" }],
3737
],
3838
lastVersion: "current",
3939
versions: {
4040
"8.10.1": {
4141
label: "8.10.1",
4242
badge: true,
43-
path: "/v8"
43+
path: "/v8",
4444
},
4545
current: {
4646
label: `${pkg.version}`,
4747
path: "/",
48-
badge: false
49-
}
50-
}
48+
badge: false,
49+
},
50+
},
5151
},
5252
blog: false,
5353
theme: {
54-
customCss: ["./src/css/custom.css", "../src/style.css"]
54+
customCss: ["./src/css/custom.css", "../src/style.css"],
5555
},
5656
sitemap: {
5757
lastmod: "date",
@@ -63,40 +63,40 @@ const config: Config = {
6363
const { defaultCreateSitemapItems, ...rest } = params;
6464
const items = await defaultCreateSitemapItems(rest);
6565
return items.filter((item) => !item.url.includes("/page/"));
66-
}
67-
}
68-
} satisfies Preset.Options
69-
]
66+
},
67+
},
68+
} satisfies Preset.Options,
69+
],
7070
],
7171

7272
plugins: [
7373
[
7474
"docusaurus-plugin-typedoc",
7575
{
7676
entryPoints: ["../src/index.ts"],
77-
tsconfig: "../tsconfig-docs.json"
78-
}
77+
tsconfig: "../tsconfig-docs.json",
78+
},
7979
],
8080
[
8181
"@docusaurus/plugin-client-redirects",
8282
{
8383
redirects: [
8484
{
8585
to: "/guides/accessibility",
86-
from: ["/docs/accessibility"]
87-
}
88-
]
89-
}
90-
]
86+
from: ["/docs/accessibility"],
87+
},
88+
],
89+
},
90+
],
9191
],
9292

9393
scripts: [
9494
{
9595
src: "/q/p/script.js",
9696
defer: true,
9797
"data-domain": "daypicker.dev",
98-
"data-api": "/q/a/event"
99-
}
98+
"data-api": "/q/a/event",
99+
},
100100
],
101101

102102
themeConfig: {
@@ -105,25 +105,25 @@ const config: Config = {
105105
{
106106
name: "og:description",
107107
content:
108-
"Date picker component for React. Add date pickers, calendars, and date inputs to your web applications."
108+
"Date picker component for React. Add date pickers, calendars, and date inputs to your web applications.",
109109
},
110110
{
111111
name: "description",
112112
content:
113-
"Date picker component for React. Add date pickers, calendars, and date inputs to your web applications."
113+
"Date picker component for React. Add date pickers, calendars, and date inputs to your web applications.",
114114
},
115115
{
116116
name: "keywords",
117117
content:
118-
"date picker, react component, calendar component, react datepicker, daypicker, react day picker, date-fns date picker, typescript date picker"
119-
}
118+
"date picker, react component, calendar component, react datepicker, daypicker, react day picker, date-fns date picker, typescript date picker",
119+
},
120120
],
121121
navbar: {
122122
title: "React DayPicker",
123123
logo: {
124124
alt: "DayPicker Logo",
125125
src: "img/logo.png",
126-
srcDark: "img/logo-dark.png"
126+
srcDark: "img/logo-dark.png",
127127
},
128128
items: [
129129
{
@@ -134,62 +134,62 @@ const config: Config = {
134134
dropdownItemsAfter: [
135135
{
136136
href: "https://react-day-picker-v7.netlify.app",
137-
label: "7.4.10"
138-
}
139-
]
137+
label: "7.4.10",
138+
},
139+
],
140140
},
141141
{
142142
type: "docSidebar",
143143
sidebarId: "docs",
144144
position: "left",
145-
label: "Documentation"
145+
label: "Documentation",
146146
},
147147
{
148148
href: "/playground",
149149
label: "Playground",
150-
position: "left"
150+
position: "left",
151151
},
152152
{
153153
type: "docSidebar",
154154
sidebarId: "api",
155155
position: "left",
156-
label: "API Reference"
156+
label: "API Reference",
157157
},
158158

159159
{
160160
href: "https://github.com/gpbl/react-day-picker/discussions",
161161
label: "Support",
162-
position: "right"
162+
position: "right",
163163
},
164164
{
165165
href: "https://github.com/gpbl/react-day-picker",
166166
label: "GitHub",
167-
position: "right"
168-
}
169-
]
167+
position: "right",
168+
},
169+
],
170170
},
171171
footer: undefined,
172172
prism: {
173173
additionalLanguages: ["bash", "diff", "json", "css"],
174174
theme: prismThemes.vsLight,
175-
darkTheme: prismThemes.dracula
175+
darkTheme: prismThemes.dracula,
176176
},
177177
algolia: {
178178
appId: "N44150BS2A",
179179
apiKey: "263c558c76fc0b83a5def5fb818391d7",
180180
indexName: "react-day-picker-js",
181181
contextualSearch: true,
182-
searchPagePath: "search"
182+
searchPagePath: "search",
183183
},
184184
colorMode: {
185185
defaultMode: "light",
186-
respectPrefersColorScheme: true
187-
}
186+
respectPrefersColorScheme: true,
187+
},
188188
},
189189
future: {
190190
v4: true,
191-
experimental_faster: true
192-
} satisfies Preset.ThemeConfig
191+
experimental_faster: true,
192+
} satisfies Preset.ThemeConfig,
193193
};
194194

195195
export default config;

website/sidebars.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ const typedocSidebarFixed = typedocSidebar.map((item) => {
1212
return {
1313
type: "doc",
1414
id: "api/classes/DateLib",
15-
label: "DateLib"
15+
label: "DateLib",
1616
};
1717
}
1818
return item;
19-
})
19+
}),
2020
};
2121
}
2222
return item;
@@ -36,9 +36,9 @@ const sidebars: SidebarsConfig = {
3636
items: [
3737
{
3838
type: "autogenerated",
39-
dirName: "docs"
40-
}
41-
]
39+
dirName: "docs",
40+
},
41+
],
4242
},
4343
{
4444
type: "category",
@@ -47,9 +47,9 @@ const sidebars: SidebarsConfig = {
4747
items: [
4848
{
4949
type: "autogenerated",
50-
dirName: "guides"
51-
}
52-
]
50+
dirName: "guides",
51+
},
52+
],
5353
},
5454
{
5555
type: "category",
@@ -58,12 +58,12 @@ const sidebars: SidebarsConfig = {
5858
items: [
5959
{
6060
type: "autogenerated",
61-
dirName: "development"
62-
}
63-
]
64-
}
61+
dirName: "development",
62+
},
63+
],
64+
},
6565
],
66-
api: ["api/index", typedocSidebarFixed]
66+
api: ["api/index", typedocSidebarFixed],
6767
};
6868

6969
export default sidebars;

website/src/components/BrowserWindow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function BrowserWindow({
2525
style,
2626
bodyStyle,
2727
shadow = true,
28-
styleStr
28+
styleStr,
2929
}: Props) {
3030
return (
3131
<div className={styles.browserWindow} style={{ ...style, minHeight }}>

website/src/components/HighlightWithTheme.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React from "react";
2-
1+
/** biome-ignore-all lint/suspicious/noArrayIndexKey: not a concern */
32
import { usePrismTheme } from "@docusaurus/theme-common";
4-
import { Highlight, HighlightProps } from "prism-react-renderer";
3+
import { Highlight, type HighlightProps } from "prism-react-renderer";
54

65
export function HighlightWithTheme(props: Partial<HighlightProps>) {
76
const prismTheme = usePrismTheme();
@@ -13,11 +12,7 @@ export function HighlightWithTheme(props: Partial<HighlightProps>) {
1312
return (
1413
<div key={i}>
1514
{line.map((token, key) => {
16-
return (
17-
<>
18-
<span key={key} {...getTokenProps({ token })} />
19-
</>
20-
);
15+
return <span key={key} {...getTokenProps({ token })} />;
2116
})}
2217
</div>
2318
);

0 commit comments

Comments
 (0)