Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix flowtype imports #696

Merged
merged 2 commits into from
Mar 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@
"flowtype/semi": [2, "never"],
"flowtype/space-before-generic-bracket": [2, "never"],
"flowtype/type-id-match": [2, "^([A-Z][a-z0-9]*)+$"],
"flowtype/type-import-style": [2, "declaration"]
"flowtype/type-import-style": [2, "identifier"]
}
}
8 changes: 6 additions & 2 deletions flow-typed/redux/appState.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// @flow

/* eslint-disable-next-line no-unused-vars */
import type { Saga, Channel } from 'redux-saga'
import {
// eslint-disable-next-line no-unused-vars
type Saga,
// eslint-disable-next-line no-unused-vars
type Channel,
} from 'redux-saga'

declare type AppState = {
// wallets
Expand Down
15 changes: 10 additions & 5 deletions flow-typed/types.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import type { ComponentType } from 'react'
import { type ComponentType } from 'react'

declare type Index = number

Expand All @@ -10,11 +10,16 @@ declare type BalanceString = string
declare type Address = string
declare type OwnerAddress = Address
declare type EthereumAddress = 'Ethereum'

// eslint-disable-next-line flowtype/require-compound-type-alias
declare type AssetAddress = Address | EthereumAddress

declare type AddressNames = { [Address]: ?string }

// eslint-disable-next-line flowtype/require-compound-type-alias
declare type SortDirection = 'asc' | 'desc'

// eslint-disable-next-line flowtype/require-compound-type-alias
declare type LanguageCode = 'en' | 'ko' | 'zh' | 'ja'

declare type FormFields = { [string]: ?string }
Expand Down Expand Up @@ -46,13 +51,13 @@ declare type ReactRouterState = {
+pathname: string,
+hash: string,
+key: string,
+search: string
+search: string,
},
+routes: [{
+path: string
+path: string,
}],
params: {
[string]: string
[string]: string,
},
components: [ComponentType]
components: [ComponentType],
}
10 changes: 5 additions & 5 deletions src/AppContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import { Router } from 'react-router'
import { Provider } from 'react-redux'
import { PersistGate } from 'redux-persist/integration/react'

import type { Persistor } from 'redux-persist/lib/types'
import { type Persistor } from 'redux-persist/lib/types'

