Skip to content

Commit 28c2bea

Browse files
authored
website: move Prettier config to ESLint, fix warnings (#48)
1 parent 996c2f2 commit 28c2bea

File tree

11 files changed

+53
-66
lines changed

11 files changed

+53
-66
lines changed

website/.prettier.config.mjs

Lines changed: 0 additions & 14 deletions
This file was deleted.

website/app/page.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ export default function Home() {
1414
<Link href="#android" className="w-fit inline-flex">
1515
<h3
1616
id="android"
17-
className="text-lg font-semibold inline-flex items-center gap-3 transition-colors scroll-m-20 hover:text-secondary"
18-
>
17+
className="text-lg font-semibold inline-flex items-center gap-3 transition-colors scroll-m-20 hover:text-secondary">
1918
<AndroidIcon className="border border-border size-10 text-secondary bg-subtle p-2 rounded-lg" />
2019
Android
2120
</h3>
@@ -24,8 +23,7 @@ export default function Home() {
2423
<Link href="#ios" className="w-fit inline-flex">
2524
<h3
2625
id="ios"
27-
className="text-lg font-semibold inline-flex items-center gap-3 transition-colors scroll-m-20 hover:text-secondary"
28-
>
26+
className="text-lg font-semibold inline-flex items-center gap-3 transition-colors scroll-m-20 hover:text-secondary">
2927
<IOSIcon className="border border-border size-10 text-secondary bg-subtle p-2 rounded-lg" />
3028
iOS
3129
</h3>

website/components/Footer.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,13 @@ export default function Footer() {
99
<div
1010
className={twMerge(
1111
"w-full max-w-[1280px] grid grid-cols-4 px-4 mx-auto gap-6",
12-
"max-md:grid-cols-1 max-md:items-center max-md:text-center",
13-
)}
14-
>
12+
"max-md:grid-cols-1 max-md:items-center max-md:text-center"
13+
)}>
1514
<div className="flex flex-col gap-2 pt-1.5">
1615
<Link
1716
href="https://opensource.fb.com/"
1817
className="w-fit max-md:mx-auto"
19-
target="_blank"
20-
>
18+
target="_blank">
2119
<picture>
2220
<img
2321
src="oss-logo.svg"

website/components/GitHubRepoLink.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ export function GitHubRepoLink({ repositoryURL }: Props) {
1616
<a
1717
href={repositoryURL}
1818
target="_blank"
19-
className="transition-opacity hover:opacity-70"
20-
>
19+
className="transition-opacity hover:opacity-70">
2120
<GitHubLogo className="size-3.5 text-secondary" />
2221
</a>
2322
</Tooltip>

website/components/Header.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ export default function Header() {
3232
id="search"
3333
autoComplete="off"
3434
value={query}
35-
onChange={(event) => setQuery(event.target.value)}
35+
onChange={event => setQuery(event.target.value)}
3636
className={twMerge(
3737
"w-full bg-subtle border border-border rounded-3xl pl-10 pr-3 py-1.5",
38-
"placeholder:text-secondary/60",
38+
"placeholder:text-secondary/60"
3939
)}
4040
placeholder="Search…"
4141
/>
@@ -47,16 +47,14 @@ export default function Header() {
4747
className="cursor-pointer p-1.5 rounded-full hover:bg-hover"
4848
onClick={() => {
4949
resolvedTheme === "dark" ? setTheme("light") : setTheme("dark");
50-
}}
51-
>
50+
}}>
5251
<ThemeLightIcon className="text-secondary size-6 hidden dark:block" />
5352
<ThemeDarkIcon className="text-secondary size-6 dark:hidden" />
5453
</div>
5554
<Link
5655
href="https://github.com/react-native-community/nightly-tests"
5756
target="_blank"
58-
className="p-1.5 rounded-full hover:bg-hover"
59-
>
57+
className="p-1.5 rounded-full hover:bg-hover">
6058
<GitHubLogo className="text-secondary size-6" />
6159
</Link>
6260
</div>

website/components/InlineLink.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ export default function InlineLink({
2222
className={twMerge(
2323
"w-fit border-b border-b-transparent transition-[border] inline-flex gap-1 items-center",
2424
"hover:border-b-border",
25-
className,
25+
className
2626
)}
27-
{...rest}
28-
>
27+
{...rest}>
2928
{children}
3029
{computedTarget === "_blank" && (
3130
<ExternalLinkIcon className="size-3.5 text-secondary/50" />

website/components/Table.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export default function Table({ platform }: Props) {
5454
const columns = [
5555
columnHelper.accessor(`installCommand`, {
5656
header: () => <span className="block">Library</span>,
57-
cell: (info) => {
57+
cell: info => {
5858
const entry = info.getValue();
5959
const notes = info.row.original.notes;
6060

@@ -94,12 +94,12 @@ export default function Table({ platform }: Props) {
9494
}),
9595
...Object.keys(data[data.length - 1].results)
9696
.reverse()
97-
.map((date) =>
98-
columnHelper.accessor((row) => row.results?.[date]?.[platform], {
97+
.map(date =>
98+
columnHelper.accessor(row => row.results?.[date]?.[platform], {
9999
id: `results.${date}.${platform}`,
100100
header: () => <span className="block text-xs">{date}</span>,
101101
cell: formatStatus,
102-
}),
102+
})
103103
),
104104
];
105105

@@ -120,24 +120,23 @@ export default function Table({ platform }: Props) {
120120
<div className="border border-border rounded-lg shadow-xs overflow-hidden overflow-x-auto mb-4">
121121
<table className="w-full">
122122
<thead className="bg-subtle">
123-
{table.getHeaderGroups().map((headerGroup) => (
123+
{table.getHeaderGroups().map(headerGroup => (
124124
<tr key={headerGroup.id} className="border-b border-border">
125-
{headerGroup.headers.map((header) => (
125+
{headerGroup.headers.map(header => (
126126
<th
127127
className={twMerge(
128128
"text-sm px-2 py-2 whitespace-nowrap border-r border-border",
129129
"last:!border-r-0",
130130
header.index === 0
131131
? "text-left pl-3 min-w-[300px]"
132-
: "text-center",
132+
: "text-center"
133133
)}
134134
colSpan={header.colSpan}
135135
rowSpan={header.index === 0 ? 2 : 1}
136-
key={header.id}
137-
>
136+
key={header.id}>
138137
{flexRender(
139138
header.column.columnDef.header,
140-
header.getContext(),
139+
header.getContext()
141140
)}
142141
</th>
143142
))}
@@ -146,9 +145,9 @@ export default function Table({ platform }: Props) {
146145
</thead>
147146
<tbody>
148147
{rowsCount > 0 ? (
149-
table.getRowModel().rows.map((row) => (
148+
table.getRowModel().rows.map(row => (
150149
<tr key={row.id} className="even:bg-subtle hover:bg-hover">
151-
{row.getVisibleCells().map((cell) => (
150+
{row.getVisibleCells().map(cell => (
152151
<td
153152
key={cell.id}
154153
className={twMerge(
@@ -158,9 +157,8 @@ export default function Table({ platform }: Props) {
158157
row.index === rowsCount - 1 && "pb-1",
159158
cell.column.getIsFirstColumn()
160159
? "text-left whitespace-nowrap pl-3"
161-
: "text-center",
162-
)}
163-
>
160+
: "text-center"
161+
)}>
164162
{flexRender(cell.column.columnDef.cell, cell.getContext())}
165163
</td>
166164
))}

website/components/Tooltip.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ export default function Tooltip({
3131
<Content
3232
className="bg-black px-2.5 py-1 rounded-md text-xs text-white max-w-[220px] text-center"
3333
sideOffset={sideOffset}
34-
side={side}
35-
>
34+
side={side}>
3635
{content}
3736
<Arrow />
3837
</Content>

website/eslint.config.mjs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ export default defineConfig([
1919
prettierPlugin,
2020
importPlugin.flatConfigs.recommended,
2121

22+
{
23+
rules: {
24+
"prettier/prettier": [
25+
"error",
26+
{
27+
arrowParens: "avoid",
28+
bracketSameLine: true,
29+
printWidth: 80,
30+
singleQuote: false,
31+
trailingComma: "es5",
32+
endOfLine: "auto",
33+
},
34+
],
35+
},
36+
},
37+
2238
{
2339
files: ["**/*.{js,mjs}"],
2440
plugins: {

website/scripts/fetch-data.mjs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,24 @@ dotenv.config({
1212
});
1313

1414
const credential = JSON.parse(
15-
Buffer.from(process.env.FIREBASE_APP_SERVICE_KEY, "base64").toString(
16-
ENCODING,
17-
),
15+
Buffer.from(process.env.FIREBASE_APP_SERVICE_KEY, "base64").toString(ENCODING)
1816
);
1917

2018
const definitions = await fs.readFile("../libraries.json", ENCODING);
2119
const definitionsJSON = JSON.parse(definitions);
2220

2321
async function fetchDirectoryData(libraries) {
2422
return Promise.all(
25-
libraries.map(async (lib) => {
23+
libraries.map(async lib => {
2624
const packageName = getCleanPackageName(lib);
2725
try {
2826
const response = await fetch(
29-
`https://reactnative.directory/api/libraries?search=${packageName}`,
27+
`https://reactnative.directory/api/libraries?search=${packageName}`
3028
);
3129

3230
if (!response.ok) {
3331
throw new Error(
34-
`❌ HTTP ${response.status} - Cannot fetch directory data for ${packageName}`,
32+
`❌ HTTP ${response.status} - Cannot fetch directory data for ${packageName}`
3533
);
3634
}
3735

@@ -41,7 +39,7 @@ async function fetchDirectoryData(libraries) {
4139
console.error(error);
4240
process.exit(1);
4341
}
44-
}),
42+
})
4543
);
4644
}
4745

@@ -63,7 +61,7 @@ async function main() {
6361

6462
const tableDataMap = new Map();
6563
const trimmedData = Object.entries(data["nightly-results"]).slice(
66-
-DAYS_TO_SHOW,
64+
-DAYS_TO_SHOW
6765
);
6866

6967
for (const [date, entries] of trimmedData) {
@@ -78,13 +76,13 @@ async function main() {
7876
const directoryData = await fetchDirectoryData(
7977
installCommand.includes(" ")
8078
? installCommand.split(" ")
81-
: [installCommand],
79+
: [installCommand]
8280
);
8381
const cleanDirectoryData = directoryData.filter(Boolean);
8482

8583
if (cleanDirectoryData.length > 0) {
8684
const repositoryURLs = Object.fromEntries(
87-
cleanDirectoryData.map((lib) => [lib.npmPkg, lib.githubUrl]),
85+
cleanDirectoryData.map(lib => [lib.npmPkg, lib.githubUrl])
8886
);
8987

9088
tableDataMap.set(library, {
@@ -116,7 +114,7 @@ async function main() {
116114
}
117115

118116
const sortedData = Array.from(tableDataMap.values()).sort((a, b) =>
119-
a.installCommand.localeCompare(b.installCommand),
117+
a.installCommand.localeCompare(b.installCommand)
120118
);
121119

122120
const outPath = path.resolve("public/data.json");
@@ -126,7 +124,7 @@ async function main() {
126124
process.exit(0);
127125
}
128126

129-
main().catch((error) => {
127+
main().catch(error => {
130128
console.error("❌ Error exporting data:", error);
131129
process.exit(1);
132130
});

0 commit comments

Comments
 (0)