forked from opbeat/babel-plugin-add-react-displayname
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented new treatment for old export declaration (module.exports)…
… in ReactForwardedRefOrMemo components. (#1) * Implemented new treatment for old export declaration (module.exports) in ReactForwardedRefOrMemo components * fix test of moduleExportsInMemoOrForwardRefComponent * removed displayName of module.exports and fix version of babel * fix to remove displayName in module.exports case * changed fix to ignore MemberExpression node type Co-authored-by: Lucas Victor <[email protected]>
- Loading branch information
1 parent
aa2914f
commit d7d9abf
Showing
4 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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
15 changes: 15 additions & 0 deletions
15
test/fixtures/reactModuleExportsInMemoForwardRef/expected.js
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
|
||
let TestComponent = class TestComponent extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
return React.createElement("div", null); | ||
} | ||
}; | ||
TestComponent.displayName = "TestComponent"; | ||
|
||
|
||
module.exports = React.forwardRef((props, state) => React.createElement(TestComponent, null)); |
This file contains 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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
|
||
class TestComponent extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
} | ||
|
||
render() { | ||
return ( | ||
<div></div> | ||
) | ||
} | ||
} | ||
|
||
module.exports = React.forwardRef((props, state) => <TestComponent />); |