import type {
Store,
Dispatch,
import {
type Store,
type Dispatch,
} from 'redux'

import type { AppAction } from 'routes'
import { type AppAction } from 'routes'

import startSessionWatcher from 'utils/browser/startSessionWatcher'
import SingularTabBlockScreen from 'components/SingularTabBlockScreen/SingularTabBlockScreen'
Expand Down
6 changes: 3 additions & 3 deletions src/components/AssetBalance/AssetBalance.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import React, { PureComponent } from 'react'

import JText from 'components/base/JText'

import type {
JTextSize,
JTextColor,
import {
type JTextSize,
type JTextColor,
} from 'components/base/JText/JText'

type Props = {|
Expand Down
4 changes: 2 additions & 2 deletions src/components/ButtonWithConfirm/ButtonWithConfirm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import {
JFlatButton,
} from 'components/base'

import type { JIconColor } from 'components/base/JIcon/JIcon'
import type { JFlatButtonColor } from 'components/base/JFlatButton/JFlatButton'
import { type JIconColor } from 'components/base/JIcon/JIcon'
import { type JFlatButtonColor } from 'components/base/JFlatButton/JFlatButton'

type Props = {|
+onClick: (SyntheticEvent<HTMLDivElement>) => void,
Expand Down
8 changes: 4 additions & 4 deletions src/components/OverlayNotification/OverlayNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import React, { PureComponent } from 'react'

import JThumbnail from 'components/base/JThumbnail'

import type {
JThumbnailColor,
JThumbnailImage,
JThumbnailDescription,
import {
type JThumbnailColor,
type JThumbnailImage,
type JThumbnailDescription,
} from 'components/base/JThumbnail/JThumbnail'

type Props = {|
Expand Down
2 changes: 1 addition & 1 deletion src/components/PasswordField/PasswordField.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import config from 'config'
import JInput from 'components/base/JInput'
import checkPasswordStrength from 'utils/encryption/checkPasswordStrength'

import type { JInputColor } from 'components/base/JInput/JInput'
import { type JInputColor } from 'components/base/JInput/JInput'

import Indicator from './Indicator'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
JText,
} from 'components/base'

import type { JIconColor } from 'components/base/JIcon/JIcon'
import { type JIconColor } from 'components/base/JIcon/JIcon'

export type Props = {|
+title: string,
Expand Down
6 changes: 3 additions & 3 deletions src/components/SettingsGrid/SettingsGridCard/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow

import SettingsGridCard from './SettingsGridCard'

import type { Props } from './SettingsGridCard'
import SettingsGridCard, {
type Props,
} from './SettingsGridCard'

export type SettingsGridCardProps = Props

Expand Down
6 changes: 3 additions & 3 deletions src/components/base/JFlatButton/JFlatButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import {
JLoader,
} from 'components/base'

import type {
JIconSize,
JIconColor,
import {
type JIconSize,
type JIconColor,
} from 'components/base/JIcon/JIcon'

export type JFlatButtonColor = 'blue' | 'gray' | 'sky' | 'white'
Expand Down
8 changes: 3 additions & 5 deletions src/components/base/JInput/JInputField.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

import React from 'react'

import JInput from './JInput'

import type {
JInputType,
JInputColor,
import JInput, {
type JInputType,
type JInputColor,
} from './JInput'

type InputValidateType = 'touched' | 'visited'
Expand Down
10 changes: 5 additions & 5 deletions src/components/base/JRaisedButton/JRaisedButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import {
JLoader,
} from 'components/base'

import type { JTextColor } from 'components/base/JText/JText'
import type { JLoaderColor } from 'components/base/JLoader/JLoader'
import { type JTextColor } from 'components/base/JText/JText'
import { type JLoaderColor } from 'components/base/JLoader/JLoader'

import type {
JIconSize,
JIconColor,
import {
type JIconSize,
type JIconColor,
} from 'components/base/JIcon/JIcon'

type JRaisedButtonColor = 'blue' | 'white'
Expand Down
5 changes: 3 additions & 2 deletions src/routes/Settings/SettingsIndexView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import { Scrollbars } from 'react-custom-scrollbars'
import SettingsGrid from 'components/SettingsGrid'
import escapeRegExp from 'utils/regexp/escapeRegExp'
import formatCurrency from 'utils/formatters/formatCurrency'
import SettingsGridCard from 'components/SettingsGrid/SettingsGridCard'

import {
JText,
JSearch,
} from 'components/base'

import type { SettingsGridCardProps } from 'components/SettingsGrid/SettingsGridCard'
import SettingsGridCard, {
type SettingsGridCardProps,
} from 'components/SettingsGrid/SettingsGridCard'

type Props = {|
...SettingsState,
Expand Down
6 changes: 3 additions & 3 deletions src/routes/Settings/routes/Currency/CurrencyContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { setFiatCurrency } from 'store/modules/settings'

import CurrencyView from './CurrencyView'

import type {
CurrencyFormFieldErrors,
CurrencyFormFieldValues,
import {
type CurrencyFormFieldErrors,
type CurrencyFormFieldValues,
} from './types'

const validate = ({ fiatCurrency }: CurrencyFormFieldValues): CurrencyFormFieldErrors => {
Expand Down
6 changes: 3 additions & 3 deletions src/routes/Settings/routes/Currency/CurrencyView.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { CurrencyPickerField } from './components/CurrencyPickerField'

import './currencyView.scss'

import type {
CurrencyFormFieldValues,
CurrencyFormFieldErrors,
import {
type CurrencyFormFieldValues,
type CurrencyFormFieldErrors,
} from './types'

type Props = {|
Expand Down
6 changes: 3 additions & 3 deletions src/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
reactRouterOnEnterPageView,
} from 'utils/analytics'

import type { CoreAction } from 'store/modules/core'
import type { NotFoundAction } from 'store/modules/notFound'
import type { DigitalAssetsModuleAction } from 'store/modules/digitalAssets'
import { type CoreAction } from 'store/modules/core'
import { type NotFoundAction } from 'store/modules/notFound'
import { type DigitalAssetsModuleAction } from 'store/modules/digitalAssets'

import Wallets from './Wallets'
import Settings from './Settings'
Expand Down
6 changes: 3 additions & 3 deletions src/store/modules/digitalAssets.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow

import type { DigitalAssetsGridAction } from 'store/modules/digitalAssetsGrid'
import type { AddAssetAction } from 'store/modules/addAsset'
import type { EditAssetAction } from 'store/modules/editAsset'
import { type DigitalAssetsGridAction } from 'store/modules/digitalAssetsGrid'
import { type AddAssetAction } from 'store/modules/addAsset'
import { type EditAssetAction } from 'store/modules/editAsset'

export const INIT = '@@digitalAssets/INIT'

Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import type { CoreAction as Action } from './core'
import { type CoreAction as Action } from './core'

export type CoreAction = Action

Expand Down
2 changes: 1 addition & 1 deletion src/store/modules/settings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow

import type { CurrencyFormFieldValues } from 'routes/Settings/routes/Currency/types'
import { type CurrencyFormFieldValues } from 'routes/Settings/routes/Currency/types'

export const CHANGE_PAYMENT_PASSWORD = '@@settings/CHANGE_PAYMENT_PASSWORD'
export const VALIDATION_PASSWORD_FORM = '@@settings/VALIDATION_PASSWORD_FORM'
Expand Down
6 changes: 3 additions & 3 deletions src/store/modules/walletsCreate.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow

import type {
WalletsCreateRequestPayload,
WalletsSetWalletsActionPayload,
import {
type WalletsCreateRequestPayload,
type WalletsSetWalletsActionPayload,
} from 'store/modules/wallets'

export const OPEN_VIEW = '@@walletsCreate/OPEN_VIEW'
Expand Down
6 changes: 3 additions & 3 deletions src/store/modules/walletsImport.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @flow

import type {
WalletsImportRequestPayload,
WalletsSetWalletsActionPayload,
import {
type WalletsImportRequestPayload,
type WalletsSetWalletsActionPayload,
} from 'store/modules/wallets'

export const OPEN_VIEW = '@@walletsImport/OPEN_VIEW'
Expand Down
6 changes: 3 additions & 3 deletions src/store/persistReducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import storage from 'localforage'
import { persistReducer } from 'redux-persist'

import type { Reducer } from 'redux'
import type { AppAction } from 'routes'
import type { PersistConfig } from 'redux-persist/lib/types.js.flow'
import { type Reducer } from 'redux'
import { type AppAction } from 'routes'
import { type PersistConfig } from 'redux-persist/lib/types.js.flow'

type PersistableReducerName =
'blocks' |
Expand Down
10 changes: 6 additions & 4 deletions src/store/reducers.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// @flow

import { combineReducers } from 'redux'
import { routerReducer as router } from 'react-router-redux'
import {
combineReducers,
type Reducer,
} from 'redux'

import type { Reducer } from 'redux'
import { routerReducer as router } from 'react-router-redux'

import blocks from 'store/modules/blocks'
import ticker from 'store/modules/ticker'
Expand Down Expand Up @@ -31,7 +33,7 @@ import walletsBackup from 'store/modules/walletsBackup'
import walletsAddresses from 'store/modules/walletsAddresses'
import walletsRenameAddress from 'store/modules/walletsRenameAddress'

import type { AppAction } from 'routes'
import { type AppAction } from 'routes'

import persistReducers from './persistReducers'

Expand Down
8 changes: 5 additions & 3 deletions src/store/sagas/balances.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

import { isEmpty } from 'lodash-es'

import { delay } from 'redux-saga'
import {
delay,
type Task,
} from 'redux-saga'

import { t } from 'ttag'

import {
Expand All @@ -16,8 +20,6 @@ import {
takeEvery,
} from 'redux-saga/effects'

import type { Task } from 'redux-saga'

import config from 'config'
import web3 from 'services/web3'
import getDigitalAssetByAddress from 'utils/digitalAssets/getDigitalAssetByAddress'
Expand Down
3 changes: 1 addition & 2 deletions src/store/sagas/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
delay,
channel,
buffers,
type Task,
} from 'redux-saga'

import {
Expand All @@ -20,8 +21,6 @@ import {
takeEvery,
} from 'redux-saga/effects'

import type { Task } from 'redux-saga'

import config from 'config'
import web3 from 'services/web3'
import { selectActiveWalletAddress } from 'store/selectors/wallets'
Expand Down
Loading