Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into skip-data-and-type
Browse files Browse the repository at this point in the history
  • Loading branch information
classicalliu committed Sep 3, 2019
2 parents e334085 + baf5ded commit 4b765b8
Show file tree
Hide file tree
Showing 17 changed files with 1,584 additions and 710 deletions.
3 changes: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ module.exports = {
"no-console": [2, {
"allow": ["warn", "error", "info"]
}],
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }]
"lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
"max-classes-per-file": [0]
},
"globals": {
"BigInt": "readonly"
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@
},
"devDependencies": {
"@types/jest": "24.0.13",
"@typescript-eslint/eslint-plugin": "2.0.0",
"@typescript-eslint/parser": "2.0.0",
"@typescript-eslint/eslint-plugin": "2.1.0",
"@typescript-eslint/parser": "2.1.0",
"concurrently": "4.1.1",
"cross-env": "5.2.0",
"eslint": "5.16.0",
"eslint-config-airbnb": "17.1.0",
"eslint-config-prettier": "4.3.0",
"eslint-plugin-import": "2.17.3",
"eslint-plugin-jsx-a11y": "6.2.1",
"eslint": "6.3.0",
"eslint-config-airbnb": "18.0.1",
"eslint-config-prettier": "6.1.0",
"eslint-plugin-import": "2.18.2",
"eslint-plugin-jsx-a11y": "6.2.3",
"eslint-plugin-prettier": "3.1.0",
"eslint-plugin-react": "7.13.0",
"eslint-plugin-react": "7.14.3",
"husky": "3.0.1",
"lerna": "3.16.2",
"ncp": "2.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ module.exports = {
"react/jsx-filename-extension": [1, {
"extensions": [".ts", ".tsx"]
}],
"react/jsx-props-no-spreading": [0]
}
}
2 changes: 1 addition & 1 deletion packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"react-dom": "16.8.6",
"react-i18next": "10.11.0",
"react-router-dom": "5.0.0",
"react-scripts": "3.0.1",
"react-scripts": "3.1.1",
"styled-components": "5.0.0-beta.0"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/components/ErrorBoundary/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const handleError = (error: Error) => {
}

class ErrorBoundary extends Component<{ children: React.ReactChild }, { hasError: boolean }> {
/* eslint-disable react/state-in-constructor */
state = {
hasError: false,
}
Expand Down
2 changes: 2 additions & 0 deletions packages/neuron-ui/src/services/remote/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ export * from './wallets'
export * from './networks'
export * from './transactions'

/* eslint-disable no-alert */

export const getLocale = () => {
if (!window.remote) {
console.warn('remote is not supported')
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/utils/formatters.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-redeclare */
/* global BigInt */

import { CapacityUnit } from './const'
Expand Down
1 change: 1 addition & 0 deletions packages/neuron-ui/src/utils/validators.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { MAX_NETWORK_NAME_LENGTH } from 'utils/const'
/* eslint-disable no-redeclare */
/* global BigInt */
import { ckbCore } from 'services/chain'
import { MIN_PASSWORD_LENGTH, MAX_PASSWORD_LENGTH, MIN_AMOUNT, MAX_DECIMAL_DIGITS, ErrorCode } from './const'
Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-wallet/src/controllers/networks/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import NetworksService, { NetworkType, NetworkID, Network } from 'services/networks'
import { NetworkType, NetworkID, Network } from 'types/network'
import NetworksService from 'services/networks'
import { CatchControllerError, Controller as ControllerDecorator } from 'decorators'
import { Channel, ResponseCode } from 'utils/const'
import { IsRequired, InvalidName, NetworkNotFound, CurrentNetworkNotSet } from 'exceptions'
Expand Down
2 changes: 2 additions & 0 deletions packages/neuron-wallet/src/decorators/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ResponseCode } from 'utils/const'
import logger from 'utils/logger'

export const CatchControllerError = (_target: any, _name: string, descriptor: PropertyDescriptor) => {
const originalMethod = descriptor.value
Expand All @@ -8,6 +9,7 @@ export const CatchControllerError = (_target: any, _name: string, descriptor: Pr
try {
return await originalMethod(...args)
} catch (err) {
logger.error(`CatchControllerError:`, err)
return {
status: ResponseCode.Fail,
message: typeof err.message === 'string' ? { content: err.message } : err.message,
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-wallet/src/env.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as path from 'path'
import app from 'app'
import { NetworkWithID } from 'services/networks'
import { NetworkWithID } from 'types/network'

const { NODE_ENV } = process.env

Expand Down
21 changes: 1 addition & 20 deletions packages/neuron-wallet/src/services/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,26 +8,7 @@ import env from 'env'
import { Validate, Required } from 'decorators'
import { UsedName, NetworkNotFound, InvalidFormat } from 'exceptions'
import { NetworkListSubject, CurrentNetworkIDSubject } from 'models/subjects/networks'

export type NetworkID = string
export type NetworkName = string
export type NetworkRemote = string
export enum NetworksKey {
List = 'list',
Current = 'current',
}
export enum NetworkType {
Default,
Normal,
}
export interface Network {
name: NetworkName
remote: NetworkRemote
type: NetworkType
}
export interface NetworkWithID extends Network {
id: NetworkID
}
import { NetworkID, NetworkName, NetworkRemote, NetworksKey, NetworkType, Network, NetworkWithID } from 'types/network'

export const networkSwitchSubject = new BehaviorSubject<undefined | NetworkWithID>(undefined)

Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-wallet/src/startup/sync-block-task/create.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { BrowserWindow } from 'electron'
import { ReplaySubject } from 'rxjs'
import path from 'path'
import { networkSwitchSubject, NetworkWithID } from 'services/networks'
import { networkSwitchSubject } from 'services/networks'
import { NetworkWithID } from 'types/network'
import env from 'env'
import AddressService from 'services/addresses'
import genesisBlockHash from './genesis'
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-wallet/src/startup/sync-block-task/task.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { remote } from 'electron'
import { initConnection as initAddressConnection } from 'database/address/ormconfig'
import AddressesUsedSubject from 'models/subjects/addresses-used-subject'
import { NetworkWithID } from 'services/networks'
import { NetworkWithID } from 'types/network'
import { register as registerTxStatusListener } from 'listeners/tx-status'
import { register as registerAddressListener } from 'listeners/address'
import IndexerRPC from 'services/indexer/indexer-rpc'
Expand Down
19 changes: 19 additions & 0 deletions packages/neuron-wallet/src/types/network.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export type NetworkID = string
export type NetworkName = string
export type NetworkRemote = string
export enum NetworksKey {
List = 'list',
Current = 'current',
}
export enum NetworkType {
Default,
Normal,
}
export interface Network {
name: NetworkName
remote: NetworkRemote
type: NetworkType
}
export interface NetworkWithID extends Network {
id: NetworkID
}
3 changes: 2 additions & 1 deletion packages/neuron-wallet/tests/services/networks.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import NetworksService, { NetworkWithID } from '../../src/services/networks'
import NetworksService from '../../src/services/networks'
import { NetworkWithID } from '../../src/types/network'
import env from '../../src/env'
import i18n from '../../src/utils/i18n'

Expand Down
Loading

0 comments on commit 4b765b8

Please sign in to comment.