Skip to content

Commit 921d270

Browse files
authored
chore: Format dev with Prettier defaults (#8677)
* chore: use default prettier config * chore: format with prettier * chore: update prettier
1 parent b9cf5d8 commit 921d270

76 files changed

Lines changed: 589 additions & 590 deletions

Some content is hidden

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

FAQ.md

Lines changed: 1 addition & 1 deletion
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

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ import { create } from "react-test-renderer";
213213
import {
214214
MemoryRouter,
215215
Routes,
216-
Route
216+
Route,
217217
} from "react-router-dom";
218218

219219
describe("My app", () => {
@@ -273,7 +273,7 @@ function UsersIndexPage({ users }) {
273273
<div>
274274
<h1>Users</h1>
275275
<ul>
276-
{users.map(user => (
276+
{users.map((user) => (
277277
<li key={user.id}>
278278
<Link to={user.id}>{user.name}</Link>
279279
</li>
@@ -439,14 +439,14 @@ const NavLink = React.forwardRef(
439439
className={({ isActive }) =>
440440
[
441441
props.className,
442-
isActive ? activeClassName : null
442+
isActive ? activeClassName : null,
443443
]
444444
.filter(Boolean)
445445
.join(" ")
446446
}
447447
style={({ isActive }) => ({
448448
...props.style,
449-
...(isActive ? activeStyle : null)
449+
...(isActive ? activeStyle : null),
450450
})}
451451
/>
452452
);
@@ -512,7 +512,9 @@ class LoginForm extends React.Component {
512512
{user && (
513513
<Navigate to="/dashboard" replace={true} />
514514
)}
515-
<form onSubmit={event => this.handleSubmit(event)}>
515+
<form
516+
onSubmit={(event) => this.handleSubmit(event)}
517+
>
516518
<input type="text" name="username" />
517519
<input type="password" name="password" />
518520
</form>
@@ -594,7 +596,7 @@ function Parent() {
594596
```tsx lines=[2]
595597
function Child() {
596598
const [count, setCount] = useOutletContext();
597-
const increment = () => setCount(c => c + 1);
599+
const increment = () => setCount((c) => c + 1);
598600
return <button onClick={increment}>{count}</button>;
599601
}
600602
```
@@ -817,7 +819,7 @@ declare function generatePath(
817819
generatePath("/users/:id", { id: 42 }); // "/users/42"
818820
generatePath("/files/:type/*", {
819821
type: "img",
820-
"*": "cat.jpg"
822+
"*": "cat.jpg",
821823
}); // "/files/img/cat.jpg"
822824
```
823825

@@ -975,7 +977,7 @@ The `useLinkClickHandler` hook returns a click event handler to for navigation w
975977
```tsx
976978
import {
977979
useHref,
978-
useLinkClickHandler
980+
useLinkClickHandler,
979981
} from "react-router-dom";
980982

981983
const StyledLink = styled("a", { color: "fuchsia" });
@@ -996,14 +998,14 @@ const Link = React.forwardRef(
996998
let handleClick = useLinkClickHandler(to, {
997999
replace,
9981000
state,
999-
target
1001+
target,
10001002
});
10011003

10021004
return (
10031005
<StyledLink
10041006
{...rest}
10051007
href={href}
1006-
onClick={event => {
1008+
onClick={(event) => {
10071009
onClick?.(event);
10081010
if (!event.defaultPrevented) {
10091011
handleClick(event);
@@ -1051,13 +1053,13 @@ function Link({
10511053
}) {
10521054
let handlePress = useLinkPressHandler(to, {
10531055
replace,
1054-
state
1056+
state,
10551057
});
10561058

10571059
return (
10581060
<TouchableHighlight
10591061
{...rest}
1060-
onPress={event => {
1062+
onPress={(event) => {
10611063
onPress?.(event);
10621064
if (!event.defaultPrevented) {
10631065
handlePress(event);
@@ -1288,12 +1290,12 @@ function App() {
12881290
children: [
12891291
{
12901292
path: "messages",
1291-
element: <DashboardMessages />
1293+
element: <DashboardMessages />,
12921294
},
1293-
{ path: "tasks", element: <DashboardTasks /> }
1294-
]
1295+
{ path: "tasks", element: <DashboardTasks /> },
1296+
],
12951297
},
1296-
{ path: "team", element: <AboutPage /> }
1298+
{ path: "team", element: <AboutPage /> },
12971299
]);
12981300

12991301
return element;

docs/faq.md

Lines changed: 2 additions & 2 deletions
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

Lines changed: 28 additions & 28 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 4 additions & 4 deletions
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)