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

Treat .js as JSX #6562

Merged
merged 3 commits into from
Jan 26, 2016
Merged

Treat .js as JSX #6562

merged 3 commits into from
Jan 26, 2016

Conversation

RyanCavanaugh
Copy link
Member

No description provided.

@mhegazy
Copy link
Contributor

mhegazy commented Jan 21, 2016

We should add a unit test with --allowJs and some JSX syntax in there, and make sure no errors are reported.

@mhegazy
Copy link
Contributor

mhegazy commented Jan 21, 2016

👍

@DanielRosenwasser
Copy link
Member

Why exactly are we doing this?

@billti
Copy link
Member

billti commented Jan 21, 2016

@DanielRosenwasser Because ReactNative uses JSX directly in .js files, so this is becoming popular. VSCode has asked for this. As JSX is a superset, there is no ambiguity with plain JavaScript.

@billti
Copy link
Member

billti commented Jan 21, 2016

Need to update the tests also. As expected, some errors changed now that parsing default has changed (though only 2, and the errors look like an improvement - good job! :-) ).

Once done- 👍

@@ -546,7 +546,7 @@ namespace ts {

function getLanguageVariant(fileName: string) {
// .tsx and .jsx files are treated as jsx language variant.
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") ? LanguageVariant.JSX : LanguageVariant.Standard;
return fileExtensionIs(fileName, ".tsx") || fileExtensionIs(fileName, ".jsx") || fileExtensionIs(fileName, '.js') ? LanguageVariant.JSX : LanguageVariant.Standard;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double quotes.

RyanCavanaugh added a commit that referenced this pull request Jan 26, 2016
@RyanCavanaugh RyanCavanaugh merged commit 6febe3b into microsoft:master Jan 26, 2016
@RyanCavanaugh RyanCavanaugh deleted the jsIsJsx branch January 26, 2016 00:15
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants