Skip to content

Commit b843323

Browse files
authored
Upgrade prettier (#13916)
1 parent 2e7ce24 commit b843323

File tree

445 files changed

+4614
-4638
lines changed

Some content is hidden

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

445 files changed

+4614
-4638
lines changed

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ worker-configuration.d.ts
88
/playground-local/
99
integration/helpers/**/dist/
1010
integration/helpers/**/build/
11-
# Temporary until we can get prettier upgraded to support `import ... with` syntax
12-
integration/helpers/rsc-parcel/src/server.tsx
1311
playwright-report/
1412
test-results/
1513
build.utils.d.ts

CHANGELOG.md

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,6 @@ Date: 2025-06-27
348348
### Patch Changes
349349

350350
- `react-router` - Do not serialize types for `useRouteLoaderData<typeof clientLoader>` ([#13752](https://github.com/remix-run/react-router/pull/13752))
351-
352351
- For types to distinguish a `clientLoader` from a `serverLoader`, you MUST annotate `clientLoader` args:
353352

354353
```ts
@@ -449,7 +448,6 @@ Date: 2025-05-25
449448
- `@react-router/dev` - Add additional logging to `build` command output when cleaning assets from server build ([#13547](https://github.com/remix-run/react-router/pull/13547))
450449
- `@react-router/dev` - Don't clean assets from server build when `build.ssrEmitAssets` has been enabled in Vite config ([#13547](https://github.com/remix-run/react-router/pull/13547))
451450
- `@react-router/dev` - Fix typegen when same route is used at multiple paths ([#13574](https://github.com/remix-run/react-router/pull/13574))
452-
453451
- For example, `routes/route.tsx` is used at 4 different paths here:
454452

455453
```ts
@@ -468,7 +466,6 @@ Date: 2025-05-25
468466
- Now, typegen creates unions as necessary for alternate paths for the same route file
469467

470468
- `@react-router/dev` - Better types for `params` ([#13543](https://github.com/remix-run/react-router/pull/13543))
471-
472469
- For example:
473470

474471
```ts
@@ -515,7 +512,6 @@ Date: 2025-05-25
515512
```
516513

517514
- `@react-router/dev` - Fix `href` for optional segments ([#13595](https://github.com/remix-run/react-router/pull/13595))
518-
519515
- Type generation now expands paths with optionals into their corresponding non-optional paths
520516
- For example, the path `/user/:id?` gets expanded into `/user` and `/user/:id` to more closely model visitable URLs
521517
- `href` then uses these expanded (non-optional) paths to construct type-safe paths for your app:
@@ -623,7 +619,6 @@ Behind the scenes, React Router will generate the corresponding `declare module`
623619

624620
- `react-router` - Added a new `routeDiscovery` option in `react-router.config.ts` to configure Lazy Route Discovery behavior ([#13451](https://github.com/remix-run/react-router/pull/13451))
625621
- `react-router` - Add support for route component props in `createRoutesStub` ([#13528](https://github.com/remix-run/react-router/pull/13528))
626-
627622
- This allows you to unit test your route components using the props instead of the hooks:
628623

629624
```tsx
@@ -742,7 +737,6 @@ Date: 2025-04-17
742737
### Patch Changes
743738

744739
- `react-router` - When using the object-based `route.lazy` API, the `HydrateFallback` and `hydrateFallbackElement` properties are now skipped when lazy loading routes after hydration ([#13376](https://github.com/remix-run/react-router/pull/13376))
745-
746740
- If you move the code for these properties into a separate file, since the hydrate properties were unused already (if the route wasn't present during hydration), you can avoid downloading them at all. For example:
747741

748742
```ts
@@ -1047,7 +1041,7 @@ Here's a simple example of a client-side logging middleware that can be placed o
10471041
```tsx
10481042
const clientLogger: Route.unstable_ClientMiddlewareFunction = async (
10491043
{ request },
1050-
next
1044+
next,
10511045
) => {
10521046
let start = performance.now();
10531047

@@ -1066,7 +1060,7 @@ For a server-side middleware, the `next` function will return the HTTP `Response
10661060
```tsx
10671061
const serverLogger: Route.unstable_MiddlewareFunction = async (
10681062
{ request, params, context },
1069-
next
1063+
next,
10701064
) => {
10711065
let start = performance.now();
10721066

@@ -1087,7 +1081,7 @@ You can throw a `redirect` from a middleware to short circuit any remaining proc
10871081
import { sessionContext } from "../context";
10881082
const serverAuth: Route.unstable_MiddlewareFunction = (
10891083
{ request, params, context },
1090-
next
1084+
next,
10911085
) => {
10921086
let session = context.get(sessionContext);
10931087
let user = session.get("user");
@@ -1340,7 +1334,7 @@ import { MassiveComponent } from "~/components";
13401334

13411335
export async function clientLoader() {
13421336
return await fetch("https://example.com/api").then((response) =>
1343-
response.json()
1337+
response.json(),
13441338
);
13451339
}
13461340

@@ -1375,7 +1369,7 @@ To achieve this optimization, React Router will split the route module into mult
13751369
```tsx filename=routes/example.tsx?route-chunk=clientLoader
13761370
export async function clientLoader() {
13771371
return await fetch("https://example.com/api").then((response) =>
1378-
response.json()
1372+
response.json(),
13791373
);
13801374
}
13811375
```
@@ -1421,7 +1415,7 @@ const shared = () => console.log("hello");
14211415
export async function clientLoader() {
14221416
shared();
14231417
return await fetch("https://example.com/api").then((response) =>
1424-
response.json()
1418+
response.json(),
14251419
);
14261420
}
14271421

@@ -1448,7 +1442,7 @@ import { shared } from "./shared";
14481442
export async function clientLoader() {
14491443
shared();
14501444
return await fetch("https://example.com/api").then((response) =>
1451-
response.json()
1445+
response.json(),
14521446
);
14531447
}
14541448

@@ -1466,7 +1460,7 @@ import { shared } from "./shared";
14661460
export async function clientLoader() {
14671461
shared();
14681462
return await fetch("https://example.com/api").then((response) =>
1469-
response.json()
1463+
response.json(),
14701464
);
14711465
}
14721466
```
@@ -2332,7 +2326,7 @@ const router = createBrowserRouter(
23322326
patch("root", [route]);
23332327
}
23342328
},
2335-
}
2329+
},
23362330
);
23372331
```
23382332

@@ -3112,7 +3106,7 @@ let routes = createRoutesFromElements(
31123106
<Route index element={<Home />} />
31133107
<Route path="a" lazy={() => import("./a")} />
31143108
<Route path="b" lazy={() => import("./b")} />
3115-
</Route>
3109+
</Route>,
31163110
);
31173111
```
31183112

GOVERNANCE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
React Router has been around since 2014 largely under the development and oversight of [Michael Jackson](https://x.com/mjackson) and [Ryan Florence](https://x.com/ryanflorence). After the launch of [Remix](https://remix.run/) in 2021, the subsequent creation of the Remix team, and the merging of Remix v2 into React Router v7[^1][^2], the project shifted from a [Founder-Leader](https://www.redhat.com/en/blog/understanding-open-source-governance-models) model to a "Steering Committee" (SC) model that operates on a Request for Comments (RFC) process.
1919

2020
[^1]: https://remix.run/blog/merging-remix-and-react-router
21+
2122
[^2]: https://remix.run/blog/incremental-path-to-react-19
2223

2324
This document will outline the process in which React Router will continue to evolve and how new features will make their way into the codebase. This is an evergreen document and will be updated as needed to reflect future changes in the process.

decisions/0003-data-strategy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Therefore, we're introducing the concept of a `DataStrategyMatch` which is just
113113
```js
114114
function dataStrategy({ matches, defaultStrategy }) {
115115
return Promise.all(
116-
matches.map((m) => match.route.then((route) => route.loader(/* ... */)))
116+
matches.map((m) => match.route.then((route) => route.loader(/* ... */))),
117117
);
118118
}
119119
```

decisions/0005-remixing-react-router.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ If folks still prefer the JSX notation, they can leverage `createRoutesFromEleme
283283
const routes = createRoutesFromElements(
284284
<Route path="/" element={<Layout />}>
285285
<Route index element={<Home />} />
286-
</Route>
286+
</Route>,
287287
);
288288
const router = createBrowserRouter(routes);
289289

decisions/0010-splitting-up-client-and-server-code-in-vite.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Checking for `.server` modules only requires checking the module's path and does
9696
`vite-env-only` does require AST parsing and transformations so it will always be slower than `.server` modules.
9797

9898
[^1]: Vite provides a lower-level module graph API, but the module graph is not guaranteed to be complete as it is only populated as modules are requested.
99+
99100
[^2]: When a file changes on disk, Vite invalidates the corresponding module in its cache to power features like HMR.
100101

101102
[decision-0009]: ./0009-do-not-rely-on-treeshaking-for-correctness.md

decisions/0014-context-middleware.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ The middleware API we landed on to ship looks as follows:
105105
```ts
106106
const myMiddleware: Route.unstable_MiddlewareFunction = async (
107107
{ request, context },
108-
next
108+
next,
109109
) => {
110110
// Do stuff before the handlers are called
111111
context.user = await getUser(request);
@@ -125,7 +125,7 @@ export const middleware = [myMiddleware];
125125
// `clientLoader`/`clientAction`
126126
const myClientMiddleware: Route.unstable_ClientMiddlewareFunction = (
127127
{ context },
128-
next
128+
next,
129129
) => {
130130
//...
131131
};

docs/explanation/sessions-and-cookies.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const { getSession, commitSession, destroySession } =
4545
secrets: ["s3cret1"],
4646
secure: true,
4747
},
48-
}
48+
},
4949
);
5050

5151
export { getSession, commitSession, destroySession };
@@ -64,7 +64,7 @@ export async function action({
6464
request,
6565
}: ActionFunctionArgs) {
6666
const session = await getSession(
67-
request.headers.get("Cookie")
67+
request.headers.get("Cookie"),
6868
);
6969
session.get("foo");
7070
session.has("bar");
@@ -91,7 +91,7 @@ export async function loader({
9191
request,
9292
}: Route.LoaderArgs) {
9393
const session = await getSession(
94-
request.headers.get("Cookie")
94+
request.headers.get("Cookie"),
9595
);
9696

9797
if (session.has("userId")) {
@@ -105,23 +105,23 @@ export async function loader({
105105
headers: {
106106
"Set-Cookie": await commitSession(session),
107107
},
108-
}
108+
},
109109
);
110110
}
111111

112112
export async function action({
113113
request,
114114
}: Route.ActionArgs) {
115115
const session = await getSession(
116-
request.headers.get("Cookie")
116+
request.headers.get("Cookie"),
117117
);
118118
const form = await request.formData();
119119
const username = form.get("username");
120120
const password = form.get("password");
121121

122122
const userId = await validateCredentials(
123123
username,
124-
password
124+
password,
125125
);
126126

127127
if (userId == null) {
@@ -183,7 +183,7 @@ export async function action({
183183
request,
184184
}: Route.ActionArgs) {
185185
const session = await getSession(
186-
request.headers.get("Cookie")
186+
request.headers.get("Cookie"),
187187
);
188188
return redirect("/login", {
189189
headers: {

docs/explanation/special-files.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ startTransition(() => {
208208
document,
209209
<StrictMode>
210210
<HydratedRouter />
211-
</StrictMode>
211+
</StrictMode>,
212212
);
213213
});
214214
```
@@ -266,7 +266,7 @@ export function handleDataRequest(
266266
request,
267267
params,
268268
context,
269-
}: LoaderFunctionArgs | ActionFunctionArgs
269+
}: LoaderFunctionArgs | ActionFunctionArgs,
270270
) {
271271
response.headers.set("X-Custom-Header", "value");
272272
return response;
@@ -284,7 +284,7 @@ export function handleError(
284284
request,
285285
params,
286286
context,
287-
}: LoaderFunctionArgs | ActionFunctionArgs
287+
}: LoaderFunctionArgs | ActionFunctionArgs,
288288
) {
289289
if (!request.signal.aborted) {
290290
sendErrorToErrorReportingService(error);

docs/explanation/state-management.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,12 @@ React Router seamlessly bridges the gap between the backend and frontend via mec
2525
Here's why using typical React state patterns might be an anti-pattern in React Router:
2626

2727
1. **Network-related State:** If your React state is managing anything related to the network—such as data from loaders, pending form submissions, or navigational states—it's likely that you're managing state that React Router already manages:
28-
2928
- **[`useNavigation`][use_navigation]**: This hook gives you access to `navigation.state`, `navigation.formData`, `navigation.location`, etc.
3029
- **[`useFetcher`][use_fetcher]**: This facilitates interaction with `fetcher.state`, `fetcher.formData`, `fetcher.data` etc.
3130
- **[`loaderData`][loader_data]**: Access the data for a route.
3231
- **[`actionData`][action_data]**: Access the data from the latest action.
3332

3433
2. **Storing Data in React Router:** A lot of data that developers might be tempted to store in React state has a more natural home in React Router, such as:
35-
3634
- **URL Search Params:** Parameters within the URL that hold state.
3735
- **[Cookies][cookies]:** Small pieces of data stored on the user's device.
3836
- **[Server Sessions][sessions]:** Server-managed user sessions.
@@ -80,7 +78,7 @@ export function List() {
8078
const navigate = useNavigate();
8179
const [searchParams] = useSearchParams();
8280
const [view, setView] = useState(
83-
searchParams.get("view") || "list"
81+
searchParams.get("view") || "list",
8482
);
8583

8684
return (
@@ -226,7 +224,7 @@ In this approach, state must be initialized within an effect. This is crucial to
226224
function Sidebar() {
227225
const [isOpen, setIsOpen] = useState(
228226
// error: window is not defined
229-
window.localStorage.getItem("sidebar")
227+
window.localStorage.getItem("sidebar"),
230228
);
231229

232230
// ...

0 commit comments

Comments
 (0)