Render conditionally doesn't insert { } required for JSXExpressionContainer
jedwards1211 opened this issue ยท comments
Andy Edwards commented
I'd recommend using JSCodeshift or at least Recast to transform the AST
Before
/**
* @prettier
* @flow
*/
import * as React from 'react'
export type Props = {
}
export default function Test(props: Props): React.Node {
return (
<div>
<Foo />
</div>
)
}
After
/**
* @prettier
* @flow
*/
import * as React from 'react'
export type Props = {
}
export default function Test(props: Props): React.Node {
return (
<div>
(
true
? <Foo />
: null
) </div>
)
}
Thi Nguyen commented
same here
Andy Edwards commented
is there anyone this doesn't happen for? Maybe it's specific to .js files?
Boris Litvinsky commented
Hey @anhthii @jedwards1211 I was able to reproduce an issue. Im currently working on a version that will include several fixes. Including this one
Boris Litvinsky commented
๐ This issue has been resolved in version 4.20.1 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐
Boris Litvinsky commented
Just release a fix. Pls validate!
Thi Nguyen commented
@borislit It works perfectly. Thankyou!