Updated transform-react-display-name for createReactClass addon#5554
Updated transform-react-display-name for createReactClass addon#5554
Conversation
|
@bvaughn, thanks for your PR! By analyzing the history of the files in this pull request, we identified @hzoo, @existentialism and @loganfsmyth to be potential reviewers. |
|
This PR is a bit more narrow-scope than that issue since it's only concerned with |
|
|
||
| ```js | ||
| var foo = React.createClass({}); | ||
| var foo = React.createClass({}); // React <= 15 |
There was a problem hiding this comment.
dono if we want to modify > Add displayName to React.createClass calls above this too
There was a problem hiding this comment.
We should definitely update the docs after the codemod/package are published
There was a problem hiding this comment.
Sure thing fellas. Sorry it took me a bit to circle back here. Got pulled away on some react-native stuff. Wording has been updated.
|
|
ac8a31a to
463d995
Compare
|
Sounds like we have decided to go with |
|
Let's maybe wait to merge this until 15.5 is released, just in case |
|
FYI this will be targeting 7.0 anyway unless you also do a backport to 6.x |
|
Also adding both of you to a "react" team on babel (just read access atm) so that we can assign people if that's cool (who else should I add). doing the same for flow going to use the area: react label |
|
Dan is already added I think. The rest of the team is sebmarkbage, spicyj, trueadm, and flarnie. |
|
the flow I was thinking of issues: in an updated version of the issue template maybe can specify a place for a user to auto label an issue. |
|
/poke Looks like I borked a release on react-router 3.x, since we use createClass in that version. Would love to get this out and backported to 6.x. Let me know if I can help! |
|
LGTM |
|
@timdorr yeah feel free to do the backport pr |
* 'master' of github.com:hulkish/babel: (190 commits) Fix incorrect property ordering with obj rest spread on nested (babel#5685) Fix PathHoister hoisting before a same-scope variable declaration. Updated transform-react-display-name for createReactClass addon (babel#5554) Fix PathHoister error attaching after export declarations. add .mjs to list of well known extensions Remove babel-helper-builder-conditional-assignment-operator-visitor, unused in babel [skip ci] (babel#5676) use find-cache-dir for babel-register cache (babel#5669) Fix operator processing in object super. -> parsedAst string -> sourceCode, ast -> generatedCode back to babylon Switch to pirates for babel-register. (babel#3670) [skip ci] babylon -> babel, ast -> parsedAst [readme] change code -> string Add support for object type spread (babel#5525) Fix object destructuring in param arrays (babel#5650) Remove merge helper and add more type declarations. (babel#5649) Typecheck much more of the config loading process (babel#5642) update to alpha.9 (babel#5639) v7.0.0-alpha.9 ...
* '7.0' of https://github.com/babel/babel: (190 commits) Fix incorrect property ordering with obj rest spread on nested (babel#5685) Fix PathHoister hoisting before a same-scope variable declaration. Updated transform-react-display-name for createReactClass addon (babel#5554) Fix PathHoister error attaching after export declarations. add .mjs to list of well known extensions Remove babel-helper-builder-conditional-assignment-operator-visitor, unused in babel [skip ci] (babel#5676) use find-cache-dir for babel-register cache (babel#5669) Fix operator processing in object super. -> parsedAst string -> sourceCode, ast -> generatedCode back to babylon Switch to pirates for babel-register. (babel#3670) [skip ci] babylon -> babel, ast -> parsedAst [readme] change code -> string Add support for object type spread (babel#5525) Fix object destructuring in param arrays (babel#5650) Remove merge helper and add more type declarations. (babel#5649) Typecheck much more of the config loading process (babel#5642) update to alpha.9 (babel#5639) v7.0.0-alpha.9 ...
|
Any chance to have this backported to babel 6? |
…l#5554) * Updated transform-react-display-name for ReactCreateClass addon * Tweaked description for transform-react-display-name plugin * Changed ReactCreateClass to createReactClass
The React team will be deprecating
React.createClasssoon (see facebook/react/pull/9232). This method will be moving to a new add-on packagecreate-react-class(not yet releasededit Released on Friday, April 7). We are in the process of creating a codemod now that will replace:with:
This diff updates the
transform-react-display-nameplugin to handle the new naming convention (createReactClass) as well as the pre-existing use case (React.createClass) in order to remain backwards compatible with existing versions of React. The new check is a naive string comparison and so it's pretty weak- but hopefully this is sufficient given thatcreateClassis deprecated going forward.Caveat: It is possible that someone will manually write code using the new add-on that does not conform to the naming convention used by the codemod. This use case is not supported.
cc @acdlite