Skip to content

Commit d47f9b4

Browse files
committed
chore: Add biome linting/formatting
1 parent 756aa73 commit d47f9b4

File tree

64 files changed

+3956
-3813
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3956
-3813
lines changed

biome.json

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": false,
5+
"clientKind": "git",
6+
"useIgnoreFile": false
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": []
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "tab"
15+
},
16+
"organizeImports": {
17+
"enabled": true
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true,
23+
"style": {
24+
"noNonNullAssertion": "off"
25+
},
26+
"suspicious": {
27+
"noExplicitAny": "off"
28+
},
29+
"complexity": {
30+
"noForEach": "off"
31+
}
32+
}
33+
},
34+
"javascript": {
35+
"formatter": {
36+
"quoteStyle": "double"
37+
}
38+
}
39+
}
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
import Providers from './providers'
1+
import Providers from "./providers";
22

33
export default function RootLayout({
4-
children,
4+
children,
55
}: {
6-
children: React.ReactNode
6+
children: React.ReactNode;
77
}) {
8-
return (
9-
<html lang="en">
10-
<head />
11-
<body>
12-
<Providers>{children}</Providers>
13-
</body>
14-
</html>
15-
)
16-
}
8+
return (
9+
<html lang="en">
10+
<head />
11+
<body>
12+
<Providers>{children}</Providers>
13+
</body>
14+
</html>
15+
);
16+
}
Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,48 @@
1-
'use client'
1+
"use client";
22

33
// Since QueryClientProvider relies on useContext under the hood, we have to put 'use client' on top
44
import {
5-
isServer,
6-
QueryClient,
7-
QueryClientProvider,
8-
} from '@tanstack/react-query'
5+
QueryClient,
6+
QueryClientProvider,
7+
isServer,
8+
} from "@tanstack/react-query";
99

1010
function makeQueryClient() {
11-
return new QueryClient({
12-
defaultOptions: {
13-
queries: {
14-
// With SSR, we usually want to set some default staleTime
15-
// above 0 to avoid refetching immediately on the client
16-
staleTime: 60 * 1000,
17-
},
18-
},
19-
})
11+
return new QueryClient({
12+
defaultOptions: {
13+
queries: {
14+
// With SSR, we usually want to set some default staleTime
15+
// above 0 to avoid refetching immediately on the client
16+
staleTime: 60 * 1000,
17+
},
18+
},
19+
});
2020
}
2121

22-
let browserQueryClient: QueryClient | undefined = undefined
22+
let browserQueryClient: QueryClient | undefined = undefined;
2323

2424
function getQueryClient() {
25-
if (isServer) {
26-
// Server: always make a new query client
27-
return makeQueryClient()
28-
} else {
29-
// Browser: make a new query client if we don't already have one
30-
// This is very important, so we don't re-make a new client if React
31-
// suspends during the initial render. This may not be needed if we
32-
// have a suspense boundary BELOW the creation of the query client
33-
if (!browserQueryClient) browserQueryClient = makeQueryClient()
34-
return browserQueryClient
35-
}
25+
if (isServer) {
26+
// Server: always make a new query client
27+
return makeQueryClient();
28+
} else {
29+
// Browser: make a new query client if we don't already have one
30+
// This is very important, so we don't re-make a new client if React
31+
// suspends during the initial render. This may not be needed if we
32+
// have a suspense boundary BELOW the creation of the query client
33+
if (!browserQueryClient) browserQueryClient = makeQueryClient();
34+
return browserQueryClient;
35+
}
3636
}
3737

