Skip to content

Commit

Permalink
apply codemod: commonjs-exports (Automattic#18678)
Browse files Browse the repository at this point in the history
* apply codemod: commonjs-export to /client

* revert files that server needs

* prettier: reformat files
  • Loading branch information
samouri authored Oct 10, 2017
1 parent 0beb33a commit 3804076
Show file tree
Hide file tree
Showing 388 changed files with 431 additions and 429 deletions.
2 changes: 1 addition & 1 deletion client/blocks/author-selector/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ const SwitcherShell = localize(
} )
);

module.exports = localize(
export default localize(
React.createClass( {
displayName: 'AuthorSelector',
propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/blocks/site/placeholder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React from 'react';
import debugFactory from 'debug';
const debug = debugFactory( 'calypso:my-sites:site' );

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'SitePlaceholder',

componentDidMount: function() {
Expand Down
2 changes: 1 addition & 1 deletion client/components/bulk-select/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import React from 'react';
import Card from 'components/card';
import BulkSelect from 'components/bulk-select';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'BulkSelects',

handleToggleAll( checkedState ) {
Expand Down
2 changes: 1 addition & 1 deletion client/components/button-group/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,4 @@ var Buttons = React.createClass( {
},
} );

module.exports = Buttons;
export default Buttons;
2 changes: 1 addition & 1 deletion client/components/button/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,4 +272,4 @@ var Buttons = React.createClass( {
},
} );

module.exports = Buttons;
export default Buttons;
2 changes: 1 addition & 1 deletion client/components/card/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ var Cards = React.createClass( {
},
} );

module.exports = Cards;
export default Cards;
2 changes: 1 addition & 1 deletion client/components/chart/bar-container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import userModule from 'lib/user';
*/
const user = userModule();

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'ModuleChartBarContainer',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/chart/bar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Gridicon from 'gridicons';
*/
import Tooltip from 'components/tooltip';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'ModuleChartBar',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/chart/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,4 @@ class ModuleChartExport extends React.Component {
}
}

module.exports = localize( ModuleChartExport );
export default localize( ModuleChartExport );
2 changes: 1 addition & 1 deletion client/components/chart/label.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import userModule from 'lib/user';
*/
const user = userModule();

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'ModuleChartLabel',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/chart/x-axis.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { throttle } from 'lodash';
*/
import Label from './label';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'ModuleChartXAxis',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/data/cart/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ var CartData = React.createClass( {
},
} );

module.exports = CartData;
export default CartData;
2 changes: 1 addition & 1 deletion client/components/data/checkout/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ var CheckoutData = React.createClass( {
},
} );

module.exports = CheckoutData;
export default CheckoutData;
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function getStateData( siteId ) {
};
}

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'MediaLibrarySelectedData',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/data/media-list-data/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function getStateData( siteId ) {
};
}

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'MediaListData',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/data/media-list-data/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/** @format */
module.exports = {
export default {
/**
* Given a media filter, returns a partial mime type that can be used to
* find only media of a certain type. Returns a blank mime if no filter,
Expand Down
2 changes: 1 addition & 1 deletion client/components/data/media-validation-data/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function getStateData( siteId ) {
};
}

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'MediaValidationData',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/feature-example/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import React from 'react';
import FeatureExample from '../index';
import PluginItem from 'my-sites/plugins/plugin-item/plugin-item';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'FeatureExample',

getContent: function() {
Expand Down
2 changes: 1 addition & 1 deletion client/components/gauge/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import PureRenderMixin from 'react-pure-render/mixin';
*/
import Gauge from 'components/gauge';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'Gauge',

mixins: [ PureRenderMixin ],
Expand Down
2 changes: 1 addition & 1 deletion client/components/gauge/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PropTypes from 'prop-types';
import React from 'react';
import PureRenderMixin from 'react-pure-render/mixin';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'Gauge',

mixins: [ PureRenderMixin ],
Expand Down
2 changes: 1 addition & 1 deletion client/components/header-cake/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const noop = function() {};

const action = () => alert( 'i <3 cake' );

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'Headers',

mixins: [ PureRenderMixin ],
Expand Down
2 changes: 1 addition & 1 deletion client/components/infinite-list/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import smartSetState from 'lib/react-smart-set-state';

const debug = debugFactory( 'calypso:infinite-list' );

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'InfiniteList',

lastScrollTop: -1,
Expand Down
2 changes: 1 addition & 1 deletion client/components/infinite-list/scroll-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,4 +467,4 @@ class ScrollHelper {
}
}

module.exports = ScrollHelper;
export default ScrollHelper;
2 changes: 1 addition & 1 deletion client/components/info-popover/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ var InfoPopoverExample = React.createClass( {
},
} );

module.exports = InfoPopoverExample;
export default InfoPopoverExample;
2 changes: 1 addition & 1 deletion client/components/notice/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,4 +129,4 @@ var Notices = React.createClass( {
},
} );

module.exports = Notices;
export default Notices;
2 changes: 1 addition & 1 deletion client/components/olark-chatbox/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const debug = debugFactory( 'calypso:olark:chatbox' );
*/
import OlarkEvents from 'lib/olark-events';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'OlarkChatBox',

