From dfbf60195c3f9872aead8b566c2fa19518355b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Su=C3=A1rez?= Date: Tue, 28 Jun 2016 22:36:35 +0200 Subject: [PATCH] Merge pull request #202 from Automattic/update/es6-export Use ES6 `export` keyword consistently --- packages/wpcom.js/index.js | 7 +------ packages/wpcom.js/lib/me.connected-application.js | 7 +------ packages/wpcom.js/lib/me.js | 7 +------ packages/wpcom.js/lib/me.keyring-connection.js | 7 +------ packages/wpcom.js/lib/me.publicize-connection.js | 7 +------ packages/wpcom.js/lib/me.settings.js | 7 +------ packages/wpcom.js/lib/me.settings.password.js | 7 +------ packages/wpcom.js/lib/me.settings.profile-links.js | 8 +------- packages/wpcom.js/lib/me.two-step.js | 7 +------ packages/wpcom.js/lib/me.two-step.sms.js | 7 +------ packages/wpcom.js/lib/site.category.js | 7 +------ packages/wpcom.js/lib/site.comment.js | 7 +------ packages/wpcom.js/lib/site.comment.like.js | 7 +------ packages/wpcom.js/lib/site.follow.js | 7 +------ packages/wpcom.js/lib/site.media.js | 7 +------ packages/wpcom.js/lib/site.post.like.js | 7 +------ packages/wpcom.js/lib/site.post.reblog.js | 7 +------ packages/wpcom.js/lib/site.tag.js | 7 +------ packages/wpcom.js/lib/site.wordads.earnings.js | 8 +------- packages/wpcom.js/lib/site.wordads.js | 7 +------ packages/wpcom.js/lib/site.wordads.settings.js | 7 +------ packages/wpcom.js/lib/site.wordads.tos.js | 7 +------ packages/wpcom.js/lib/users.js | 7 +------ packages/wpcom.js/lib/util/pinghub.js | 7 +------ packages/wpcom.js/lib/util/request.js | 7 +------ packages/wpcom.js/lib/util/send-request.js | 2 +- packages/wpcom.js/package.json | 2 +- 27 files changed, 27 insertions(+), 154 deletions(-) diff --git a/packages/wpcom.js/index.js b/packages/wpcom.js/index.js index 260df175120d3..f4999a4206b8b 100644 --- a/packages/wpcom.js/index.js +++ b/packages/wpcom.js/index.js @@ -37,7 +37,7 @@ const DEFAULT_ASYNC_TIMEOUT = 30000; * @param {Function} [reqHandler] - function Request Handler * @return {WPCOM} wpcom instance */ -function WPCOM( token, reqHandler ) { +export default function WPCOM( token, reqHandler ) { if ( ! ( this instanceof WPCOM ) ) { return new WPCOM( token, reqHandler ); } @@ -214,8 +214,3 @@ if ( ! Promise.prototype.timeout ) { ] ); }; } - -/** - * Expose `WPCOM` module - */ -module.exports = WPCOM; diff --git a/packages/wpcom.js/lib/me.connected-application.js b/packages/wpcom.js/lib/me.connected-application.js index c5216f9f1481f..e540981bd0a3d 100644 --- a/packages/wpcom.js/lib/me.connected-application.js +++ b/packages/wpcom.js/lib/me.connected-application.js @@ -1,6 +1,6 @@ const root = '/me/connected-applications/'; -class MeConnectedApp { +export default class MeConnectedApp { /** * `MeConnectedApp` constructor. @@ -40,8 +40,3 @@ class MeConnectedApp { return this.wpcom.req.del( root + this._id + '/delete', query, fn ); } } - -/** -* Expose `MeConnectedApp` module -*/ -module.exports = MeConnectedApp; diff --git a/packages/wpcom.js/lib/me.js b/packages/wpcom.js/lib/me.js index e3bf958244956..aa34854082129 100644 --- a/packages/wpcom.js/lib/me.js +++ b/packages/wpcom.js/lib/me.js @@ -13,7 +13,7 @@ import MeTwoStep from './me.two-step'; * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Me( wpcom ) { +export default function Me( wpcom ) { if ( ! ( this instanceof Me ) ) { return new Me( wpcom ); } @@ -177,8 +177,3 @@ Me.prototype.twoStep = function() { Me.prototype.keyringConnection = function( id ) { return new MeKeyringConnection( id, this.wpcom ); }; - -/** - * Expose `Me` module - */ -module.exports = Me; diff --git a/packages/wpcom.js/lib/me.keyring-connection.js b/packages/wpcom.js/lib/me.keyring-connection.js index 3cc0e7d96c8c7..60cf600a348a7 100644 --- a/packages/wpcom.js/lib/me.keyring-connection.js +++ b/packages/wpcom.js/lib/me.keyring-connection.js @@ -1,6 +1,6 @@ const root = '/me/keyring-connections/'; -class KeyringConnection { +export default class KeyringConnection { /** * `KeyringConnection` constructor. @@ -40,8 +40,3 @@ class KeyringConnection { return this.wpcom.req.del( root + this._id + '/delete', query, fn ); } } - -/** -* Expose `KeyringConnection` module -*/ -module.exports = KeyringConnection; diff --git a/packages/wpcom.js/lib/me.publicize-connection.js b/packages/wpcom.js/lib/me.publicize-connection.js index 43ce5694382e0..b78942455e99c 100644 --- a/packages/wpcom.js/lib/me.publicize-connection.js +++ b/packages/wpcom.js/lib/me.publicize-connection.js @@ -1,6 +1,6 @@ const root = '/me/publicize-connections/'; -class PublicizeConnection { +export default class PublicizeConnection { /** * `PublicizeConnection` constructor. * @@ -63,8 +63,3 @@ class PublicizeConnection { return this.wpcom.req.del( root + this._id + '/delete', query, fn ); } } - -/** -* Expose `PublicizeConnection` module -*/ -module.exports = PublicizeConnection; diff --git a/packages/wpcom.js/lib/me.settings.js b/packages/wpcom.js/lib/me.settings.js index b561fad791132..7540218c8582f 100644 --- a/packages/wpcom.js/lib/me.settings.js +++ b/packages/wpcom.js/lib/me.settings.js @@ -22,7 +22,7 @@ import MeSettingsPassword from './me.settings.password'; * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function MeSettings( wpcom ) { +export default function MeSettings( wpcom ) { if ( ! ( this instanceof MeSettings ) ) { return new MeSettings( wpcom ); } @@ -83,8 +83,3 @@ MeSettings.prototype.profileLinks = function() { MeSettings.prototype.password = function() { return new MeSettingsPassword( this.wpcom ); }; - -/** - * Expose `MeSettings` module - */ -module.exports = MeSettings; diff --git a/packages/wpcom.js/lib/me.settings.password.js b/packages/wpcom.js/lib/me.settings.password.js index 57d5cf8293961..fe5df3b841e58 100644 --- a/packages/wpcom.js/lib/me.settings.password.js +++ b/packages/wpcom.js/lib/me.settings.password.js @@ -1,6 +1,6 @@ const root = '/me/settings/password/'; -class MeSettingsPassword { +export default class MeSettingsPassword { /** * `MeSettingsPassword` constructor. @@ -27,8 +27,3 @@ class MeSettingsPassword { return this.wpcom.req.post( root + 'validate', query, { password: password }, fn ); } } - -/** -* Expose `MeSettingsPassword` module -*/ -module.exports = MeSettingsPassword; diff --git a/packages/wpcom.js/lib/me.settings.profile-links.js b/packages/wpcom.js/lib/me.settings.profile-links.js index 5609d22c7a051..7565ff0e8a6f1 100644 --- a/packages/wpcom.js/lib/me.settings.profile-links.js +++ b/packages/wpcom.js/lib/me.settings.profile-links.js @@ -9,7 +9,7 @@ const root = '/me/settings/profile-links'; * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function ProfileLinks( wpcom ) { +export default function ProfileLinks( wpcom ) { if ( ! ( this instanceof ProfileLinks ) ) { return new ProfileLinks( wpcom ); } @@ -106,9 +106,3 @@ ProfileLinks.prototype.del = function( slug, query, fn ) { // Create `delete` alias ProfileLinks.prototype.delete = ProfileLinks.prototype.del; - -/** - * Expose `ProfileLinks` module - */ - -module.exports = ProfileLinks; diff --git a/packages/wpcom.js/lib/me.two-step.js b/packages/wpcom.js/lib/me.two-step.js index d973f665c294b..15c0b0f342ab0 100644 --- a/packages/wpcom.js/lib/me.two-step.js +++ b/packages/wpcom.js/lib/me.two-step.js @@ -5,7 +5,7 @@ import MeTwoStepSMS from './me.two-step.sms'; const root = '/me/two-step/'; -class MeTwoStep { +export default class MeTwoStep { /** * `MeTwoStep` constructor. @@ -40,8 +40,3 @@ class MeTwoStep { return new MeTwoStepSMS( this.wpcom ); }; } - -/** -* Expose `MeTwoStep` module -*/ -module.exports = MeTwoStep; diff --git a/packages/wpcom.js/lib/me.two-step.sms.js b/packages/wpcom.js/lib/me.two-step.sms.js index be3fcef1a693f..f5a7aabc20bb5 100644 --- a/packages/wpcom.js/lib/me.two-step.sms.js +++ b/packages/wpcom.js/lib/me.two-step.sms.js @@ -1,6 +1,6 @@ const root = '/me/two-step/sms/'; -class MeTwoStepSMS { +export default class MeTwoStepSMS { /** * `MeTwoStepSMS` constructor. @@ -26,8 +26,3 @@ class MeTwoStepSMS { return this.wpcom.req.post( root + 'new', query, fn ); } } - -/** -* Expose `MeTwoStepSMS` module -*/ -module.exports = MeTwoStepSMS; diff --git a/packages/wpcom.js/lib/site.category.js b/packages/wpcom.js/lib/site.category.js index da874492639fe..9f1de6a33abd9 100644 --- a/packages/wpcom.js/lib/site.category.js +++ b/packages/wpcom.js/lib/site.category.js @@ -6,7 +6,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Category( slug, sid, wpcom ) { +export default function Category( slug, sid, wpcom ) { if ( ! sid ) { throw new Error( '`site id` is not correctly defined' ); } @@ -78,8 +78,3 @@ Category.prototype.delete = Category.prototype.del = function( query, fn ) { var path = '/sites/' + this._sid + '/categories/slug:' + this._slug + '/delete'; return this.wpcom.req.del( path, query, fn ); }; - -/** - * Expose `Category` module - */ -module.exports = Category; diff --git a/packages/wpcom.js/lib/site.comment.js b/packages/wpcom.js/lib/site.comment.js index 750e6bae7a1da..286e3a331ab93 100644 --- a/packages/wpcom.js/lib/site.comment.js +++ b/packages/wpcom.js/lib/site.comment.js @@ -12,7 +12,7 @@ var commentLike = require( './site.comment.like' ); * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Comment( cid, pid, sid, wpcom ) { +export default function Comment( cid, pid, sid, wpcom ) { if ( ! sid ) { throw new Error( '`site id` is not correctly defined' ); } @@ -152,8 +152,3 @@ Comment.prototype.likesList = function( query, fn ) { var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes'; return this.wpcom.req.get( path, query, fn ); }; - -/** - * Expose `Comment` module - */ -module.exports = Comment; diff --git a/packages/wpcom.js/lib/site.comment.like.js b/packages/wpcom.js/lib/site.comment.like.js index 3c15e57dd7f7c..2da3098f90bad 100644 --- a/packages/wpcom.js/lib/site.comment.like.js +++ b/packages/wpcom.js/lib/site.comment.like.js @@ -6,7 +6,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function CommentLike( cid, sid, wpcom ) { +export default function CommentLike( cid, sid, wpcom ) { if ( ! sid ) { throw new Error( '`site id` is not correctly defined' ); } @@ -61,8 +61,3 @@ CommentLike.prototype.delete = function( query, fn ) { var path = '/sites/' + this._sid + '/comments/' + this._cid + '/likes/mine/delete'; return this.wpcom.req.del( path, query, fn ); }; - -/** - * Expose `CommentLike` module - */ -module.exports = CommentLike; diff --git a/packages/wpcom.js/lib/site.follow.js b/packages/wpcom.js/lib/site.follow.js index 72a95b5f1628e..6e1ba2d7191a9 100644 --- a/packages/wpcom.js/lib/site.follow.js +++ b/packages/wpcom.js/lib/site.follow.js @@ -5,7 +5,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Follow( site_id, wpcom ) { +export default function Follow( site_id, wpcom ) { if ( ! site_id ) { throw new Error( '`site id` is not correctly defined' ); } @@ -57,8 +57,3 @@ Follow.prototype.del = function( query, fn ) { var path = '/sites/' + this._sid + '/follows/mine/delete'; return this.wpcom.req.del( path, query, null, fn ); }; - -/** - * Expose `Follow` module - */ -module.exports = Follow; diff --git a/packages/wpcom.js/lib/site.media.js b/packages/wpcom.js/lib/site.media.js index 56c091787117c..5661b2414ecd0 100644 --- a/packages/wpcom.js/lib/site.media.js +++ b/packages/wpcom.js/lib/site.media.js @@ -12,7 +12,7 @@ var debug = require( 'debug' )( 'wpcom:media' ); * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Media( id, sid, wpcom ) { +export default function Media( id, sid, wpcom ) { if ( ! ( this instanceof Media ) ) { return new Media( id, sid, wpcom ); } @@ -175,8 +175,3 @@ Media.prototype.delete = Media.prototype.del = function( query, fn ) { var path = '/sites/' + this._sid + '/media/' + this._id + '/delete'; return this.wpcom.req.del( path, query, fn ); }; - -/** - * Expose `Media` module - */ -module.exports = Media; diff --git a/packages/wpcom.js/lib/site.post.like.js b/packages/wpcom.js/lib/site.post.like.js index eb1fe93aec713..0c9ee9b277739 100644 --- a/packages/wpcom.js/lib/site.post.like.js +++ b/packages/wpcom.js/lib/site.post.like.js @@ -6,7 +6,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Like( pid, sid, wpcom ) { +export default function Like( pid, sid, wpcom ) { if ( ! sid ) { throw new Error( '`site id` is not correctly defined' ); } @@ -59,8 +59,3 @@ Like.prototype.delete = function( query, fn ) { var path = '/sites/' + this._sid + '/posts/' + this._pid + '/likes/mine/delete'; return this.wpcom.req.del( path, query, fn ); }; - -/** - * Expose `Like` module - */ -module.exports = Like; diff --git a/packages/wpcom.js/lib/site.post.reblog.js b/packages/wpcom.js/lib/site.post.reblog.js index 15e2f6c5cc378..835df7c2682f8 100644 --- a/packages/wpcom.js/lib/site.post.reblog.js +++ b/packages/wpcom.js/lib/site.post.reblog.js @@ -6,7 +6,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Reblog( pid, sid, wpcom ) { +export default function Reblog( pid, sid, wpcom ) { if ( ! sid ) { throw new Error( '`site id` is not correctly defined' ); } @@ -81,8 +81,3 @@ Reblog.prototype.to = function( dest, note, fn ) { return this.add( { note: note, destination_site_id: dest }, fn ); }; - -/** - * Expose `Reblog` module - */ -module.exports = Reblog; diff --git a/packages/wpcom.js/lib/site.tag.js b/packages/wpcom.js/lib/site.tag.js index dc3c6cc0b2967..e70b391056f6c 100644 --- a/packages/wpcom.js/lib/site.tag.js +++ b/packages/wpcom.js/lib/site.tag.js @@ -6,7 +6,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Tag( slug, sid, wpcom ) { +export default function Tag( slug, sid, wpcom ) { if ( ! sid ) { throw new Error( '`site id` is not correctly defined' ); } @@ -78,8 +78,3 @@ Tag.prototype.delete = Tag.prototype.del = function( query, fn ) { var path = '/sites/' + this._sid + '/tags/slug:' + this._slug + '/delete'; return this.wpcom.req.del( path, query, fn ); }; - -/** - * Expose `Tag` module - */ -module.exports = Tag; diff --git a/packages/wpcom.js/lib/site.wordads.earnings.js b/packages/wpcom.js/lib/site.wordads.earnings.js index 831f3f89d37d6..74e9b5e9d0d1b 100644 --- a/packages/wpcom.js/lib/site.wordads.earnings.js +++ b/packages/wpcom.js/lib/site.wordads.earnings.js @@ -19,7 +19,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function SiteWordAdsEarnings( sid, wpcom ) { +export default function SiteWordAdsEarnings( sid, wpcom ) { if ( ! ( this instanceof SiteWordAdsEarnings ) ) { return new SiteWordAdsEarnings( sid, wpcom ); } @@ -48,9 +48,3 @@ function SiteWordAdsEarnings( sid, wpcom ) { SiteWordAdsEarnings.prototype.get = function( query, fn ) { return this.wpcom.req.get( '/sites/' + this._sid + '/wordads/earnings', query, fn ); }; - -/** - * Expose `SiteWordAdsEarnings` module - */ - -module.exports = SiteWordAdsEarnings; diff --git a/packages/wpcom.js/lib/site.wordads.js b/packages/wpcom.js/lib/site.wordads.js index 10e55bed633c6..4617475f64f27 100644 --- a/packages/wpcom.js/lib/site.wordads.js +++ b/packages/wpcom.js/lib/site.wordads.js @@ -26,7 +26,7 @@ import SiteWordAdsTOS from './site.wordads.tos'; * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function SiteWordAds( sid, wpcom ) { +export default function SiteWordAds( sid, wpcom ) { if ( ! ( this instanceof SiteWordAds ) ) { return new SiteWordAds( sid, wpcom ); } @@ -87,8 +87,3 @@ SiteWordAds.prototype.earnings = function() { SiteWordAds.prototype.tos = function() { return new SiteWordAdsTOS( this._sid, this.wpcom ); }; - -/** - * Expose `SiteWordAds` module - */ -module.exports = SiteWordAds; diff --git a/packages/wpcom.js/lib/site.wordads.settings.js b/packages/wpcom.js/lib/site.wordads.settings.js index 628818eb55565..a56583d235060 100644 --- a/packages/wpcom.js/lib/site.wordads.settings.js +++ b/packages/wpcom.js/lib/site.wordads.settings.js @@ -19,7 +19,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function SiteWordAdsSettings( sid, wpcom ) { +export default function SiteWordAdsSettings( sid, wpcom ) { if ( ! ( this instanceof SiteWordAdsSettings ) ) { return new SiteWordAdsSettings( sid, wpcom ); } @@ -73,8 +73,3 @@ SiteWordAdsSettings.prototype.update = function( query, body, fn ) { var path = '/sites/' + this._sid + '/wordads/settings'; return this.wpcom.req.post( path, query, body, fn ); }; - -/** - * Expose `SiteWordAdsSettings` module - */ -module.exports = SiteWordAdsSettings; diff --git a/packages/wpcom.js/lib/site.wordads.tos.js b/packages/wpcom.js/lib/site.wordads.tos.js index 726144e363f19..5468e6713decb 100644 --- a/packages/wpcom.js/lib/site.wordads.tos.js +++ b/packages/wpcom.js/lib/site.wordads.tos.js @@ -18,7 +18,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function SiteWordAdsTOS( sid, wpcom ) { +export default function SiteWordAdsTOS( sid, wpcom ) { if ( ! ( this instanceof SiteWordAdsTOS ) ) { return new SiteWordAdsTOS( sid, wpcom ); } @@ -92,8 +92,3 @@ SiteWordAdsTOS.prototype.sign = function( query, fn ) { var path = '/sites/' + this._sid + '/wordads/tos'; return this.wpcom.req.post( path, query, { tos: 'signed' }, fn ); }; - -/** - * Expose `SiteWordAdsTOS` module - */ -module.exports = SiteWordAdsTOS; diff --git a/packages/wpcom.js/lib/users.js b/packages/wpcom.js/lib/users.js index 75a3bb6bd59b9..58731a1f22656 100644 --- a/packages/wpcom.js/lib/users.js +++ b/packages/wpcom.js/lib/users.js @@ -4,7 +4,7 @@ * @param {WPCOM} wpcom - wpcom instance * @return {Null} null */ -function Users( wpcom ) { +export default function Users( wpcom ) { if ( ! ( this instanceof Users ) ) { return new Users( wpcom ); } @@ -22,8 +22,3 @@ function Users( wpcom ) { Users.prototype.suggest = function( query, fn ) { return this.wpcom.req.get( '/users/suggest', query, fn ); }; - -/** - * Expose `Users` module - */ -module.exports = Users; diff --git a/packages/wpcom.js/lib/util/pinghub.js b/packages/wpcom.js/lib/util/pinghub.js index bf50a67ca0df0..3b757038ffdc1 100644 --- a/packages/wpcom.js/lib/util/pinghub.js +++ b/packages/wpcom.js/lib/util/pinghub.js @@ -13,7 +13,7 @@ var debug = require('debug')('wpcom:pinghub'); * @return {null} null * @api public */ -function Pinghub( wpcom ) { +export default function Pinghub( wpcom ) { if ( ! ( this instanceof Pinghub ) ) { return new Pinghub( wpcom ); } @@ -75,8 +75,3 @@ Pinghub.prototype.remove = function( path ) { debug("remove", path); delete this.conns[path]; }; - -/** - * Expose `Pinghub` module - */ -module.exports = Pinghub; diff --git a/packages/wpcom.js/lib/util/request.js b/packages/wpcom.js/lib/util/request.js index 8f5794ece67a5..ddf845e449729 100644 --- a/packages/wpcom.js/lib/util/request.js +++ b/packages/wpcom.js/lib/util/request.js @@ -7,7 +7,7 @@ var sendRequest = require( './send-request' ); * Expose `Request` module * @param {WPCOM} wpcom - wpcom instance */ -function Req( wpcom ) { +export default function Req( wpcom ) { this.wpcom = wpcom; } @@ -75,8 +75,3 @@ Req.prototype.del = function( params, query, fn ) { return this.post( params, query, null, fn ); }; - -/** - * Expose module - */ -module.exports = Req; diff --git a/packages/wpcom.js/lib/util/send-request.js b/packages/wpcom.js/lib/util/send-request.js index 1a599fdeba48d..f77e87606accf 100644 --- a/packages/wpcom.js/lib/util/send-request.js +++ b/packages/wpcom.js/lib/util/send-request.js @@ -14,7 +14,7 @@ var debug_res = require( 'debug' )( 'wpcom:send-request:res' ); * @param {Function} fn - callback function * @return {Function} request handler */ -module.exports = function( params, query, body, fn ) { +export default function sendRequest( params, query, body, fn ) { // `params` can be just the path ( String ) params = 'string' === typeof params ? { path: params } : params; diff --git a/packages/wpcom.js/package.json b/packages/wpcom.js/package.json index 355a9c38acb14..8675df0e44043 100644 --- a/packages/wpcom.js/package.json +++ b/packages/wpcom.js/package.json @@ -34,7 +34,7 @@ "babel-eslint": "^4.1.6", "eslint": "^1.10.1", "mocha": "^2.3.4", - "n8-make": "^1.1.0", + "n8-make": "^1.3.0", "webpack": "^1.12.1", "wpcom-oauth-cors": "^1.0.0", "wpcom-proxy-request": "^2.0.0"