Skip to content

Commit

Permalink
Merge pull request #1523 from lzhuor/fix/eslint_prettier_conflicts_on…
Browse files Browse the repository at this point in the history
…_genrator

Fix/eslint standarjs conflicts on generator functions
  • Loading branch information
schnogz committed Mar 12, 2019
2 parents cd6052a + 643b345 commit 47eeafa
Show file tree
Hide file tree
Showing 177 changed files with 766 additions and 760 deletions.
18 changes: 12 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,25 @@
"globals": {
"APP_VERSION": true
},
"settings": {
"react": {
"version": "latest"
}
},
"rules": {
"camelcase": 0,
"new-cap": 0,
"no-case-declarations": 0,
"no-console": 2,
"no-underscore-dangle": 0,
"no-alert": 2,
"require-yield": 2,
"generator-star-spacing": ["error", {"before": true, "after": true}],
"jest/no-disabled-tests": 1,
"jest/no-focused-tests": 2,
"jest/no-identical-title": 2,
"jest/prefer-to-have-length": 0,
"jest/valid-expect": 2,
"jsx-quotes": [2, "prefer-single"],
"new-cap": 0,
"no-alert": 2,
"no-case-declarations": 0,
"no-console": 2,
"no-underscore-dangle": 0,
"react/display-name": 0,
"react/forbid-prop-types": 0,
"react/jsx-boolean-value": 0,
Expand Down Expand Up @@ -60,6 +65,7 @@
"react/react-in-jsx-scope": 2,
"react/self-closing-comp": 2,
"react/sort-comp": 2,
"require-yield": 2,
"space-before-function-paren": 2,
"strict": 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ import { takeEvery } from 'redux-saga/effects'
import * as actionTypes from '../actionTypes'
import * as sagas from './sagas'

export default function* alertsSaga () {
export default function * alertsSaga () {
yield takeEvery(actionTypes.alerts.ALERTS_SHOW, sagas.handleTimer)
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as actions from './actions.js'

const DISMISS_AFTER = 7000

export const handleTimer = function*(action) {
export const handleTimer = function * (action) {
const { id, persist } = action.payload
if (persist) return
yield call(delay, DISMISS_AFTER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ api }) => {
const analyticsSagas = sagas({ api })

return function* analyticsSaga () {
return function * analyticsSaga () {
yield takeLatest(AT.LOG_EVENT, analyticsSagas.logEvent)
yield takeLatest(AT.LOG_PAGE_VIEW, analyticsSagas.logPageView)
yield takeLatest(AT.LOG_GOAL, analyticsSagas.logGoal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { CUSTOM_DIMENSIONS } from './model'

export const logLocation = 'analytics/sagas'
export default ({ api }) => {
const postMessage = function*(message) {
const postMessage = function * (message) {
try {
const frame = document.getElementById('matomo-iframe')
if (frame) {
Expand All @@ -29,7 +29,7 @@ export default ({ api }) => {
}
}

const generateUniqueUserID = function*() {
const generateUniqueUserID = function * () {
const defaultHDWallet = yield select(
selectors.core.wallet.getDefaultHDWallet
)
Expand All @@ -42,7 +42,7 @@ export default ({ api }) => {
return masterHDNode.deriveHardened(purpose).getAddress()
}

const initUserSession = function*() {
const initUserSession = function * () {
try {
const guid = yield call(generateUniqueUserID)
const isCryptoDisplayed = yield select(
Expand All @@ -62,7 +62,7 @@ export default ({ api }) => {
}
}

const logEvent = function*(action) {
const logEvent = function * (action) {
try {
const { event } = action.payload
yield call(postMessage, {
Expand All @@ -74,7 +74,7 @@ export default ({ api }) => {
}
}

const logPageView = function*(action) {
const logPageView = function * (action) {
try {
const { route } = action.payload
const isAuthenticated = yield select(selectors.auth.isAuthenticated)
Expand All @@ -90,7 +90,7 @@ export default ({ api }) => {
}
}

const logGoal = function*() {
const logGoal = function * () {
try {
// TODO
yield
Expand All @@ -99,7 +99,7 @@ export default ({ api }) => {
}
}

const startSession = function*(action) {
const startSession = function * (action) {
try {
const { guid } = action.payload
yield call(postMessage, {
Expand All @@ -116,7 +116,7 @@ export default ({ api }) => {
}
}

const stopSession = function*() {
const stopSession = function * () {
try {
yield call(postMessage, { method: 'resetUserId', messageData: [] })
} catch (e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default ({ api, coreSagas }) => {
const authSagas = sagas({ api, coreSagas })

return function* authSaga () {
return function * authSaga () {
yield takeLatest(AT.DEAUTHORIZE_BROWSER, authSagas.deauthorizeBrowser)
yield takeLatest(AT.LOGIN, authSagas.login)
yield takeLatest(AT.LOGOUT, authSagas.logout)
Expand Down
42 changes: 21 additions & 21 deletions packages/blockchain-wallet-v4-frontend/src/data/auth/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const wrongCaptcha2faErrorMessage = 'Error: Captcha Code Incorrect'
export const wrongAuthCodeErrorMessage = 'Authentication code is incorrect'

export default ({ api, coreSagas }) => {
const upgradeWallet = function*() {
const upgradeWallet = function * () {
try {
let password = yield call(promptForSecondPassword)
yield coreSagas.wallet.upgradeToHd({ password })
Expand All @@ -40,11 +40,11 @@ export default ({ api, coreSagas }) => {
yield put(actions.alerts.displayError(C.WALLET_UPGRADE_ERROR))
}
}
const upgradeWalletSaga = function*() {
const upgradeWalletSaga = function * () {
yield put(actions.modals.showModal('UpgradeWallet'))
yield take(actionTypes.core.walletSync.SYNC_SUCCESS)
}
const upgradeAddressLabelsSaga = function*() {
const upgradeAddressLabelsSaga = function * () {
const addressLabelSize = yield call(coreSagas.kvStore.btc.fetchMetadataBtc)
if (addressLabelSize > 100) {
yield put(
Expand All @@ -60,7 +60,7 @@ export default ({ api, coreSagas }) => {
yield put(actions.modals.closeModal())
}
}
const transferEthSaga = function*() {
const transferEthSaga = function * () {
const legacyAccountR = yield select(
selectors.core.kvStore.ethereum.getLegacyAccount
)
Expand All @@ -76,7 +76,7 @@ export default ({ api, coreSagas }) => {
}
}

const saveGoals = function*(firstLogin) {
const saveGoals = function * (firstLogin) {
yield put(actions.goals.saveGoal('welcome', { firstLogin }))
yield put(actions.goals.saveGoal('airdropReminder'))
// yield put(actions.goals.saveGoal('coinifyUpgrade'))
Expand All @@ -88,7 +88,7 @@ export default ({ api, coreSagas }) => {
yield put(actions.goals.saveGoal('bsv'))
}

const authNabu = function*() {
const authNabu = function * () {
yield put(actions.components.identityVerification.fetchSupportedCountries())
yield take([
actionTypes.components.identityVerification
Expand All @@ -101,7 +101,7 @@ export default ({ api, coreSagas }) => {
)).getOrElse(false)
if (userFlowSupported) yield put(actions.modules.profile.signIn())
}
const loginRoutineSaga = function*(mobileLogin, firstLogin) {
const loginRoutineSaga = function * (mobileLogin, firstLogin) {
try {
// If needed, the user should upgrade its wallet before being able to open the wallet
const isHdWallet = yield select(selectors.core.wallet.isHdWallet)
Expand Down Expand Up @@ -159,7 +159,7 @@ export default ({ api, coreSagas }) => {
yield put(actions.alerts.displayError(C.WALLET_LOADING_ERROR))
}
}
const checkAndHandleVulnerableAddress = function*(data) {
const checkAndHandleVulnerableAddress = function * (data) {
const err = prop('error', data)
const vulnerableAddress = checkForVulnerableAddressError(err)
if (vulnerableAddress) {
Expand All @@ -177,7 +177,7 @@ export default ({ api, coreSagas }) => {
)
}
}
const checkDataErrors = function*() {
const checkDataErrors = function * () {
const btcDataR = yield select(selectors.core.data.bitcoin.getInfo)

if (Remote.Loading.is(btcDataR)) {
Expand All @@ -191,7 +191,7 @@ export default ({ api, coreSagas }) => {
yield call(checkAndHandleVulnerableAddress, btcDataR)
}
}
const pollingSession = function*(session, n = 50) {
const pollingSession = function * (session, n = 50) {
if (n === 0) {
return false
}
Expand All @@ -206,7 +206,7 @@ export default ({ api, coreSagas }) => {
}
return yield call(pollingSession, session, n - 1)
}
const login = function*(action) {
const login = function * (action) {
let { guid, sharedKey, password, code, mobileLogin } = action.payload
let session = yield select(selectors.session.getSession, guid)
try {
Expand Down Expand Up @@ -301,7 +301,7 @@ export default ({ api, coreSagas }) => {
}
}
}
const mobileLogin = function*(action) {
const mobileLogin = function * (action) {
try {
const { guid, sharedKey, password } = yield call(
coreSagas.settings.decodePairingCode,
Expand All @@ -326,7 +326,7 @@ export default ({ api, coreSagas }) => {
}
}
}
const register = function*(action) {
const register = function * (action) {
try {
yield put(actions.auth.registerLoading())
yield put(actions.alerts.displayInfo(C.CREATE_WALLET_INFO))
Expand All @@ -340,7 +340,7 @@ export default ({ api, coreSagas }) => {
yield put(actions.alerts.displayError(C.REGISTER_ERROR))
}
}
const restore = function*(action) {
const restore = function * (action) {
try {
yield put(actions.auth.restoreLoading())
yield put(actions.alerts.displayInfo(C.RESTORE_WALLET_INFO))
Expand All @@ -354,7 +354,7 @@ export default ({ api, coreSagas }) => {
yield put(actions.alerts.displayError(C.RESTORE_ERROR))
}
}
const remindGuid = function*(action) {
const remindGuid = function * (action) {
try {
yield put(actions.auth.remindGuidLoading())
yield call(coreSagas.wallet.remindWalletGuidSaga, action.payload)
Expand All @@ -371,7 +371,7 @@ export default ({ api, coreSagas }) => {
}
}
}
const reset2fa = function*(action) {
const reset2fa = function * (action) {
try {
yield put(actions.auth.reset2faLoading())
const response = yield call(
Expand Down Expand Up @@ -420,7 +420,7 @@ export default ({ api, coreSagas }) => {
window.addEventListener('wallet.core.logout', resolve)
})
}
const resendSmsLoginCode = function*(action) {
const resendSmsLoginCode = function * (action) {
try {
const { guid } = action.payload
const sessionToken = yield select(selectors.session.getSession, guid)
Expand All @@ -443,10 +443,10 @@ export default ({ api, coreSagas }) => {
yield put(actions.alerts.displayError(C.SMS_RESEND_ERROR))
}
}
const logoutRoutine = function*() {
const logoutRoutine = function * () {
yield call(logout)
}
const logout = function*() {
const logout = function * () {
const isEmailVerified = yield select(
selectors.core.settings.getEmailVerified
)
Expand All @@ -467,7 +467,7 @@ export default ({ api, coreSagas }) => {
: yield logoutClearReduxStore()
yield put(actions.analytics.stopSession())
}
const deauthorizeBrowser = function*() {
const deauthorizeBrowser = function * () {
try {
const guid = yield select(selectors.core.wallet.getGuid)
const sessionToken = yield select(selectors.session.getSession, guid)
Expand All @@ -482,7 +482,7 @@ export default ({ api, coreSagas }) => {
yield logoutClearReduxStore()
}
}
const logoutClearReduxStore = function*() {
const logoutClearReduxStore = function * () {
// router will fallback to /login route
yield window.history.pushState('', '', '#')
yield window.location.reload(true)
Expand Down
12 changes: 6 additions & 6 deletions packages/blockchain-wallet-v4-frontend/src/data/balance/sagas.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const logLocation = 'balances'

export const balancePath = ['payload', 'info', 'final_balance']

export const getEthBalance = function*() {
export const getEthBalance = function * () {
try {
const ethBalanceR = yield select(selectors.core.data.ethereum.getBalance)
if (!Remote.Success.is(ethBalanceR)) {
Expand All @@ -24,7 +24,7 @@ export const getEthBalance = function*() {
}
}

export const getBtcBalance = function*() {
export const getBtcBalance = function * () {
try {
const btcBalanceR = yield select(selectors.core.data.bitcoin.getBalance)
if (!Remote.Success.is(btcBalanceR)) {
Expand All @@ -40,7 +40,7 @@ export const getBtcBalance = function*() {
}
}

export const getBchBalance = function*() {
export const getBchBalance = function * () {
try {
const bchBalanceR = yield select(selectors.core.data.bch.getBalance)
if (!Remote.Success.is(bchBalanceR)) {
Expand All @@ -56,7 +56,7 @@ export const getBchBalance = function*() {
}
}

export const getBsvBalance = function*() {
export const getBsvBalance = function * () {
try {
const bsvBalanceR = yield select(selectors.core.data.bsv.getBalance)
if (!Remote.Success.is(bsvBalanceR)) {
Expand All @@ -72,7 +72,7 @@ export const getBsvBalance = function*() {
}
}

export const getXlmBalance = function*() {
export const getXlmBalance = function * () {
try {
const xlmBalanceR = yield select(selectors.core.data.xlm.getTotalBalance)
if (!Remote.Success.is(xlmBalanceR)) {
Expand All @@ -84,7 +84,7 @@ export const getXlmBalance = function*() {
yield put(actions.logs.logErrorMessage(logLocation, 'getXlmBalance', e))
}
}
export const getAllBalances = function*() {
export const getAllBalances = function * () {
const ethT = yield fork(getEthBalance)
const btcT = yield fork(getBtcBalance)
const bchT = yield fork(getBchBalance)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import sagas from './sagas'
export default () => {
const activityListSagas = sagas()

return function* activityListSaga () {
return function * activityListSaga () {
yield takeEvery(AT.ACTIVITY_LIST_INITIALIZED, activityListSagas.initialized)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Remote } from 'blockchain-wallet-v4/src'
import { actions, selectors } from 'data'

export default () => {
const initialized = function*() {
const initialized = function * () {
try {
const logsR = yield select(selectors.core.data.misc.getLogs)
const btcTransactions = yield select(
Expand Down

0 comments on commit 47eeafa

Please sign in to comment.