3838
export default function Providers({ children }: { children: React.ReactNode }) {
39-
// NOTE: Avoid useState when initializing the query client if you don't
40-
// have a suspense boundary between this and the code that may
41-
// suspend because React will throw away the client on the initial
42-
// render if it suspends and there is no boundary
43-
const queryClient = getQueryClient()
39+
// NOTE: Avoid useState when initializing the query client if you don't
40+
// have a suspense boundary between this and the code that may
41+
// suspend because React will throw away the client on the initial
42+
// render if it suspends and there is no boundary
43+
const queryClient = getQueryClient();
4444

45-
return (
46-
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
47-
)
48-
}
45+
return (
46+
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
47+
);
48+
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { Movies } from "@/examples/data-connect";
22
import { listMoviesRef } from "@dataconnect/default-connector";
33
import { DataConnectQueryClient } from "@tanstack-query-firebase/react";
4-
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
4+
import { HydrationBoundary, dehydrate } from "@tanstack/react-query";
55

66
import "@/firebase";
77

88
export default async function PostsPage() {
9-
const queryClient = new DataConnectQueryClient();
9+
const queryClient = new DataConnectQueryClient();
1010

11-
await queryClient.prefetchDataConnectQuery(listMoviesRef());
11+
await queryClient.prefetchDataConnectQuery(listMoviesRef());
1212

13-
return (
14-
<HydrationBoundary state={dehydrate(queryClient)}>
15-
<Movies />
16-
</HydrationBoundary>
17-
);
13+
return (
14+
<HydrationBoundary state={dehydrate(queryClient)}>
15+
<Movies />
16+
</HydrationBoundary>
17+
);
1818
}

examples/react-example/src/examples/data-connect.tsx

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,52 +2,52 @@
22

33
import { createMovieRef, listMoviesRef } from "@dataconnect/default-connector";
44
import {
5-
useConnectMutation,
6-
useConnectQuery,
5+
useConnectMutation,
6+
useConnectQuery,
77
} from "@tanstack-query-firebase/react/data-connect";
88

99
import "@/firebase";
1010

1111
export function Movies() {
12-
const movies = useConnectQuery(listMoviesRef());
12+
const movies = useConnectQuery(listMoviesRef());
1313

14-
const addMovie = useConnectMutation(createMovieRef, {
15-
invalidate: [listMoviesRef],
16-
});
14+
const addMovie = useConnectMutation(createMovieRef, {
15+
invalidate: [listMoviesRef],
16+
});
1717

18-
if (movies.isLoading) {
19-
return <div>Loading...</div>;
20-
}
18+
if (movies.isLoading) {
19+
return <div>Loading...</div>;
20+
}
2121

22-
if (movies.isError) {
23-
return <div>Error: {movies.error.message}</div>;
24-
}
22+
if (movies.isError) {
23+
return <div>Error: {movies.error.message}</div>;
24+
}
2525

26-
return (
27-
<div>
28-
<h1>Movies</h1>
29-
<button
30-
disabled={addMovie.isPending}
31-
onClick={() => {
32-
addMovie.mutate({
33-
title: Math.random().toString(32),
34-
genre: "Action",
35-
imageUrl: "https://example.com/image.jpg",
36-
});
37-
}}
38-
>
39-
Add Movie
40-
</button>
41-
<ul>
42-
<li>Fetch Time: {movies.data?.fetchTime}</li>
43-
<li>Source: {movies.data?.source}</li>
44-
<li>
45-
Query Key: {movies.data?.ref.name} + {movies.data?.ref.variables}
46-
</li>
47-
{movies.data!.movies.map((movie) => (
48-
<li key={movie.id}>{movie.title}</li>
49-
))}
50-
</ul>
51-
</div>
52-
);
26+
return (
27+
<div>
28+
<h1>Movies</h1>
29+
<button
30+
disabled={addMovie.isPending}
31+
onClick={() => {
32+
addMovie.mutate({
33+
title: Math.random().toString(32),
34+
genre: "Action",
35+
imageUrl: "https://example.com/image.jpg",
36+
});
37+
}}
38+
>
39+
Add Movie
40+
</button>
41+
<ul>
42+
<li>Fetch Time: {movies.data?.fetchTime}</li>
43+
<li>Source: {movies.data?.source}</li>
44+
<li>
45+
Query Key: {movies.data?.ref.name} + {movies.data?.ref.variables}
46+
</li>
47+
{movies.data!.movies.map((movie) => (
48+
<li key={movie.id}>{movie.title}</li>
49+
))}
50+
</ul>
51+
</div>
52+
);
5353
}
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import { connectorConfig } from "@dataconnect/default-connector";
22
import { getApps, initializeApp } from "firebase/app";
3-
import { connectDataConnectEmulator, getDataConnect } from "firebase/data-connect";
3+
import {
4+
connectDataConnectEmulator,
5+
getDataConnect,
6+
} from "firebase/data-connect";
47