/**
Expand Down
2 changes: 1 addition & 1 deletion client/components/payment-logo/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ const PaymentLogoExamples = React.createClass( {
},
} );

module.exports = PaymentLogoExamples;
export default PaymentLogoExamples;
2 changes: 1 addition & 1 deletion client/components/payment-logo/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ const PaymentLogo = React.createClass( {
},
} );

module.exports = PaymentLogo;
export default PaymentLogo;
3 changes: 1 addition & 2 deletions client/components/phone-input/data.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @format */
// Generated by build-metadata.js
/* eslint-disable */
module.exports = {
export default {
countries: {
KV: {
isoCode: 'KV',
Expand Down Expand Up @@ -6336,4 +6336,3 @@ module.exports = {
1905: [ 'CA' ],
},
};
/* eslint-enable */
2 changes: 1 addition & 1 deletion client/components/popover/menu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,4 +169,4 @@ const PopoverMenu = React.createClass( {
},
} );

module.exports = PopoverMenu;
export default PopoverMenu;
2 changes: 1 addition & 1 deletion client/components/progress-bar/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import PureRenderMixin from 'react-pure-render/mixin';
*/
import ProgressBar from 'components/progress-bar';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'ProgressBar',

mixins: [ PureRenderMixin ],
Expand Down
2 changes: 1 addition & 1 deletion client/components/pulsing-dot/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ var PulsingDot = React.createClass( {
},
} );

module.exports = PulsingDot;
export default PulsingDot;
2 changes: 1 addition & 1 deletion client/components/segmented-control/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,4 +148,4 @@ var SegmentedControlDemo = React.createClass( {
},
} );

module.exports = SegmentedControlDemo;
export default SegmentedControlDemo;
2 changes: 1 addition & 1 deletion client/components/segmented-control/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -234,4 +234,4 @@ var SegmentedControl = React.createClass( {
},
} );

module.exports = SegmentedControl;
export default SegmentedControl;
2 changes: 1 addition & 1 deletion client/components/segmented-control/item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,4 @@ var SegmentedControlItem = React.createClass( {
},
} );

module.exports = SegmentedControlItem;
export default SegmentedControlItem;
2 changes: 1 addition & 1 deletion client/components/select/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ var Selects = React.createClass( {
},
} );

module.exports = Selects;
export default Selects;
2 changes: 1 addition & 1 deletion client/components/site-users-fetcher/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var defaultOptions = {
offset: 0,
};

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'SiteUsersFetcher',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/sites-popover/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import Popover from 'components/popover';
import { hasTouch } from 'lib/touch-detect';
import SiteSelector from 'components/site-selector';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'SitesPopover',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/spinner/docs/example.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import PureRenderMixin from 'react-pure-render/mixin';
*/
import Spinner from 'components/spinner';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'Spinner',

mixins: [ PureRenderMixin ],
Expand Down
2 changes: 1 addition & 1 deletion client/components/stat-update-indicator/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ var StatUpdateIndicator = React.createClass( {
},
} );

module.exports = StatUpdateIndicator;
export default StatUpdateIndicator;
2 changes: 1 addition & 1 deletion client/components/sticky-panel/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import classNames from 'classnames';
*/
import viewport from 'lib/viewport';

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'StickyPanel',

propTypes: {
Expand Down
2 changes: 1 addition & 1 deletion client/components/tinymce/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import i18n from 'i18n-calypso';
* @see wp_mce_translation() in src/wp-includes/class-wp-editor.php from WordPress
* In short, TinyMCE uses these strings to translate its internal strings
*/
module.exports = {
export default {
Formats: i18n.translate( 'Formats', { context: 'TinyMCE' } ),
Headings: i18n.translate( 'Headings', { context: 'TinyMCE' } ),
'Heading 1': i18n.translate( 'Heading 1' ),
Expand Down
2 changes: 1 addition & 1 deletion client/components/tinymce/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const CONTENT_CSS = [
'https://fonts.googleapis.com/css?family=Noto+Serif:400,400i,700,700i&subset=cyrillic,cyrillic-ext,greek,greek-ext,latin-ext,vietnamese',
];

module.exports = React.createClass( {
export default React.createClass( {
displayName: 'TinyMCE',

propTypes: {
Expand Down
4 changes: 2 additions & 2 deletions client/components/tinymce/plugins/media/plugin.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,6 @@ function mediaButton( editor ) {
advanced( editor );
}

module.exports = function() {
export default function() {
tinymce.PluginManager.add( 'wpcom/media', mediaButton );
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ function touchScrollToolbar( editor ) {
} );
}

module.exports = function() {
export default function() {
tinymce.PluginManager.add( 'wpcom/touchscrolltoolbar', touchScrollToolbar );
};
}
4 changes: 2 additions & 2 deletions client/components/tinymce/plugins/wpcom-autoresize/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,6 @@ function wcpomAutoResize( editor ) {
editor.addCommand( 'wpcomAutoResize', resize );
}

module.exports = function() {
export default function() {
tinymce.PluginManager.add( 'wpcom/autoresize', wcpomAutoResize );
};
}
4 changes: 2 additions & 2 deletions client/components/tinymce/plugins/wpcom-charmap/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ function wpcomCharMapPlugin( editor ) {
} );
}

module.exports = function() {
export default function() {
tinymce.PluginManager.add( 'wpcom/charmap', wpcomCharMapPlugin );
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,4 +140,4 @@ const HelpModal = React.createClass( {
},
} );

module.exports = localize( HelpModal );
export default localize( HelpModal );
4 changes: 2 additions & 2 deletions client/components/tinymce/plugins/wpcom-help/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ function wpcomHelpPlugin( editor ) {
} );
}

module.exports = function() {
export default function() {
tinymce.PluginManager.add( 'wpcom/help', wpcomHelpPlugin );
};
}
4 changes: 2 additions & 2 deletions client/components/tinymce/plugins/wpcom-view/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,6 @@ function wpview( editor ) {
} );
}

module.exports = function() {
export default function() {
tinymce.PluginManager.add( 'wpcom/view', wpview );
};
}
Loading

0 comments on commit 3804076

Please sign in to comment.