Skip to content

Commit

Permalink
chore: Format main with Prettier defaults (#8678)
Browse files Browse the repository at this point in the history
* chore: use prettier defaults
* chore: format with prettier
* chore: update prettier
  • Loading branch information
chaance committed Feb 22, 2022
1 parent 5f212eb commit 59b319f
Show file tree
Hide file tree
Showing 76 changed files with 589 additions and 590 deletions.
2 changes: 1 addition & 1 deletion FAQ.md
Expand Up @@ -120,7 +120,7 @@ const App = () => {
return (
<Route
path="/somewhere"
render={props => <MyComponent {...props} color={color} />}
render={(props) => <MyComponent {...props} color={color} />}
/>
);
};
Expand Down
34 changes: 18 additions & 16 deletions docs/api.md
Expand Up @@ -214,7 +214,7 @@ import { create } from "react-test-renderer";
import {
MemoryRouter,
Routes,
Route
Route,
} from "react-router-dom";

describe("My app", () => {
Expand Down Expand Up @@ -313,7 +313,7 @@ function UsersIndexPage({ users }) {
<div>
<h1>Users</h1>
<ul>
{users.map(user => (
{users.map((user) => (
<li key={user.id}>
<Link to={user.id}>{user.name}</Link>
</li>
Expand Down Expand Up @@ -481,14 +481,14 @@ const NavLink = React.forwardRef(
className={({ isActive }) =>
[
props.className,
isActive ? activeClassName : null
isActive ? activeClassName : null,
]
.filter(Boolean)
.join(" ")
}
style={({ isActive }) => ({
...props.style,
...(isActive ? activeStyle : null)
...(isActive ? activeStyle : null),
})}
/>
);
Expand Down Expand Up @@ -554,7 +554,9 @@ class LoginForm extends React.Component {
{user && (
<Navigate to="/dashboard" replace={true} />
)}
<form onSubmit={event => this.handleSubmit(event)}>
<form
onSubmit={(event) => this.handleSubmit(event)}
>
<input type="text" name="username" />
<input type="password" name="password" />
</form>
Expand Down Expand Up @@ -638,7 +640,7 @@ import { useOutletContext } from "react-router-dom";

function Child() {
const [count, setCount] = useOutletContext();
const increment = () => setCount(c => c + 1);
const increment = () => setCount((c) => c + 1);
return <button onClick={increment}>{count}</button>;
}
```
Expand Down Expand Up @@ -862,7 +864,7 @@ declare function generatePath(
generatePath("/users/:id", { id: 42 }); // "/users/42"
generatePath("/files/:type/*", {
type: "img",
"*": "cat.jpg"
"*": "cat.jpg",
}); // "/files/img/cat.jpg"
```

Expand Down Expand Up @@ -1019,7 +1021,7 @@ The `useLinkClickHandler` hook returns a click event handler to for navigation w
```tsx
import {
useHref,
useLinkClickHandler
useLinkClickHandler,
} from "react-router-dom";

const StyledLink = styled("a", { color: "fuchsia" });
Expand All @@ -1040,14 +1042,14 @@ const Link = React.forwardRef(
let handleClick = useLinkClickHandler(to, {
replace,
state,
target
target,
});

return (
<StyledLink
{...rest}
href={href}
onClick={event => {
onClick={(event) => {
onClick?.(event);
if (!event.defaultPrevented) {
handleClick(event);
Expand Down Expand Up @@ -1093,13 +1095,13 @@ function Link({
}) {
let handlePress = useLinkPressHandler(to, {
replace,
state
state,
});

return (
<TouchableHighlight
{...rest}
onPress={event => {
onPress={(event) => {
onPress?.(event);
if (!event.defaultPrevented) {
handlePress(event);
Expand Down Expand Up @@ -1329,12 +1331,12 @@ function App() {
children: [
{
path: "messages",
element: <DashboardMessages />
element: <DashboardMessages />,
},
{ path: "tasks", element: <DashboardTasks /> }
]
{ path: "tasks", element: <DashboardTasks /> },
],
},
{ path: "team", element: <AboutPage /> }
{ path: "team", element: <AboutPage /> },
]);

return element;
Expand Down
4 changes: 2 additions & 2 deletions docs/faq.md
Expand Up @@ -15,7 +15,7 @@ This question usually stems from the fact that you're using React class componen
import {
useLocation,
useNavigate,
useParams
useParams,
} from "react-router-dom";

function withRouter(Component) {
Expand Down Expand Up @@ -406,7 +406,7 @@ export async function loader({ params }) {
}

let user = await fakeDb.user.find({
where: { id: params.id }
where: { id: params.id },
});
if (!user) {
throw new Response("", { status: 404 });
Expand Down
56 changes: 28 additions & 28 deletions docs/getting-started/concepts.md
Expand Up @@ -100,7 +100,7 @@ With **client side routing**, developers are able to manipulate the browser [his
```jsx
<a
href="/contact"
onClick={event => {
onClick={(event) => {
// stop the browser from changing the URL and requesting the new document
event.preventDefault();
// push an entry into the browser history stack and change the URL
Expand Down Expand Up @@ -191,7 +191,7 @@ let location = {
search: "?campaign=instagram&popular=true",
hash: "",
state: null,
key: "aefz24ie"
key: "aefz24ie",
};

// we can turn the location.search into URLSearchParams
Expand Down Expand Up @@ -279,8 +279,8 @@ function useFakeFetch(URL) {
if (state === "loading") {
let controller = new AbortController();
fetch(URL, { signal: controller.signal })
.then(res => res.json())
.then(data => {
.then((res) => res.json())
.then((data) => {
if (controller.aborted) return;
// set the cache
cache.set(cacheKey, data);
Expand Down Expand Up @@ -335,49 +335,49 @@ let routes = [
children: [
{
index: true,
element: <Home />
element: <Home />,
},
{
path: "teams",
element: <Teams />,
children: [
{
index: true,
element: <LeagueStandings />
element: <LeagueStandings />,
},
{
path: ":teamId",
element: <Team />
element: <Team />,
},
{
path: ":teamId/edit",
element: <EditTeam />
element: <EditTeam />,
},
{
path: "new",
element: <NewTeamForm />
}
]
}
]
element: <NewTeamForm />,
},
],
},
],
},
{
element: <PageLayout />,
children: [
{
element: <Privacy />,
path: "/privacy"
path: "/privacy",
},
{
element: <Tos />,
path: "/tos"
}
]
path: "/tos",
},
],
},
{
element: <Contact />,
path: "/contact-us"
}
path: "/contact-us",
},
];
```

Expand All @@ -402,7 +402,7 @@ If we add up all the segments of all the branches of our [route config](#route-c
"/teams/new",
"/privacy",
"/tos",
"/contact-us"
"/contact-us",
];
```

Expand Down Expand Up @@ -480,27 +480,27 @@ React Router will create an array of [matches](#match) from these routes and the
params: null,
route: {
element: <App />,
path: "/"
}
path: "/",
},
},
{
pathname: "/teams",
params: null,
route: {
element: <Teams />,
path: "teams"
}
path: "teams",
},
},
{
pathname: "/teams/firebirds",
params: {
teamId: "firebirds"
teamId: "firebirds",
},
route: {
element: <Team />,
path: ":teamId"
}
}
path: ":teamId",
},
},
];
```

Expand Down
2 changes: 1 addition & 1 deletion docs/getting-started/installation.md
Expand Up @@ -245,7 +245,7 @@ Once you have webpack configured and the necessary dependencies installed, somew
import {
BrowserRouter,
Routes,
Route
Route,
} from "react-router-dom";
function App() {
Expand Down
8 changes: 4 additions & 4 deletions docs/getting-started/overview.md
Expand Up @@ -24,7 +24,7 @@ import { render } from "react-dom";
import {
BrowserRouter,
Routes,
Route
Route,
} from "react-router-dom";
// import your route components too

Expand Down Expand Up @@ -82,7 +82,7 @@ function Invoices() {
return (
<div>
<NewInvoiceForm
onSubmit={async event => {
onSubmit={async (event) => {
let newInvoice = await createInvoice(
event.target
);
Expand Down Expand Up @@ -225,7 +225,7 @@ import {
Routes,
Route,
Link,
Outlet
Outlet,
} from "react-router-dom";

function App() {
Expand Down Expand Up @@ -339,7 +339,7 @@ import {
Routes,
Route,
Link,
Outlet
Outlet,
} from "react-router-dom";

function Home() {
Expand Down

0 comments on commit 59b319f

Please sign in to comment.