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

Whats the reason to always use .jsx instead of .js #1235

Closed
danielfttorres opened this issue Jan 7, 2017 · 3 comments
Closed

Whats the reason to always use .jsx instead of .js #1235

danielfttorres opened this issue Jan 7, 2017 · 3 comments
Labels

Comments

@danielfttorres
Copy link

@danielfttorres danielfttorres commented Jan 7, 2017

Hello, I would like to know about using .js and .jsx as an extension of the React files:

Are there any differences? Which are?

  • In which cases would the use of .jsx instead of .js is more recommended?
  • This question would be relevant when using: Babel/Webpack for precompiling files?

Thanks

@ljharb
Copy link
Collaborator

@ljharb ljharb commented Jan 7, 2017

See the discussion in #985, but essentially, .js should only ever be for files that use features of standard JavaScript - anything nonstandard, like jsx, flow, typescript, or early-stage proposals, needs a different extension. For convenience, we've chosen .jsx but you could choose any unique extension you like.

@jk1121
Copy link

@jk1121 jk1121 commented Oct 2, 2018

.jxs will describe the pupose/contents of the file from a higher level .It'll be easier while navigating to different files across the project.

@williscool
Copy link

@williscool williscool commented Oct 10, 2018

It seems like the react team at facebook and the airbnb team that own the most popular javascript style guide here are at odds with each other over file extensions.

Airbnb team seems adamant about not having any non standard code in a js file re this issue (#1235)

and this pull #985

and names any files with the stuff should have jsx

Facebook team seems adamant that js should be the only extension no matter what is in the file

facebook/create-react-app#87 (comment)

For my (and probably others) future reference when setting up a new js repo with the eslint-config-airbnb

briandk added a commit to FullstackAcademy/boilermaker that referenced this issue Jan 30, 2019
Yeah, I know, there are debates about this. I fall on the side of airbnb here: airbnb/javascript#1235 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.