-
-
Notifications
You must be signed in to change notification settings - Fork 26.8k
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
No .jsx extension? #87
Comments
The distinction between There are other syntax extensions (e.g. Flow). What would you call a JS file that uses Flow? Most editors are configurable so you can tell them to use a JSX-capable syntax scheme for Am I missing something? |
I’ll close but if I missed something please let me know and I can reopen. |
@gaearon do you know if there's an easy way to have a clear error message when people try to write a jsx file? Something like "jsx extension is not supported with create-react-app [insert more...]" instead of failing with a cryptic error message as it currently is |
Ok this makes sense. I have found this http://stackoverflow.com/questions/32832264/change-language-to-jsx-in-visual-studio-code |
Yes, we can totally do it, it’s not hard.
Let’s discuss that in #287. 👍 |
Just wanted to call attention to the Airbnb style guide, they are still recommending For vim users, while using vim-javascript & vim-jsx you can add EDIT: i'm just now seeing the reference above from airbnb/javascript#985 |
Posted more thoughts on it: airbnb/javascript#985 (comment) |
FYI we support JSX extension since 0.4.1 even though we don’t recommend it. |
I find using a jsx extension useful, while not necessary, to instantly see which files can be shared across projects that may not be using babel or even react for that matter, without looking into the files. |
Don’t you find the notation inconsistent? For example, you can’t use many ES6 features without Babel if you intend to support older browsers. Even things like destructuring. But it’s weird to call a file using destructuring (or, for example, default arguments) |
I just changed all my |
Ok I finally got the point.. The way I descibed it, I'd need to make sure that my .js files are actually all written in es5. A tedious task, and a useless one for long-living codebases. (Won't be necessary in near future). Tho it is a bit different with JSX syntax, which probably won't become standard javascript anytime soon, it's much simpler if we embrace it as a transpiler-feature just like destructuring etc. |
After reading this thread on github facebook/create-react-app#87 (comment) it's clear that there is no present use case for using the jsx extension over regular js.
enable semi on babel plugin default enable unit-test rules for all preset default enable babel rules for react preset remove webextensions global variable support as we use mozilla/webextension-polyfill now only allow jsx on .js file because of facebook/create-react-app#87 (comment) -234627904
enable semi on babel plugin default enable unit-test rules for all preset default enable babel rules for react preset remove webextensions global variable support as we use mozilla/webextension-polyfill now only allow jsx on .js file because of facebook/create-react-app#87 (comment)
Typescript is also a superset and it uses |
The only reason I use the |
@qodesmith a bit late, but there's an open issue for that: github-linguist/linguist#3677 |
After pushing some code to bitbucket and seeing that the syntax highlighting was broken, I went to see why Atlassian don't support syntax highlighting of JSX; it turns out they do! But, perhaps naturally, the file extension must be I was then reminded of this discussion, so wanted to chime in. I think it's totally reasonable for a syntax highlighter to not attempt to highlight syntax that isn't standard to language. It seems quite reasonable that if I want syntax to be highlighted as JSX, then the file should have the extension Thinking about it in this way actually makes me think having jsx syntax inside a |
TypeScript uses TSX - but personally I feel that enforcing JSX creates more overhead for developers. Most tools in the chain work fine with JSX in JS. Of course, that doesn't mean you couldn't enforce that standard in your own projects @esr360. |
For future searchers: we support both |
Shouldn't the default be to use .jsx extension in files where JSX is in use? As configured, the loader isn't set up to transpile jsx. Many code editors will provide better coloring/linting when detecting a .jsx file
The text was updated successfully, but these errors were encountered: