From d63e15118f005e2a3bc6124e5b24ce35514dee33 Mon Sep 17 00:00:00 2001 From: Denis Davidyuk Date: Wed, 28 Apr 2021 23:17:58 +0300 Subject: [PATCH] fix: import/no-named-as-default linter error when consumer project uses Airbnb linter --- .../aepp-wallet-communication/connection/browser-runtime.js | 5 +---- .../connection/browser-window-message.js | 4 +--- src/utils/aepp-wallet-communication/connection/index.js | 4 +--- .../aepp-wallet-communication/content-script-bridge.js | 6 ++---- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/src/utils/aepp-wallet-communication/connection/browser-runtime.js b/src/utils/aepp-wallet-communication/connection/browser-runtime.js index f4191d3ab9..4a5900d9ee 100644 --- a/src/utils/aepp-wallet-communication/connection/browser-runtime.js +++ b/src/utils/aepp-wallet-communication/connection/browser-runtime.js @@ -102,8 +102,7 @@ function isConnected () { * @param {Boolean} [params.debug=false] - Debug flag * @return {Object} */ - -export const BrowserRuntimeConnection = stampit({ +export default stampit({ init ({ connectionInfo = {}, port, debug = false }) { if (!getBrowserAPI().runtime) throw new Error('Runtime is not accessible in your environment') this.debug = debug @@ -112,5 +111,3 @@ export const BrowserRuntimeConnection = stampit({ }, methods: { connect, sendMessage, disconnect, isConnected } }, WalletConnection) - -export default BrowserRuntimeConnection diff --git a/src/utils/aepp-wallet-communication/connection/browser-window-message.js b/src/utils/aepp-wallet-communication/connection/browser-window-message.js index 8d7ec8cd02..7268459541 100644 --- a/src/utils/aepp-wallet-communication/connection/browser-window-message.js +++ b/src/utils/aepp-wallet-communication/connection/browser-window-message.js @@ -121,7 +121,7 @@ const getTarget = () => { * @param {Boolean} [params.debug=false] - Debug flag * @return {Object} */ -export const BrowserWindowMessageConnection = stampit({ +export default stampit({ init ({ connectionInfo = {}, target = getTarget(), self = window, origin, sendDirection, receiveDirection = MESSAGE_DIRECTION.to_aepp, debug = false, forceOrigin = false } = {}) { if (sendDirection && !Object.keys(MESSAGE_DIRECTION).includes(sendDirection)) throw new Error(`sendDirection must be one of [${Object.keys(MESSAGE_DIRECTION)}]`) if (!Object.keys(MESSAGE_DIRECTION).includes(receiveDirection)) throw new Error(`receiveDirection must be one of [${Object.keys(MESSAGE_DIRECTION)}]`) @@ -141,5 +141,3 @@ export const BrowserWindowMessageConnection = stampit({ }, methods: { connect, sendMessage, disconnect, isConnected } }, WalletConnection) - -export default BrowserWindowMessageConnection diff --git a/src/utils/aepp-wallet-communication/connection/index.js b/src/utils/aepp-wallet-communication/connection/index.js index 4969db1f05..ce55d9558f 100644 --- a/src/utils/aepp-wallet-communication/connection/index.js +++ b/src/utils/aepp-wallet-communication/connection/index.js @@ -36,7 +36,7 @@ import { required } from '@stamp/required' * @param {Object} [options={}] - Initializer object * @return {Object} WalletConnection instance */ -export const WalletConnection = required({ +export default required({ methods: { connect: required, disconnect: required, @@ -82,5 +82,3 @@ export const WalletConnection = required({ * @rtype () => Boolean * @return {Boolean} Is connected */ - -export default WalletConnection diff --git a/src/utils/aepp-wallet-communication/content-script-bridge.js b/src/utils/aepp-wallet-communication/content-script-bridge.js index 0e61ab537d..0b62c7c5f7 100644 --- a/src/utils/aepp-wallet-communication/content-script-bridge.js +++ b/src/utils/aepp-wallet-communication/content-script-bridge.js @@ -64,9 +64,9 @@ function stop () { * @param {Object} params - Initializer object * @param {Object} params.pageConnection - Page connection object(@link module:@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-window-message) * @param {Object} params.extConnection - Extension connection object(module: @aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime) - * @return {ContentScriptBridge} + * @return {Object} */ -export const ContentScriptBridge = stampit({ +export default stampit({ init ({ pageConnection, extConnection, allowCrossOrigin = false }) { if (!window) throw new Error('Window object not found, you can run bridge only in browser') if (!pageConnection) throw new Error('pageConnection required') @@ -77,5 +77,3 @@ export const ContentScriptBridge = stampit({ }, methods: { run, stop } }) - -export default ContentScriptBridge