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

Codemod tests from createClass to ES2015 classes #7321

Merged
merged 2 commits into from Jul 23, 2016

Conversation

@keyz
Copy link
Contributor

keyz commented Jul 20, 2016

Codemodded automatically using https://github.com/reactjs/react-codemod#explanation-of-the-new-es2015-class-transform-with-property-initializers.

Reviewers: @sebmarkbage @spicyj

codemod log:

$ ../react-codemod/node_modules/.bin/jscodeshift -t ./transforms/class.js --mixin-module-name=ReactComponentWithPureRenderMixin --flow=true --pure-component=false --explicit-require=false ./src
Processing 343 files...
Spawning 7 workers...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
Sending 49 files to free worker...
./src/renderers/dom/server/__tests__/ReactServerRendering-test.js: `Bar` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/dom/client/__tests__/ReactMount-test.js: `Component` was skipped because of invalid field(s) `componentDidMount, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js: `Apple` was skipped because of inconvertible mixins.
./src/addons/__tests__/ReactComponentWithPureRenderMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Component` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/addons/transitions/ReactCSSTransitionGroupChild.js: `ReactCSSTransitionGroupChild` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Component` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Component` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Outer` was skipped because of invalid field(s) `componentWillMount, componentDidMount, componentWillReceiveProps, shouldComponentUpdate, componentWillUpdate, componentDidUpdate, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactComponentLifeCycle-test.js: `Inner` was skipped because of invalid field(s) `componentWillMount, componentDidMount, componentWillReceiveProps, shouldComponentUpdate, componentWillUpdate, componentDidUpdate, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/test/__tests__/ReactTestUtils-test.js: `SomeComponent` was skipped because of invalid field(s) `componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/addons/link/__tests__/LinkedStateMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.js: `Anon` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/devtools/__tests__/ReactComponentTreeDevtool-test.js: `Orange` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/art/ReactART.js: `Surface` was skipped because of inconvertible mixins.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `Row` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `FancyRow` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `Viz1` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `App1` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `Viz2` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/dom/shared/__tests__/ReactDOMComponent-test.js: `App2` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactCompositeComponentState-test.js: `` was skipped because of deprecated API calls. Remove calls to getDOMNode, isMounted, replaceProps, replaceState, setProps in your React component and re-run this script.
./src/renderers/shared/__tests__/ReactPerf-test.js: `` was skipped because of invalid field(s) `shouldComponentUpdate, componentWillMount, componentDidMount, componentWillReceiveProps, componentWillUpdate, componentDidUpdate, componentWillUnmount, render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactMultiChild-test.js: `MockComponent` was skipped because of invalid field(s) `componentDidMount, componentDidUpdate, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactMultiChild-test.js: `MockComponent` was skipped because of invalid field(s) `componentDidMount, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactMultiChild-test.js: `MockComponent` was skipped because of invalid field(s) `componentDidMount, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactMultiChild-test.js: `MockComponent` was skipped because of invalid field(s) `componentDidMount, componentWillUnmount` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactStateSetters-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClass-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js: `TestBindComponent` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js: `TestBindComponent` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js: `TestBindComponent` was skipped because of invalid field(s) `onMouseEnter, onMouseLeave, onClick` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/isomorphic/classic/class/__tests__/ReactBindOptout-test.js: `TestBindComponent` was skipped because of invalid field(s) `onClick, badIdeas` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/isomorphic/classic/class/__tests__/ReactBind-test.js: `TestBindComponent` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactBind-test.js: `TestBindComponent` was skipped because of invalid field(s) `onMouseEnter, onMouseLeave, onClick, badIdeas` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `Box` was skipped because of inconvertible mixins.
./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `Child` was skipped because of inconvertible mixins.
./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `Switcher` was skipped because of inconvertible mixins.
./src/renderers/shared/stack/reconciler/__tests__/ReactUpdates-test.js: `App` was skipped because of inconvertible mixins.
./src/isomorphic/classic/element/__tests__/ReactElement-test.js: `Component` was skipped because of invalid field(s) `render` on the React component. Remove any right-hand-side expressions that are not simple, like: `componentWillUpdate: createWillUpdate()` or `render: foo ? renderA : renderB`.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `Component` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
./src/isomorphic/classic/class/__tests__/ReactClassMixin-test.js: `` was skipped because of inconvertible mixins.
All done.
Results:
0 errors
0 unmodified
289 skipped
54 ok
Time elapsed: 8.729seconds

Then I reverted some non-test files and things under ./src/isomorphic/classic/class.

@sophiebits
Copy link
Collaborator

sophiebits commented Jul 20, 2016

Just 10 files? We have 53 that have createClass in them…

@keyz
Copy link
Contributor Author

keyz commented Jul 20, 2016

@spicyj oops, I forgot to turn off explicit-require. We require 'React' instead of 'react' in our tests.

@ghost ghost added the CLA Signed label Jul 20, 2016
@sophiebits
Copy link
Collaborator

sophiebits commented Jul 20, 2016

Is it because we usually require in beforeEach instead of at the top level?

@keyz keyz force-pushed the keyz:codemod-es6-component branch from 3bd05c3 to f4fe06a Jul 21, 2016
@keyz
Copy link
Contributor Author

keyz commented Jul 21, 2016

@spicyj yeah, I was wrong -- our codemod only searches for variable declarators and ES6 imports but not assignments (https://github.com/reactjs/react-codemod/blob/master/transforms/utils/ReactUtils.js#L28).

I re-ran the codemod and updated the PR. There are some failing tests and they'll be fixed by #7326 and babel/babel#3589.

@ghost ghost added the CLA Signed label Jul 21, 2016
@keyz keyz force-pushed the keyz:codemod-es6-component branch from f4fe06a to 43f55c8 Jul 21, 2016
@ghost ghost added the CLA Signed label Jul 21, 2016
@sophiebits
Copy link
Collaborator

sophiebits commented Jul 22, 2016

Accepting, feel free to merge when the babel stuff is sorted out.

@ghost ghost added the CLA Signed label Jul 22, 2016
@sebmarkbage
Copy link
Member

sebmarkbage commented Jul 22, 2016

This is really exciting!

@keyz keyz force-pushed the keyz:codemod-es6-component branch from de6bb6e to 61b14f9 Jul 23, 2016
Keyan Zhang added 2 commits Jul 23, 2016
- reverted more files under classic
@keyz keyz force-pushed the keyz:codemod-es6-component branch from 61b14f9 to 4d8a5bc Jul 23, 2016
@keyz keyz merged commit 484f96b into facebook:master Jul 23, 2016
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@keyz keyz deleted the keyz:codemod-es6-component branch Jul 23, 2016
@zpao zpao added the semver-exempt label Aug 12, 2016
@zpao zpao modified the milestones: 15-next, 15.3.1 Aug 12, 2016
zpao added a commit that referenced this pull request Aug 12, 2016
Codemod tests from createClass to ES2015 classes
(cherry picked from commit 484f96b)
koba04 added a commit to koba04/react that referenced this pull request Sep 8, 2016
koba04 added a commit to koba04/react that referenced this pull request Sep 8, 2016
sophiebits added a commit that referenced this pull request Sep 8, 2016
acdlite added a commit to acdlite/react that referenced this pull request Sep 9, 2016
zpao added a commit that referenced this pull request Oct 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.