Skip to content

Commit a973ad6

Browse files
authored
Makes codeblock language and filename extensions consistent (vercel#51056)
There was mismatched usage of `js`, `jsx`, `ts`, and `tsx`. Just tried to get them all in sync.
1 parent 98351e9 commit a973ad6

File tree

62 files changed

+267
-218
lines changed

Some content is hidden

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

62 files changed

+267
-218
lines changed

contributing/core/developing-using-local-app.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,12 @@ Failed to load SWC binary, see more info here: https://nextjs.org/docs/messages/
4141
Try to add the below section to your `package.json`, then run again
4242

4343
```json
44-
"optionalDependencies": {
45-
"@next/swc-linux-x64-gnu": "canary",
46-
"@next/swc-win32-x64-msvc": "canary",
47-
"@next/swc-darwin-x64": "canary",
48-
"@next/swc-darwin-arm64": "canary"
49-
},
44+
{
45+
"optionalDependencies": {
46+
"@next/swc-linux-x64-gnu": "canary",
47+
"@next/swc-win32-x64-msvc": "canary",
48+
"@next/swc-darwin-x64": "canary",
49+
"@next/swc-darwin-arm64": "canary"
50+
}
51+
}
5052
```

docs/01-getting-started/03-react-essentials.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export default function Counter() {
7070
}
7171
```
7272

73-
```jsx filename="app/counter.jsx" highlight={1} switcher
73+
```jsx filename="app/counter.js" highlight={1} switcher
7474
'use client'
7575

7676
import { useState } from 'react'

docs/02-app/01-building-your-application/01-routing/03-linking-and-navigating.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ There are optional props you can pass to `<Link>`. See the [API reference](/docs
4242

4343
When linking to [dynamic segments](/docs/app/building-your-application/routing/dynamic-routes), you can use [template literals and interpolation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals) to generate a list of links. For example, to generate a list of blog posts:
4444

45-
```jsx filename="app/blog/PostList.jsx"
45+
```jsx filename="app/blog/PostList.js"
4646
import Link from 'next/link'
4747

4848
export default function PostList({ posts }) {
@@ -62,7 +62,7 @@ export default function PostList({ posts }) {
6262

6363
You can use [`usePathname()`](/docs/app/api-reference/functions/use-pathname) to determine if a link is active. For example, to add a class to the active link, you can check if the current `pathname` matches the `href` of the link:
6464

65-
```jsx filename="app/ui/Navigation.jsx"
65+
```jsx filename="app/ui/Navigation.js"
6666
'use client'
6767

6868
import { usePathname } from 'next/navigation'
@@ -109,7 +109,7 @@ The `useRouter` hook allows you to programmatically change routes inside [Client
109109

110110
To use `useRouter`, import it from `next/navigation`, and call the hook inside your Client Component:
111111

112-
```jsx filename="app/page.jsx"
112+
```jsx filename="app/page.js"
113113
'use client'
114114

115115
import { useRouter } from 'next/navigation'

docs/02-app/01-building-your-application/01-routing/05-dynamic-routes.mdx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,15 @@ Dynamic Segments are passed as the `params` prop to [`layout`](/docs/app/api-ref
2121

2222
For example, a blog could include the following route `app/blog/[slug]/page.js` where `[slug]` is the Dynamic Segment for blog posts.
2323

24-
```tsx filename="app/blog/[slug]/page.js"
24+
```tsx filename="app/blog/[slug]/page.tsx" switcher
25+
export default function Page({ params: { slug: string } }) {
26+
return <div>My Post: {slug}</div>
27+
}
28+
```
29+
30+
```jsx filename="app/blog/[slug]/page.js" switcher
2531
export default function Page({ params }) {
26-
return <div>My Post</div>
32+
return <div>My Post: {slug}</div>
2733
}
2834
```
2935

docs/02-app/01-building-your-application/01-routing/08-parallel-routes.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ Both [`useSelectedLayoutSegment`](/docs/app/api-reference/functions/use-selected
126126

127127
```tsx filename="app/layout.tsx" switcher
128128
'use client'
129+
129130
import { useSelectedLayoutSegment } from 'next/navigation'
130131

131132
export default async function Layout(props: {
@@ -139,6 +140,7 @@ export default async function Layout(props: {
139140

140141
```jsx filename="app/layout.js" switcher
141142
'use client'
143+
142144
import { useSelectedLayoutSegment } from 'next/navigation'
143145

144146
export default async function Layout(props) {
@@ -251,7 +253,7 @@ export default async function Login() {
251253
}
252254
```
253255

254-
```jsx filename="app/@authModal/login/page.jsx" highlight="5" switcher
256+
```jsx filename="app/@authModal/login/page.js" highlight="5" switcher
255257
'use client'
256258
import { useRouter } from 'next/navigation'
257259
import { Modal } from 'components/modal'
@@ -280,7 +282,13 @@ If you want to navigate elsewhere and dismiss a modal, you can also use a catch-
280282
height="768"
281283
/>
282284

283-
```tsx filename="app/@authModal/[...catchAll]/page.js"
285+
```tsx filename="app/@authModal/[...catchAll]/page.tsx" switcher
286+
export default function CatchAll() {
287+
return null
288+
}
289+
```
290+
291+
```jsx filename="app/@authModal/[...catchAll]/page.js" switcher
284292
export default function CatchAll() {
285293
return null
286294
}

docs/02-app/01-building-your-application/01-routing/10-router-handlers.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ You can consider a `route` the lowest level routing primitive.
187187

188188
Each `route.js` or `page.js` file takes over all HTTP verbs for that route.
189189

190-
```tsx filename="app/page.js"
190+
```jsx filename="app/page.js"
191191
export default function Page() {
192192
return <h1>Hello, Next.js!</h1>
193193
}

docs/02-app/01-building-your-application/01-routing/12-colocation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Next.js supports storing application code (including `app`) inside an optional [
127127

128128
Next.js supports [Module Path Aliases](/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases) which make it easier to read and maintain imports across deeply nested project files.
129129

130-
```tsx filename="app/dashboard/settings/analytics/page.js"
130+
```jsx filename="app/dashboard/settings/analytics/page.js"
131131
// before
132132
import { Button } from '../../../components/button'
133133

docs/02-app/01-building-your-application/01-routing/13-internationalization.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ It’s recommended to use the user’s language preferences in the browser to se
1818

1919
For example, using the following libraries, you can look at an incoming `Request` to determine which locale to select, based on the `Headers`, locales you plan to support, and the default locale.
2020

21-
```jsx filename="middleware.js"
21+
```js filename="middleware.js"
2222
import { match } from '@formatjs/intl-localematcher'
2323
import Negotiator from 'negotiator'
2424

@@ -32,7 +32,7 @@ match(languages, locales, defaultLocale) // -> 'en-US'
3232

3333
Routing can be internationalized by either the sub-path (`/fr/products`) or domain (`my-site.fr/products`). With this information, you can now redirect the user based on the locale inside [Middleware](/docs/app/building-your-application/routing/middleware).
3434

35-
```jsx filename="middleware.js"
35+
```js filename="middleware.js"
3636
import { NextResponse } from 'next/server'
3737

3838
let locales = ['en-US', 'nl-NL', 'nl']
@@ -87,15 +87,15 @@ Changing displayed content based on the user’s preferred locale, or localizati
8787

8888
Let’s assume we want to support both English and Dutch content inside our application. We might maintain two different “dictionaries”, which are objects that give us a mapping from some key to a localized string. For example:
8989

90-
```jsx filename="dictionaries/en.json"
90+
```json filename="dictionaries/en.json"
9191
{
9292
"products": {
9393
"cart": "Add to Cart"
9494
}
9595
}
9696
```
9797

98-
```jsx filename="dictionaries/nl.json"
98+
```json filename="dictionaries/nl.json"
9999
{
100100
"products": {
101101
"cart": "Toevoegen aan Winkelwagen"

docs/02-app/01-building-your-application/03-data-fetching/01-fetching.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ If the segment is static (default), the output of the request will be cached and
368368

369369
As a temporary solution, until the caching behavior of third-party queries can be configured, you can use [segment configuration](/docs/app/api-reference/file-conventions/route-segment-config#revalidate) to customize the cache behavior of the entire segment.
370370

371-
```ts filename="app/page.tsx" switcher
371+
```tsx filename="app/page.tsx" switcher
372372
import prisma from './lib/prisma'
373373

374374
export const revalidate = 3600 // revalidate every hour

docs/02-app/01-building-your-application/03-data-fetching/02-caching.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export default async function Page() {
7676

7777
React allows you to [`cache()`](https://github.com/acdlite/rfcs/blob/first-class-promises/text/0000-first-class-support-for-promises.md) and deduplicate requests, memoizing the result of the wrapped function call. The same function called with the same arguments will reuse a cached value instead of re-running the function.
7878

79-
```tsx filename="utils/getUser.ts" switcher
79+
```ts filename="utils/getUser.ts" switcher
8080
import { cache } from 'react'
8181

8282
export const getUser = cache(async (id: string) => {
@@ -85,7 +85,7 @@ export const getUser = cache(async (id: string) => {
8585
})
8686
```
8787

88-
```jsx filename="utils/getUser.js" switcher
88+
```js filename="utils/getUser.js" switcher
8989
import { cache } from 'react'
9090

9191
export const getUser = cache(async (id) => {
@@ -146,7 +146,7 @@ Although the `getUser()` function is called twice in the example above, only one
146146

147147
`POST` requests are automatically deduplicated when using `fetch` – unless they are inside of `POST` Route Handler or come after reading `headers()`/`cookies()`. For example, if you are using GraphQL and `POST` requests in the above cases, you can use `cache` to deduplicate requests. The `cache` arguments must be flat and only include primitives. Deep objects won't match for deduplication.
148148

149-
```tsx filename="utils/getUser.ts" switcher
149+
```ts filename="utils/getUser.ts" switcher
150150
import { cache } from 'react'
151151

152152
export const getUser = cache(async (id: string) => {
@@ -155,7 +155,7 @@ export const getUser = cache(async (id: string) => {
155155
})
156156
```
157157

158-
```jsx filename="utils/getUser.js" switcher
158+
```js filename="utils/getUser.js" switcher
159159
import { cache } from 'react'
160160

161161
export const getUser = cache(async (id) => {
@@ -232,7 +232,7 @@ export default async function Page({ params: { id } }) {
232232

233233
You can combine the `cache` function, the `preload` pattern, and the `server-only` package to create a data fetching utility that can be used throughout your app.
234234

235-
```tsx filename="utils/getUser.ts" switcher
235+
```ts filename="utils/getUser.ts" switcher
236236
import { cache } from 'react'
237237
import 'server-only'
238238

@@ -245,7 +245,7 @@ export const getUser = cache(async (id: string) => {
245245
})
246246
```
247247

248-
```jsx filename="utils/getUser.js" switcher
248+
```js filename="utils/getUser.js" switcher
249249
import { cache } from 'react'
250250
import 'server-only'
251251

0 commit comments

Comments
 (0)