Skip to content

Commit 59b319f

Browse files
authored
chore: Format main with Prettier defaults (#8678)
* chore: use prettier defaults * chore: format with prettier * chore: update prettier
1 parent 5f212eb commit 59b319f

Some content is hidden

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

76 files changed

+589
-590
lines changed

FAQ.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ const App = () => {
120120
return (
121121
<Route
122122
path="/somewhere"
123-
render={props => <MyComponent {...props} color={color} />}
123+
render={(props) => <MyComponent {...props} color={color} />}
124124
/>
125125
);
126126
};

docs/api.md

+18-16
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ import { create } from "react-test-renderer";
214214
import {
215215
MemoryRouter,
216216
Routes,
217-
Route
217+
Route,
218218
} from "react-router-dom";
219219

220220
describe("My app", () => {
@@ -313,7 +313,7 @@ function UsersIndexPage({ users }) {
313313
<div>
314314
<h1>Users</h1>
315315
<ul>
316-
{users.map(user => (
316+
{users.map((user) => (
317317
<li key={user.id}>
318318
<Link to={user.id}>{user.name}</Link>
319319
</li>
@@ -481,14 +481,14 @@ const NavLink = React.forwardRef(
481481
className={({ isActive }) =>
482482
[
483483
props.className,
484-
isActive ? activeClassName : null
484+
isActive ? activeClassName : null,
485485
]
486486
.filter(Boolean)
487487
.join(" ")
488488
}
489489
style={({ isActive }) => ({
490490
...props.style,
491-
...(isActive ? activeStyle : null)
491+
...(isActive ? activeStyle : null),
492492
})}
493493
/>
494494
);
@@ -554,7 +554,9 @@ class LoginForm extends React.Component {
554554
{user && (
555555
<Navigate to="/dashboard" replace={true} />
556556
)}
557-
<form onSubmit={event => this.handleSubmit(event)}>
557+
<form
558+
onSubmit={(event) => this.handleSubmit(event)}
559+
>
558560
<input type="text" name="username" />
559561
<input type="password" name="password" />
560562
</form>
@@ -638,7 +640,7 @@ import { useOutletContext } from "react-router-dom";
638640

639641
function Child() {
640642
const [count, setCount] = useOutletContext();
641-
const increment = () => setCount(c => c + 1);
643+
const increment = () => setCount((c) => c + 1);
642644
return <button onClick={increment}>{count}</button>;
643645
}
644646
```
@@ -862,7 +864,7 @@ declare function generatePath(
862864
generatePath("/users/:id", { id: 42 }); // "/users/42"
863865
generatePath("/files/:type/*", {
864866
type: "img",
865-
"*": "cat.jpg"
867+
"*": "cat.jpg",
866868
}); // "/files/img/cat.jpg"
867869
```
868870

@@ -1019,7 +1021,7 @@ The `useLinkClickHandler` hook returns a click event handler to for navigation w
10191021
```tsx
10201022
import {
10211023
useHref,
1022-
useLinkClickHandler
1024+
useLinkClickHandler,
10231025
} from "react-router-dom";
10241026

10251027
const StyledLink = styled("a", { color: "fuchsia" });
@@ -1040,14 +1042,14 @@ const Link = React.forwardRef(
10401042
let handleClick = useLinkClickHandler(to, {
10411043
replace,
10421044
state,
1043-
target
1045+
target,
10441046
});
10451047

10461048
return (
10471049
<StyledLink
10481050
{...rest}
10491051
href={href}
1050-
onClick={event => {
1052+
onClick={(event) => {
10511053
onClick?.(event);
10521054
if (!event.defaultPrevented) {
10531055
handleClick(event);
@@ -1093,13 +1095,13 @@ function Link({
10931095
}) {
10941096
let handlePress = useLinkPressHandler(to, {
10951097
replace,
1096-
state
1098+
state,
10971099
});
10981100

10991101
return (
11001102
<TouchableHighlight
11011103
{...rest}
1102-
onPress={event => {
1104+
onPress={(event) => {
11031105
onPress?.(event);
11041106
if (!event.defaultPrevented) {
11051107
handlePress(event);
@@ -1329,12 +1331,12 @@ function App() {
13291331
children: [
13301332
{
13311333
path: "messages",
1332-
element: <DashboardMessages />
1334+
element: <DashboardMessages />,
13331335
},
1334-
{ path: "tasks", element: <DashboardTasks /> }
1335-
]
1336+
{ path: "tasks", element: <DashboardTasks /> },
1337+
],
13361338
},
1337-
{ path: "team", element: <AboutPage /> }
1339+
{ path: "team", element: <AboutPage /> },
13381340
]);
13391341

13401342
return element;

docs/faq.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ This question usually stems from the fact that you're using React class componen
1515
import {
1616
useLocation,
1717
useNavigate,
18-
useParams
18+
useParams,
1919
} from "react-router-dom";
2020

2121
function withRouter(Component) {
@@ -406,7 +406,7 @@ export async function loader({ params }) {
406406
}
407407

408408
let user = await fakeDb.user.find({
409-
where: { id: params.id }
409+
where: { id: params.id },
410410
});
411411
if (!user) {
412412
throw new Response("", { status: 404 });

docs/getting-started/concepts.md

+28-28
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ With **client side routing**, developers are able to manipulate the browser [his
100100
```jsx
101101
<a
102102
href="/contact"
103-
onClick={event => {
103+
onClick={(event) => {
104104
// stop the browser from changing the URL and requesting the new document
105105
event.preventDefault();
106106
// push an entry into the browser history stack and change the URL
@@ -191,7 +191,7 @@ let location = {
191191
search: "?campaign=instagram&popular=true",
192192
hash: "",
193193
state: null,
194-
key: "aefz24ie"
194+
key: "aefz24ie",
195195
};
196196

197197
// we can turn the location.search into URLSearchParams
@@ -279,8 +279,8 @@ function useFakeFetch(URL) {
279279
if (state === "loading") {
280280
let controller = new AbortController();
281281
fetch(URL, { signal: controller.signal })
282-
.then(res => res.json())
283-
.then(data => {
282+
.then((res) => res.json())
283+
.then((data) => {
284284
if (controller.aborted) return;
285285
// set the cache
286286
cache.set(cacheKey, data);
@@ -335,49 +335,49 @@ let routes = [
335335
children: [
336336
{
337337
index: true,
338-
element: <Home />
338+
element: <Home />,
339339
},
340340
{
341341
path: "teams",
342342
element: <Teams />,
343343
children: [
344344
{
345345
index: true,
346-
element: <LeagueStandings />
346+
element: <LeagueStandings />,
347347
},
348348
{
349349
path: ":teamId",
350-
element: <Team />
350+
element: <Team />,
351351
},
352352
{
353353
path: ":teamId/edit",
354-
element: <EditTeam />
354+
element: <EditTeam />,
355355
},
356356
{
357357
path: "new",
358-
element: <NewTeamForm />
359-
}
360-
]
361-
}
362-
]
358+
element: <NewTeamForm />,
359+
},
360+
],
361+
},
362+
],
363363
},
364364
{
365365
element: <PageLayout />,
366366
children: [
367367
{
368368
element: <Privacy />,
369-
path: "/privacy"
369+
path: "/privacy",
370370
},
371371
{
372372
element: <Tos />,
373-
path: "/tos"
374-
}
375-
]
373+
path: "/tos",
374+
},
375+
],
376376
},
377377
{
378378
element: <Contact />,
379-
path: "/contact-us"
380-
}
379+
path: "/contact-us",
380+
},
381381
];
382382
```
383383

@@ -402,7 +402,7 @@ If we add up all the segments of all the branches of our [route config](#route-c
402402
"/teams/new",
403403
"/privacy",
404404
"/tos",
405-
"/contact-us"
405+
"/contact-us",
406406
];
407407
```
408408

@@ -480,27 +480,27 @@ React Router will create an array of [matches](#match) from these routes and the
480480
params: null,
481481
route: {
482482
element: <App />,
483-
path: "/"
484-
}
483+
path: "/",
484+
},
485485
},
486486
{
487487
pathname: "/teams",
488488
params: null,
489489
route: {
490490
element: <Teams />,
491-
path: "teams"
492-
}
491+
path: "teams",
492+
},
493493
},
494494
{
495495
pathname: "/teams/firebirds",
496496
params: {
497-
teamId: "firebirds"
497+
teamId: "firebirds",
498498
},
499499
route: {
500500
element: <Team />,
501-
path: ":teamId"
502-
}
503-
}
501+
path: ":teamId",
502+
},
503+
},
504504
];
505505
```
506506

docs/getting-started/installation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ Once you have webpack configured and the necessary dependencies installed, somew
245245
import {
246246
BrowserRouter,
247247
Routes,
248-
Route
248+
Route,
249249
} from "react-router-dom";
250250
251251
function App() {

docs/getting-started/overview.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { render } from "react-dom";
2424
import {
2525
BrowserRouter,
2626
Routes,
27-
Route
27+
Route,
2828
} from "react-router-dom";
2929
// import your route components too
3030

@@ -82,7 +82,7 @@ function Invoices() {
8282
return (
8383
<div>
8484
<NewInvoiceForm
85-
onSubmit={async event => {
85+
onSubmit={async (event) => {
8686
let newInvoice = await createInvoice(
8787
event.target
8888
);
@@ -225,7 +225,7 @@ import {
225225
Routes,
226226
Route,
227227
Link,
228-
Outlet
228+
Outlet,
229229
} from "react-router-dom";
230230

231231
function App() {
@@ -339,7 +339,7 @@ import {
339339
Routes,
340340
Route,
341341
Link,
342-
Outlet
342+
Outlet,
343343
} from "react-router-dom";
344344

345345
function Home() {

0 commit comments

Comments
 (0)