Skip to content

Commit

Permalink
Update registerComponent calls to preferred syntax
Browse files Browse the repository at this point in the history
Call `registerComponent` with object argument instead of rest parameters

Executed following find & replace regex:
* `registerComponent\(('[A-Za-z0-9]*'), ([A-Za-z0-9]*), (.*)\)`
➡ `registerComponent({ name: $1, component: $2, hocs: [$3] })`
* `registerComponent\(('[A-Za-z0-9]*'), ([A-Za-z0-9]*)\)` ➡ `registerComponent({ name: $1, component: $2 })`

Note: This change exacerbates VulcanJS/Vulcan#2061, and probably shouldn't be merged until that issue is resolved.
  • Loading branch information
mousetraps committed Sep 11, 2018
1 parent d72be2d commit cdc7f06
Show file tree
Hide file tree
Showing 116 changed files with 116 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const MyCustomPage = () => {
)
}

registerComponent('MyCustomPage', MyCustomPage);
registerComponent({ name: 'MyCustomPage', component: MyCustomPage });
2 changes: 1 addition & 1 deletion packages/example-forms/lib/components/FormFunnel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ FormFunnel.contextTypes = {
updateCurrentValues: PropTypes.func,
};

registerComponent('FormFunnel', FormFunnel);
registerComponent({ name: 'FormFunnel', component: FormFunnel });
2 changes: 1 addition & 1 deletion packages/example-forms/lib/components/Home.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ const Home = ({ flash }) => (
</div>
);

registerComponent('Home', Home, withMessages);
registerComponent({ name: 'Home', component: Home, hocs: [withMessages] });
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ const CategoriesDashboard = () =>

</div>

registerComponent('CategoriesDashboard', CategoriesDashboard);
registerComponent({ name: 'CategoriesDashboard', component: CategoriesDashboard });
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ CategoriesEditForm.contextTypes = {
intl: intlShape,
};

registerComponent('CategoriesEditForm', CategoriesEditForm, withMessages);
registerComponent({ name: 'CategoriesEditForm', component: CategoriesEditForm, hocs: [withMessages] });
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,4 @@ const options = {
pollInterval: 0,
};

registerComponent('CategoriesMenu', CategoriesMenu, withRouter, withApollo, [withList, options], withCurrentUser);
registerComponent({ name: 'CategoriesMenu', component: CategoriesMenu, hocs: [withRouter, withApollo, [withList, options], withCurrentUser] });
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ CategoriesNewForm.contextTypes = {
intl: intlShape,
};

registerComponent('CategoriesNewForm', CategoriesNewForm, withMessages);
registerComponent({ name: 'CategoriesNewForm', component: CategoriesNewForm, hocs: [withMessages] });
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ CommentsEditForm.propTypes = {
cancelCallback: PropTypes.func
};

registerComponent('CommentsEditForm', CommentsEditForm, withMessages);
registerComponent({ name: 'CommentsEditForm', component: CommentsEditForm, hocs: [withMessages] });
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,4 @@ CommentsItem.propTypes = {
flash: PropTypes.func,
};

