Skip to content

Commit

Permalink
Framework: Resolve syntax errors related to Babel 6 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jun 5, 2016
1 parent 51fe695 commit d53e889
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 28 deletions.
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
4 changes: 2 additions & 2 deletions client/layout/guided-tours/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ function get( site ) {
type: 'BasicStep',
target: 'sidebar',
placement: 'beside',
next: ( () => {
next: ( ( () => {
if ( site && site.is_previewable ) {
return 'preview';
}
if ( site && site.is_customizable ) {
return 'themes';
}
return 'finish';
}() ),
} )() ),
},
preview: {
target: 'site-card-preview',
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
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
9 changes: 8 additions & 1 deletion server/user-bootstrap/shared-utils.js
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
export * from 'lib/user/shared-utils';
// These could be rewritten as `export * from`, pending resolution of Babel
// transform bug: http://phabricator.babeljs.io/T2877

import * as sharedUtils from 'lib/user/shared-utils';

export default {
...sharedUtils
};

0 comments on commit d53e889

Please sign in to comment.