58
if (getApps().length === 0) {
6-
initializeApp({
7-
projectId: "example",
8-
});
9-
const dataConnect = getDataConnect(connectorConfig);
10-
connectDataConnectEmulator(dataConnect!, "localhost", 9399);
11-
}
9+
initializeApp({
10+
projectId: "example",
11+
});
12+
const dataConnect = getDataConnect(connectorConfig);
13+
connectDataConnectEmulator(dataConnect, "localhost", 9399);
14+
}
Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
import React from 'react'
2-
import type { AppProps } from 'next/app'
3-
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
1+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
2+
import type { AppProps } from "next/app";
3+
import React from "react";
44

55
export default function MyApp({ Component, pageProps }: AppProps) {
6-
const [queryClient] = React.useState(
7-
() =>
8-
new QueryClient({
9-
defaultOptions: {
10-
queries: {
11-
// With SSR, we usually want to set some default staleTime
12-
// above 0 to avoid refetching immediately on the client
13-
staleTime: 60 * 1000,
14-
},
15-
},
16-
}),
17-
)
6+
const [queryClient] = React.useState(
7+
() =>
8+
new QueryClient({
9+
defaultOptions: {
10+
queries: {
11+
// With SSR, we usually want to set some default staleTime
12+
// above 0 to avoid refetching immediately on the client
13+
staleTime: 60 * 1000,
14+
},
15+
},
16+
}),
17+
);
1818

19-
return (
20-
<QueryClientProvider client={queryClient}>
21-
<Component {...pageProps} />
22-
</QueryClientProvider>
23-
)
24-
}
19+
return (
20+
<QueryClientProvider client={queryClient}>
21+
<Component {...pageProps} />
22+
</QueryClientProvider>
23+
);
24+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Movies } from "@/examples/data-connect";
22

33
export default function MoviesRoute() {
4-
return <Movies />;
4+
return <Movies />;
55
}
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
import { dehydrate, HydrationBoundary } from "@tanstack/react-query";
21
import { listMoviesRef } from "@dataconnect/default-connector";
2+
import { HydrationBoundary, dehydrate } from "@tanstack/react-query";
33

4-
import { DataConnectQueryClient } from "@tanstack-query-firebase/react/data-connect";
5-
import { InferGetStaticPropsType } from "next";
64
import { Movies } from "@/examples/data-connect";
5+
import { DataConnectQueryClient } from "@tanstack-query-firebase/react/data-connect";
6+
import type { InferGetStaticPropsType } from "next";
77

88
export async function getStaticProps() {
9-
const queryClient = new DataConnectQueryClient();
9+
const queryClient = new DataConnectQueryClient();
1010

11-
await queryClient.prefetchDataConnectQuery(listMoviesRef());
11+
await queryClient.prefetchDataConnectQuery(listMoviesRef());
1212

13-
return {
14-
props: {
15-
dehydratedState: dehydrate(queryClient),
16-
},
17-
};
13+
return {
14+
props: {
15+
dehydratedState: dehydrate(queryClient),
16+
},
17+
};
1818
}
1919

2020
export default function MoviesRoute({
21-
dehydratedState,
21+
dehydratedState,
2222
}: InferGetStaticPropsType<typeof getStaticProps>) {
23-
return (
24-
<HydrationBoundary state={dehydratedState}>
25-
<Movies />
26-
</HydrationBoundary>
27-
);
23+
return (
24+
<HydrationBoundary state={dehydratedState}>
25+
<Movies />
26+
</HydrationBoundary>
27+
);
2828
}

0 commit comments

Comments
 (0)