registerComponent('CommentsItem', CommentsItem, withMessages);
registerComponent({ name: 'CommentsItem', component: CommentsItem, hocs: [withMessages] });
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ const CommentsList = ({comments, commentCount, currentUser}) => {

CommentsList.displayName = "CommentsList";

registerComponent('CommentsList', CommentsList);
registerComponent({ name: 'CommentsList', component: CommentsList });
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ const CommentsLoadMore = ({loadMore, count, totalCount}) => {

CommentsLoadMore.displayName = "CommentsLoadMore";

registerComponent('CommentsLoadMore', CommentsLoadMore);
registerComponent({ name: 'CommentsLoadMore', component: CommentsLoadMore });
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ CommentsNewForm.propTypes = {
flash: PropTypes.func,
};

registerComponent('CommentsNewForm', CommentsNewForm, withMessages);
registerComponent({ name: 'CommentsNewForm', component: CommentsNewForm, hocs: [withMessages] });
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ CommentsNode.propTypes = {
comment: PropTypes.object.isRequired, // the current comment
};

registerComponent('CommentsNode', CommentsNode);
registerComponent({ name: 'CommentsNode', component: CommentsNode });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/common/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ const Footer = props => {

Footer.displayName = "Footer";

registerComponent('Footer', Footer);
registerComponent({ name: 'Footer', component: Footer });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/common/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ Header.propTypes = {
currentUser: PropTypes.object,
};

registerComponent('Header', Header, withCurrentUser);
registerComponent({ name: 'Header', component: Header, hocs: [withCurrentUser] });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/common/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ const Layout = ({currentUser, children, currentRoute}) =>

</div>

registerComponent('Layout', Layout, withCurrentUser);
registerComponent({ name: 'Layout', component: Layout, hocs: [withCurrentUser] });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/common/Logo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const Logo = ({logoUrl, siteTitle}) => {

Logo.displayName = "Logo";

registerComponent('Logo', Logo);
registerComponent({ name: 'Logo', component: Logo });
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ function showBanner (user) {
);
}

registerComponent('Newsletter', Newsletter, withMutation(mutationOptions), withCurrentUser, withMessages);
registerComponent({ name: 'Newsletter', component: Newsletter, hocs: [withMutation(mutationOptions), withCurrentUser, withMessages] });
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ NewsletterButton.contextTypes = {
const addOptions = {name: 'addUserNewsletter', args: {userId: 'String'}};
const removeOptions = {name: 'removeUserNewsletter', args: {userId: 'String'}};

registerComponent('NewsletterButton', NewsletterButton, withCurrentUser, withMutation(addOptions), withMutation(removeOptions), withMessages);
registerComponent({ name: 'NewsletterButton', component: NewsletterButton, hocs: [withCurrentUser, withMutation(addOptions), withMutation(removeOptions), withMessages] });
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ SearchForm.contextTypes = {
intl: intlShape
};

registerComponent('SearchForm', SearchForm, withRouter);
registerComponent({ name: 'SearchForm', component: SearchForm, hocs: [withRouter] });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/common/Vote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ Vote.contextTypes = {
intl: intlShape
};

registerComponent('Vote', Vote, withMessages, withVote);
registerComponent({ name: 'Vote', component: Vote, hocs: [withMessages, withVote] });
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ const PostsCategories = ({post}) => {

PostsCategories.displayName = "PostsCategories";

registerComponent('PostsCategories', PostsCategories);
registerComponent({ name: 'PostsCategories', component: PostsCategories });
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const PostsCommenters = ({post}) => {

PostsCommenters.displayName = "PostsCommenters";

registerComponent('PostsCommenters', PostsCommenters);
registerComponent({ name: 'PostsCommenters', component: PostsCommenters });
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ const options = {
limit: 0,
};

registerComponent('PostsCommentsThread', PostsCommentsThread, [withList, options], withCurrentUser);
registerComponent({ name: 'PostsCommentsThread', component: PostsCommentsThread, hocs: [[withList, options], withCurrentUser] });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/posts/PostsDaily.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ const PostsDaily = props => {

PostsDaily.displayName = 'PostsDaily';

registerComponent('PostsDaily', PostsDaily);
registerComponent({ name: 'PostsDaily', component: PostsDaily });
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,4 @@ const options = {
limit: 0,
};

registerComponent('PostsDailyList', PostsDailyList, withCurrentUser, [withList, options]);
registerComponent({ name: 'PostsDailyList', component: PostsDailyList, hocs: [withCurrentUser, [withList, options]] });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/posts/PostsDay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ PostsDay.propTypes = {
number: PropTypes.number
};

registerComponent('PostsDay', PostsDay);
registerComponent({ name: 'PostsDay', component: PostsDay });
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ PostsEditForm.contextTypes = {
intl: intlShape
}

registerComponent('PostsEditForm', PostsEditForm, withMessages, withRouter, withCurrentUser);
registerComponent({ name: 'PostsEditForm', component: PostsEditForm, hocs: [withMessages, withRouter, withCurrentUser] });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/posts/PostsHome.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const PostsHome = (props, context) => {

PostsHome.displayName = "PostsHome";

registerComponent('PostsHome', PostsHome);
registerComponent({ name: 'PostsHome', component: PostsHome });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/posts/PostsItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ PostsItem.propTypes = {
terms: PropTypes.object,
};

registerComponent('PostsItem', PostsItem);
registerComponent({ name: 'PostsItem', component: PostsItem });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/posts/PostsList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ const options = {
fragmentName: 'PostsList',
};

registerComponent('PostsList', PostsList, withCurrentUser, [withList, options]);
registerComponent({ name: 'PostsList', component: PostsList, hocs: [withCurrentUser, [withList, options]] });
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ const PostsListHeader = () => {

PostsListHeader.displayName = "PostsListHeader";

registerComponent('PostsListHeader', PostsListHeader);
registerComponent({ name: 'PostsListHeader', component: PostsListHeader });
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ const PostsLoadMore = ({loading, loadMore, count, totalCount}) => {

PostsLoadMore.displayName = "PostsLoadMore";

registerComponent('PostsLoadMore', PostsLoadMore);
registerComponent({ name: 'PostsLoadMore', component: PostsLoadMore });
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const PostsLoading = props => {

PostsLoading.displayName = "PostsLoading";

registerComponent('PostsLoading', PostsLoading);
registerComponent({ name: 'PostsLoading', component: PostsLoading });
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ PostsNewButton.contextTypes = {
intl: intlShape
};

registerComponent('PostsNewButton', PostsNewButton, withCurrentUser);
registerComponent({ name: 'PostsNewButton', component: PostsNewButton, hocs: [withCurrentUser] });
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ const options = {
pollInterval: 0,
};

registerComponent('PostsNewForm', PostsNewForm, withRouter, withMessages, [withList, options]);
registerComponent({ name: 'PostsNewForm', component: PostsNewForm, hocs: [withRouter, withMessages, [withList, options]] });
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const PostsNoMore = props => <p className="posts-no-more"><FormattedMessage id="

PostsNoMore.displayName = "PostsNoMore";

registerComponent('PostsNoMore', PostsNoMore);
registerComponent({ name: 'PostsNoMore', component: PostsNoMore });
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ const PostsNoResults = props => <p className="posts-no-results"><FormattedMessag

PostsNoResults.displayName = "PostsNoResults";

registerComponent('PostsNoResults', PostsNoResults);
registerComponent({ name: 'PostsNoResults', component: PostsNoResults });
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const PostsSingle = (props, context) => {

PostsSingle.displayName = "PostsSingle";

registerComponent('PostsSingle', PostsSingle);
registerComponent({ name: 'PostsSingle', component: PostsSingle });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/posts/PostsStats.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ const PostsStats = ({post}) => {

PostsStats.displayName = "PostsStats";

registerComponent('PostsStats', PostsStats);
registerComponent({ name: 'PostsStats', component: PostsStats });
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ const PostsThumbnail = ({post}) =>

PostsThumbnail.displayName = "PostsThumbnail";

registerComponent('PostsThumbnail', PostsThumbnail);
registerComponent({ name: 'PostsThumbnail', component: PostsThumbnail });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/posts/PostsViews.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ PostsViews.contextTypes = {

PostsViews.displayName = 'PostsViews';

registerComponent('PostsViews', PostsViews, withCurrentUser, withRouter);
registerComponent({ name: 'PostsViews', component: PostsViews, hocs: [withCurrentUser, withRouter] });
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ UsersAccount.propTypes = {

UsersAccount.displayName = 'UsersAccount';

registerComponent('UsersAccount', UsersAccount, withCurrentUser);
registerComponent({ name: 'UsersAccount', component: UsersAccount, hocs: [withCurrentUser] });
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ const UsersAccountMenu = ({ state }) => (

UsersAccountMenu.displayName = 'UsersAccountMenu';

registerComponent('UsersAccountMenu', UsersAccountMenu);
registerComponent({ name: 'UsersAccountMenu', component: UsersAccountMenu });
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ UsersAvatar.defaultProps = {

UsersAvatar.displayName = 'UsersAvatar';

registerComponent('UsersAvatar', UsersAvatar);
registerComponent({ name: 'UsersAvatar', component: UsersAvatar });
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ UsersEditForm.contextTypes = {

UsersEditForm.displayName = 'UsersEditForm';

registerComponent('UsersEditForm', UsersEditForm, withMessages, withCurrentUser);
registerComponent({ name: 'UsersEditForm', component: UsersEditForm, hocs: [withMessages, withCurrentUser] });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/users/UsersMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ UsersMenu.propsTypes = {
client: PropTypes.object,
};

registerComponent('UsersMenu', UsersMenu, withCurrentUser, withApollo);
registerComponent({ name: 'UsersMenu', component: UsersMenu, hocs: [withCurrentUser, withApollo] });
2 changes: 1 addition & 1 deletion packages/example-forum/lib/components/users/UsersName.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ UsersName.propTypes = {

UsersName.displayName = 'UsersName';

registerComponent('UsersName', UsersName);
registerComponent({ name: 'UsersName', component: UsersName });
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ const options = {
fragmentName: 'UsersProfile',
};

registerComponent('UsersProfile', UsersProfile, withCurrentUser, [withDocument, options]);
registerComponent({ name: 'UsersProfile', component: UsersProfile, hocs: [withCurrentUser, [withDocument, options]] });
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ const options = {
fragment: mustCompleteFragment,
};

registerComponent('UsersProfileCheck', UsersProfileCheck, withMessages, [withDocument, options]);
registerComponent({ name: 'UsersProfileCheck', component: UsersProfileCheck, hocs: [withMessages, [withDocument, options]] });
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ const UsersSingle = (props, context) => {

UsersSingle.displayName = "UsersSingle";

registerComponent('UsersSingle', UsersSingle);
registerComponent({ name: 'UsersSingle', component: UsersSingle });
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ const CommentsEditForm = ({documentId, closeModal}) =>
}}
/>

registerComponent('CommentsEditForm', CommentsEditForm);
registerComponent({ name: 'CommentsEditForm', component: CommentsEditForm });
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ const CommentsItem = ({comment, currentUser}) =>

</div>

registerComponent('CommentsItem', CommentsItem);
registerComponent({ name: 'CommentsItem', component: CommentsItem });
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ const options = {
fragmentName: 'CommentsItemFragment',
};

registerComponent('CommentsList', CommentsList, withCurrentUser, [withList, options]);
registerComponent({ name: 'CommentsList', component: CommentsList, hocs: [withCurrentUser, [withList, options]] });
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ const CommentsNewForm = ({picId}) =>

</div>

registerComponent('CommentsNewForm', CommentsNewForm);
registerComponent({ name: 'CommentsNewForm', component: CommentsNewForm });
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,4 @@ const Header = ({currentUser}) =>

</div>

registerComponent('Header', Header, withCurrentUser);
registerComponent({ name: 'Header', component: Header, hocs: [withCurrentUser] });
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ const options = {
fragmentName: 'PicsDetailsFragment',
};

registerComponent('PicsDetails', PicsDetails, [withDocument, options]);
registerComponent({ name: 'PicsDetails', component: PicsDetails, hocs: [[withDocument, options]] });
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ const PicsEditForm = ({documentId, closeModal}) =>
}}
/>

registerComponent('PicsEditForm', PicsEditForm);
registerComponent({ name: 'PicsEditForm', component: PicsEditForm });
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ const PicsItem = ({pic, currentUser}) =>

</div>

registerComponent('PicsItem', PicsItem);
registerComponent({ name: 'PicsItem', component: PicsItem });
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ const options = {
limit: 6
};

registerComponent('PicsList', PicsList, withCurrentUser, [withList, options]);
registerComponent({ name: 'PicsList', component: PicsList, hocs: [withCurrentUser, [withList, options]] });
Loading

0 comments on commit cdc7f06

Please sign in to comment.