Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Incorrect file extension #74175

Open
henilshahdev opened this issue Dec 20, 2024 · 6 comments · May be fixed by #74197 or #74239
Open

Docs: Incorrect file extension #74175

henilshahdev opened this issue Dec 20, 2024 · 6 comments · May be fixed by #74197 or #74239
Labels
Documentation Related to Next.js' official documentation.

Comments

@henilshahdev
Copy link

What is the documentation issue?

File extension is incorrect. JavaScript files with JSX code should have the extension of .jsx instead of .js.

image

Is there any context that might help us understand?

It's a table under the Language and Filename section on the Contribution Guide.

Does the docs page already exist? Please link to it.

https://nextjs.org/docs/community/contribution-guide#language-and-filename

@henilshahdev henilshahdev added the Documentation Related to Next.js' official documentation. label Dec 20, 2024
@Netail Netail linked a pull request Dec 20, 2024 that will close this issue
@gsaivaraprasad123
Copy link

Can u assign this to me ?

@Netail
Copy link
Contributor

Netail commented Dec 22, 2024

Can u assign this to me ?

Already 2 open PRs

@gsaivaraprasad123
Copy link

gsaivaraprasad123 commented Dec 22, 2024 via email

@Marukome0743
Copy link
Contributor

Marukome0743 commented Dec 23, 2024

I wonder if it's intentional to use js extension in jsx language.

For example, see 01-installation.mdx.

```jsx filename="app/layout.js" switcher
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
```

This app/layout.js is JSX file.
However the filename uses js extension.

create-next-app templates also use layout.js.
That's why contribution guide might not be wrong.

By the way, I prefer jsx extension like app/layout.jsx.

@Netail
Copy link
Contributor

Netail commented Dec 23, 2024

Oh, you're right! That might confuse new developers as jsx in a .js file will result in IDE errors

@henilshahdev
Copy link
Author

I wonder if it's intentional to use js extension in jsx language.

For example, see 01-installation.mdx.

```jsx filename="app/layout.js" switcher
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>{children}</body>
</html>
)
}
```

This app/layout.js is JSX file. However the filename uses js extension.

create-next-app templates also use layout.js. That's why contribution guide might not be wrong.

By the way, I prefer jsx extension like app/layout.jsx.

Before filing this issue, I saw 1 other place where the file extension said .js instead of .jsx
I agree with confusion for new devs + IDE problems.

@JamBalaya56562 JamBalaya56562 linked a pull request Dec 23, 2024 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Related to Next.js' official documentation.
Projects
None yet
4 participants