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

Adds JSXFragment to plugin-transform-typescript check for the presence of jsx #7996

Merged
merged 5 commits into from Jun 12, 2018

Conversation

malbernaz
Copy link
Contributor

@malbernaz malbernaz commented May 21, 2018

Q                       A
Fixed Issues? Fixes #7979
Patch: Bug Fix? Yes
Major: Breaking Change? No
Minor: New Feature? No
Tests Added + Pass? Yes
Documentation PR No
Any Dependency Changes? No
License MIT

This PR Adds JSXFragment to plugin-transform-typescript check for type imports.

@babel-bot
Copy link
Collaborator

babel-bot commented May 21, 2018

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/8136/

@hzoo
Copy link
Member

hzoo commented May 22, 2018

Nice, Can you rebase on top of master? the other code changes shouldn't be necessary because of the PR I merged earlier I believe? (or maybe I'll just do it)

@malbernaz
Copy link
Contributor Author

Thanks! Had some trouble to rebase it, but there you go. Think it's ok now

Copy link
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

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

looks good

@hzoo hzoo added the PR: Bug Fix 🐛 A type of pull request used for our changelog categories label May 22, 2018
@@ -279,6 +279,9 @@ export default declare((api, { jsxPragma = "React" }) => {
JSXElement() {
sourceFileHasJsx = true;
},
JSXFragment() {
sourceFileHasJsx = true;
},
Copy link
Member

Choose a reason for hiding this comment

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

Actually we could just use JSX() { sourceFileHasJsx = true } which covers both

Copy link
Member

Choose a reason for hiding this comment

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

Yeah or "JSXElement|JSXFragment(){}", but not sure I care

Copy link
Member

Choose a reason for hiding this comment

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

I don't really care either but I have a preference for the jsx since it's smaller.

@xtuc
Copy link
Member

xtuc commented May 23, 2018

That's unexpected, now the tests are failing. The JSX syntax isn't parsed anymore for some reason.

Edit: test passes locally on my side

@malbernaz
Copy link
Contributor Author

should I regress?

@xtuc
Copy link
Member

xtuc commented May 23, 2018

Well yes but I don't understand why it fails.

@malbernaz
Copy link
Contributor Author

Yes, very strange.. No clue at all of whats happening?

@xtuc
Copy link
Member

xtuc commented May 23, 2018

I couldn't reproduce locally so it's hard to debug anyway.

@malbernaz
Copy link
Contributor Author

and it failed again...

@xtuc
Copy link
Member

xtuc commented May 23, 2018

I'm looking into it, in previous commit the tests passed.

I also pinged you on Slack, if you want to chat over there.

@malbernaz
Copy link
Contributor Author

ok, thanks

@xtuc
Copy link
Member

xtuc commented May 23, 2018

Sorry but i'm not able to reproduce it locally.

@hzoo hzoo merged commit 6d53925 into babel:master Jun 12, 2018
@jquense
Copy link
Contributor

jquense commented Aug 8, 2019

Just ran across a version of this bug, if you specify the jsx pragma in a comment that differs from the Fragment pragma it's still removed.

/** @jsx jsx **/
/** @jsxFrag React.Fragment **/

import { jsx } from '@emotion/core'
import React from 'react'

<><p/></>

Output will be:

/** @jsx jsx **/
/** @jsxFrag React.Fragment **/

import { jsx } from '@emotion/core'

jsx(React.Fragment, null, jsx('p))

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Nov 7, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Nov 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: typescript outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeScript JSX Fragment removes React import
5 participants