Skip to content

Commit

Permalink
Merge pull request #1515 from Automattic/update/babel-6
Browse files Browse the repository at this point in the history
Framework: Upgrade to Babel 6
  • Loading branch information
aduth committed Jun 9, 2016
2 parents 2d8499d + 1a9f7c2 commit cf5441e
Show file tree
Hide file tree
Showing 19 changed files with 518 additions and 306 deletions.
15 changes: 15 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
"es2015",
"stage-2"
],
"plugins": [
"transform-runtime",
"transform-class-properties",
"transform-export-extensions",
"add-module-exports",
"syntax-jsx",
"transform-react-jsx",
"transform-react-display-name"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function deserialize( shortcode ) {
const parsed = Shortcode.parse( shortcode );

if ( parsed ) {
return ( { attrs: { named: { to, subject } = {} } = {}, content } ) => {
return ( ( { attrs: { named: { to, subject } = {} } = {}, content } ) => {
let fields = [];
let parsedField;

Expand All @@ -60,7 +60,7 @@ export function deserialize( shortcode ) {
}

return pickBy( { to, subject, fields } );
}( parsed );
} )( parsed );
}

return {};
Expand Down
10 changes: 5 additions & 5 deletions client/components/tinymce/plugins/wpcom-view/gallery-view.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ import GalleryShortcode from 'components/gallery-shortcode';
class GalleryView extends Component {

static match( content ) {
const match = shortcodeUtils.next( 'gallery', content );
const nextMatch = shortcodeUtils.next( 'gallery', content );

if ( match ) {
if ( nextMatch ) {
return {
index: match.index,
content: match.content,
index: nextMatch.index,
content: nextMatch.content,
options: {
shortcode: match.shortcode
shortcode: nextMatch.shortcode
}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ export default class EmbedViewManager extends EventEmitter {
}

const rxLink = /(^|<p>)(https?:\/\/[^\s"]+?)(<\/p>\s*|$)/gi;
let match;
while ( ( match = rxLink.exec( content ) ) ) {
const url = match[ 2 ];
let currentMatch;
while ( ( currentMatch = rxLink.exec( content ) ) ) {
const url = currentMatch[ 2 ];

// Disregard URL if it's not a supported embed pattern for the site
const isMatchingPattern = list.embeds.some( ( pattern ) => pattern.test( url ) );
Expand All @@ -118,7 +118,7 @@ export default class EmbedViewManager extends EventEmitter {
}

return {
index: match.index + match[ 1 ].length,
index: currentMatch.index + currentMatch[ 1 ].length,
content: url
};
}
Expand Down
6 changes: 3 additions & 3 deletions client/layout/guided-tours/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ function get( site ) {
target: 'sidebar',
arrow: 'left-middle',
placement: 'beside',
next: ( () => {
next: ( ( () => {
if ( site && site.is_previewable ) {
return 'click-preview';
}
if ( site && site.is_customizable ) {
return 'themes';
}
return 'finish';
}() ),
} )() ),
},
'click-preview': {
target: 'site-card-preview',
Expand Down Expand Up @@ -84,7 +84,7 @@ function get( site ) {
return 'themes';
}
return 'finish';
}() ),
} )(),
},
themes: {
text: i18n.translate( "Change your {{strong}}Theme{{/strong}} to choose a new layout, or {{strong}}Customize{{/strong}} your theme's colors, fonts, and more.", {
Expand Down
24 changes: 18 additions & 6 deletions client/lib/upgrades/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
export * from './cart';
export * from './checkout';
export * from './free-trials';
export * from './domain-management';
export * from './domain-search';
export * from './purchases';
// These could be rewritten as `export * from`, pending resolution of Babel
// transform bug: http://phabricator.babeljs.io/T2877

import * as cart from './cart';
import * as checkout from './checkout';
import * as freeTrials from './free-trials';
import * as domainManagement from './domain-management';
import * as domainSearch from './domain-search';
import * as purchases from './purchases';

export default {
...cart,
...checkout,
...freeTrials,
...domainManagement,
...domainSearch,
...purchases
};
4 changes: 2 additions & 2 deletions client/me/notification-settings/blogs-settings/blog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ export default React.createClass( {
<Header
{ ...{ blog, settings, disableToggle } }
onToggle={ () => this.setState( { isExpanded: ! isExpanded } ) } />
{ () => {
{ ( () => {
if ( isExpanded || disableToggle ) {
return <SettingsForm
{ ...{ sourceId, devices, settings, hasUnsavedChanges, isApplyAllVisible: ! disableToggle, onToggle, onSave, onSaveToAll } }
settingKeys={ [ 'new_comment', 'comment_like', 'post_like', 'follow', 'achievement', 'mentions' ] } />;
}
}() }
} )() }
</Card>
);
}
Expand Down
4 changes: 2 additions & 2 deletions client/me/notification-settings/settings-form/settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default React.createClass( {
settingKeys={ this.props.settingKeys }
settings={ this.props.settings.get( streams.EMAIL ) }
onToggle={ this.props.onToggle } />
{ () => {
{ ( () => {
if ( this.props.devices && this.props.devices.initialized && this.props.devices.get().length > 0 ) {
return <Stream
key={ streams.DEVICES }
Expand All @@ -89,7 +89,7 @@ export default React.createClass( {
settings={ this.props.settings.get( streams.DEVICES ) }
onToggle={ this.props.onToggle } />
}
}() }
} )() }
<Stream
key={ 'selected-stream' }
className={ 'selected-stream' }
Expand Down
4 changes: 2 additions & 2 deletions client/me/notification-settings/settings-form/stream.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default React.createClass( {

return (
<div className={ classNames( 'notification-settings-form-stream', this.props.className ) }>
{ () => {
{ ( () => {
if ( this.props.devices ) {
return <DeviceSelector
devices={ this.props.devices }
Expand All @@ -66,7 +66,7 @@ export default React.createClass( {
}

return ( <StreamHeader stream={ this.props.stream } /> );
}() }
} )() }
<StreamOptions
blogId={ this.props.blogId }
stream={ stream }
Expand Down
2 changes: 1 addition & 1 deletion client/me/purchases/payment/edit-card-details/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const EditCardDetails = React.createClass( {
* @param card
* @param fields
*/
mergeCard( card, fields: {} ) {
mergeCard( card, fields = {} ) {
return assign( {}, fields, {
name: card.name
} );
Expand Down
4 changes: 2 additions & 2 deletions client/my-sites/site-settings/press-this-link.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ const pressThis = function( postURL ) {

class PressThisLink extends React.Component {

propTypes: {
static propTypes = {
site: PropTypes.object.isRequired,
}
};

/**
* Legacy press-this pointing to wp-admin. This will be
Expand Down

0 comments on commit cf5441e

Please sign in to comment.