-
Notifications
You must be signed in to change notification settings - Fork 25k
Enable JSX files extension #5233
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,7 @@ class Server { | |
| dir: dir, | ||
| globs: [ | ||
| '**/*.js', | ||
| '**/*.jsx', | ||
| '**/*.json', | ||
| ].concat(assetGlobs), | ||
| }; | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this pull request doesn't implement with
.ios.jsx. But, when/if it does, it raises more questions like what happens if you have bothios.jsandios.jsx?Sorry to chime in super late but I actually think that this is harmful to support .jsx extension. We now live in a world where we have many transforms for es6, flow, jsx... Why would we add
.jsxbut not.flowor.es6. Supporting more extensions is only going to fragment tools even more.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Let's revert unless there's a stronger reason to keep this diff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert here: #5296
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As much as I'd love to see
.jsxfiles here you have a good point on supporting other extensions and the fragmentation it could lead too, I didn't see it that way. Thanks @vjeuxThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another late late chime in: An argument for supporting
.jsxis that up until recently (e.g. pre-flow),.jspretty consistently meant "a version of ES that either matches current or future ES specs". I'm assuming that JSX will never become part of ES proper?Similarly, why not
.flow? There is.tsafter all. (aside from it being potentially too late to bring up)File extensions help tools and infrastructure determine what to do w/ the source. Having to guess is error prone and added complication
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vjeux The specification / EPS for the ES6 module changes: https://github.com/nodejs/node-eps/blob/master/002-es6-modules.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! There's so much drama around this subject that we're probably going to wait until it settles and gets shipped in node before taking any action on react native
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same is true for Jest and I'd say Facebook in general. Let's see how this goes for node and then learn from whatever they do :)
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vjeux your first comment makes sense if you wouldn't talk about React ecosystem. I am having a hard time trying to understand why would you use that argument.
.jsxwas invented by React team from the beginning of the time where React appear on the market as long as I remember from 2014 (4 years ago).So yeah, I wouldn't support any random extension that appear but this one do not makes sense at all, React Native is about React, so probably
.jsxwould be more important than.jsitself, but because we started using Babel we forget where we come from.Outside that
airbnbcode style requires it for a really good reason, you are explicit about which file requires JSX syntax and which one doesn't and IDE/Editors likes that extension.SeemsGood
I can't understand your point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
temp solution. but we need built-in one!
http://www.fallingcanbedeadly.com/posts/enabling-react-native-jsx-extension