mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-23 00:08:37 +00:00
Add "No Unused Params and Locals" Linting Rule (#297)
Add "No Unused Params and Locals" Linting Rule
This commit is contained in:
parent
804f986cb5
commit
b94bede473
@ -1,5 +1,3 @@
|
|||||||
import * as constants from './constants';
|
|
||||||
|
|
||||||
/*** Resolve ENS name ***/
|
/*** Resolve ENS name ***/
|
||||||
export interface ResolveEnsNameAction {
|
export interface ResolveEnsNameAction {
|
||||||
type: 'ENS_RESOLVE';
|
type: 'ENS_RESOLVE';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import * as interfaces from './actionTypes';
|
import * as interfaces from './actionTypes';
|
||||||
import { TypeKeys } from './constants';
|
import { TypeKeys } from './constants';
|
||||||
import { fetchRates, CCResponse } from './actionPayloads';
|
import { fetchRates } from './actionPayloads';
|
||||||
|
|
||||||
export type TFetchCCRates = typeof fetchCCRates;
|
export type TFetchCCRates = typeof fetchCCRates;
|
||||||
export function fetchCCRates(): interfaces.FetchCCRates {
|
export function fetchCCRates(): interfaces.FetchCCRates {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import logo from 'assets/images/logo-myetherwallet.svg';
|
import logo from 'assets/images/logo-myetherwallet.svg';
|
||||||
import { bityReferralURL, donationAddressMap } from 'config/data';
|
import { bityReferralURL, donationAddressMap } from 'config/data';
|
||||||
import React, { Component } from 'react';
|
import React from 'react';
|
||||||
import translate from 'translations';
|
import translate from 'translations';
|
||||||
import './index.scss';
|
import './index.scss';
|
||||||
import PreFooter from './PreFooter';
|
import PreFooter from './PreFooter';
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import NavigationLink from './NavigationLink';
|
import NavigationLink from './NavigationLink';
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import {
|
|||||||
SetDesiredTokenAction
|
SetDesiredTokenAction
|
||||||
} from 'actions/deterministicWallets';
|
} from 'actions/deterministicWallets';
|
||||||
import Modal, { IButton } from 'components/ui/Modal';
|
import Modal, { IButton } from 'components/ui/Modal';
|
||||||
import { NetworkConfig, Token } from 'config/data';
|
import { NetworkConfig } from 'config/data';
|
||||||
import { isValidPath } from 'libs/validators';
|
import { isValidPath } from 'libs/validators';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
@ -123,20 +123,21 @@ class DeterministicWalletsModal extends React.Component<Props, State> {
|
|||||||
onChange={this.handleChangePath}
|
onChange={this.handleChangePath}
|
||||||
value={isCustomPath ? 'custom' : dPath}
|
value={isCustomPath ? 'custom' : dPath}
|
||||||
>
|
>
|
||||||
{dPaths.map(dp =>
|
{dPaths.map(dp => (
|
||||||
<option key={dp.value} value={dp.value}>
|
<option key={dp.value} value={dp.value}>
|
||||||
{dp.label}
|
{dp.label}
|
||||||
</option>
|
</option>
|
||||||
)}
|
))}
|
||||||
<option value="custom">Custom path...</option>
|
<option value="custom">Custom path...</option>
|
||||||
</select>
|
</select>
|
||||||
{isCustomPath &&
|
{isCustomPath && (
|
||||||
<input
|
<input
|
||||||
className={`form-control ${validPathClass}`}
|
className={`form-control ${validPathClass}`}
|
||||||
value={customPath}
|
value={customPath}
|
||||||
placeholder="m/44'/60'/0'/0"
|
placeholder="m/44'/60'/0'/0"
|
||||||
onChange={this.handleChangeCustomPath}
|
onChange={this.handleChangeCustomPath}
|
||||||
/>}
|
/>
|
||||||
|
)}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div className="DWModal-addresses">
|
<div className="DWModal-addresses">
|
||||||
@ -145,9 +146,7 @@ class DeterministicWalletsModal extends React.Component<Props, State> {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>#</td>
|
<td>#</td>
|
||||||
<td>Address</td>
|
<td>Address</td>
|
||||||
<td>
|
<td>{network.unit}</td>
|
||||||
{network.unit}
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<select
|
<select
|
||||||
className="DWModal-addresses-table-token"
|
className="DWModal-addresses-table-token"
|
||||||
@ -155,11 +154,11 @@ class DeterministicWalletsModal extends React.Component<Props, State> {
|
|||||||
onChange={this.handleChangeToken}
|
onChange={this.handleChangeToken}
|
||||||
>
|
>
|
||||||
<option value="">-Token-</option>
|
<option value="">-Token-</option>
|
||||||
{tokens.map(t =>
|
{tokens.map(t => (
|
||||||
<option key={t.symbol} value={t.symbol}>
|
<option key={t.symbol} value={t.symbol}>
|
||||||
{t.symbol}
|
{t.symbol}
|
||||||
</option>
|
</option>
|
||||||
)}
|
))}
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
<td>More</td>
|
<td>More</td>
|
||||||
@ -280,9 +279,7 @@ class DeterministicWalletsModal extends React.Component<Props, State> {
|
|||||||
key={wallet.address}
|
key={wallet.address}
|
||||||
onClick={this.selectAddress.bind(this, wallet.address, wallet.index)}
|
onClick={this.selectAddress.bind(this, wallet.address, wallet.index)}
|
||||||
>
|
>
|
||||||
<td>
|
<td>{wallet.index + 1}</td>
|
||||||
{wallet.index + 1}
|
|
||||||
</td>
|
|
||||||
<td className="DWModal-addresses-table-address">
|
<td className="DWModal-addresses-table-address">
|
||||||
<input
|
<input
|
||||||
type="radio"
|
type="radio"
|
||||||
|
@ -31,9 +31,7 @@ export default class MnemonicDecrypt extends Component<Props, State> {
|
|||||||
return (
|
return (
|
||||||
<section className="col-md-4 col-sm-6">
|
<section className="col-md-4 col-sm-6">
|
||||||
<div id="selectedTypeKey">
|
<div id="selectedTypeKey">
|
||||||
<h4>
|
<h4>{translate('ADD_Radio_5')}</h4>
|
||||||
{translate('ADD_Radio_5')}
|
|
||||||
</h4>
|
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<textarea
|
<textarea
|
||||||
id="aria-private-key"
|
id="aria-private-key"
|
||||||
@ -56,7 +54,7 @@ export default class MnemonicDecrypt extends Component<Props, State> {
|
|||||||
type="password"
|
type="password"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{isValidMnemonic &&
|
{isValidMnemonic && (
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<button
|
<button
|
||||||
style={{ width: '100%' }}
|
style={{ width: '100%' }}
|
||||||
@ -65,7 +63,8 @@ export default class MnemonicDecrypt extends Component<Props, State> {
|
|||||||
>
|
>
|
||||||
{translate('Choose Address')}
|
{translate('Choose Address')}
|
||||||
</button>
|
</button>
|
||||||
</div>}
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<DeterministicWalletsModal
|
<DeterministicWalletsModal
|
||||||
@ -90,7 +89,7 @@ export default class MnemonicDecrypt extends Component<Props, State> {
|
|||||||
this.setState({ phrase: (e.target as HTMLTextAreaElement).value });
|
this.setState({ phrase: (e.target as HTMLTextAreaElement).value });
|
||||||
};
|
};
|
||||||
|
|
||||||
public onDWModalOpen = (e: React.SyntheticEvent<HTMLButtonElement>) => {
|
public onDWModalOpen = () => {
|
||||||
const { phrase, pass } = this.state;
|
const { phrase, pass } = this.state;
|
||||||
|
|
||||||
if (!validateMnemonic(phrase)) {
|
if (!validateMnemonic(phrase)) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import React, { Component } from 'react';
|
import React from 'react';
|
||||||
import './Code.scss';
|
import './Code.scss';
|
||||||
|
|
||||||
const Code = ({ children }) => (
|
const Code = ({ children }) => (
|
||||||
|
@ -52,8 +52,6 @@ export default class ColorDropdown<T> extends Component<Props<T>, {}> {
|
|||||||
private renderOptions = () => {
|
private renderOptions = () => {
|
||||||
const { options, value, menuAlign, extra } = this.props;
|
const { options, value, menuAlign, extra } = this.props;
|
||||||
|
|
||||||
const activeOption = this.getActiveOption();
|
|
||||||
|
|
||||||
const listItems = options.reduce((prev: any[], opt) => {
|
const listItems = options.reduce((prev: any[], opt) => {
|
||||||
const prevOpt = prev.length ? prev[prev.length - 1] : null;
|
const prevOpt = prev.length ? prev[prev.length - 1] : null;
|
||||||
if (prevOpt && !prevOpt.divider && prevOpt.color !== opt.color) {
|
if (prevOpt && !prevOpt.divider && prevOpt.color !== opt.color) {
|
||||||
|
@ -34,7 +34,7 @@ export default class DropdownComponent<T> extends Component<Props<T>, {}> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private renderLabel = () => {
|
private renderLabel = () => {
|
||||||
const { label, value } = this.props;
|
const { value } = this.props;
|
||||||
const labelStr = this.props.label ? `${this.props.label}:` : '';
|
const labelStr = this.props.label ? `${this.props.label}:` : '';
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import helpIcon from 'assets/images/icon-help.svg';
|
import helpIcon from 'assets/images/icon-help.svg';
|
||||||
import translate, { translateRaw } from 'translations';
|
|
||||||
|
|
||||||
type sizeType = 'small' | 'medium' | 'large';
|
type sizeType = 'small' | 'medium' | 'large';
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import ENS from './components/ENS';
|
import ENS from './components/ENS';
|
||||||
|
|
||||||
const mapStateToProps = state => ({});
|
const mapStateToProps = _ => ({});
|
||||||
|
|
||||||
export default connect(mapStateToProps)(ENS);
|
export default connect(mapStateToProps)(ENS);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Big, {BigNumber} from 'bignumber.js';
|
import { BigNumber } from 'bignumber.js';
|
||||||
import { toChecksumAddress } from 'ethereumjs-util';
|
import { toChecksumAddress } from 'ethereumjs-util';
|
||||||
import Contract, { ABI } from 'libs/contract';
|
import Contract, { ABI } from 'libs/contract';
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import Big from 'bignumber.js';
|
|
||||||
import { randomBytes } from 'crypto';
|
import { randomBytes } from 'crypto';
|
||||||
import RPCClient from '../rpc/client';
|
import RPCClient from '../rpc/client';
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import { Ether, toTokenUnit, UnitKey, Wei } from 'libs/units';
|
|||||||
import { isValidETHAddress } from 'libs/validators';
|
import { isValidETHAddress } from 'libs/validators';
|
||||||
import { stripHexPrefixAndLower, valueToHex } from 'libs/values';
|
import { stripHexPrefixAndLower, valueToHex } from 'libs/values';
|
||||||
import { IWallet } from 'libs/wallet';
|
import { IWallet } from 'libs/wallet';
|
||||||
import translate, { translateRaw } from 'translations';
|
import { translateRaw } from 'translations';
|
||||||
import Big, { BigNumber } from 'bignumber.js';
|
import Big, { BigNumber } from 'bignumber.js';
|
||||||
|
|
||||||
export interface TransactionInput {
|
export interface TransactionInput {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Big, { BigNumber } from 'bignumber.js';
|
import Big from 'bignumber.js';
|
||||||
import EthTx from 'ethereumjs-tx';
|
import EthTx from 'ethereumjs-tx';
|
||||||
import { addHexPrefix } from 'ethereumjs-util';
|
import { addHexPrefix } from 'ethereumjs-util';
|
||||||
import { RawTransaction } from 'libs/transaction';
|
import { RawTransaction } from 'libs/transaction';
|
||||||
|
@ -2,9 +2,7 @@ import {
|
|||||||
ChangeGasPriceAction,
|
ChangeGasPriceAction,
|
||||||
ChangeLanguageAction,
|
ChangeLanguageAction,
|
||||||
ChangeNodeAction,
|
ChangeNodeAction,
|
||||||
ConfigAction,
|
ConfigAction
|
||||||
ToggleOfflineAction,
|
|
||||||
ForceOfflineAction
|
|
||||||
} from 'actions/config';
|
} from 'actions/config';
|
||||||
import { TypeKeys } from 'actions/config/constants';
|
import { TypeKeys } from 'actions/config/constants';
|
||||||
import { NODES } from '../config/data';
|
import { NODES } from '../config/data';
|
||||||
@ -47,14 +45,14 @@ function changeGasPrice(state: State, action: ChangeGasPriceAction): State {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function toggleOffline(state: State, action: ToggleOfflineAction): State {
|
function toggleOffline(state: State): State {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
offline: !state.offline
|
offline: !state.offline
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function forceOffline(state: State, action: ForceOfflineAction): State {
|
function forceOffline(state: State): State {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
forceOffline: !state.forceOffline
|
forceOffline: !state.forceOffline
|
||||||
@ -73,9 +71,9 @@ export function config(
|
|||||||
case TypeKeys.CONFIG_GAS_PRICE:
|
case TypeKeys.CONFIG_GAS_PRICE:
|
||||||
return changeGasPrice(state, action);
|
return changeGasPrice(state, action);
|
||||||
case TypeKeys.CONFIG_TOGGLE_OFFLINE:
|
case TypeKeys.CONFIG_TOGGLE_OFFLINE:
|
||||||
return toggleOffline(state, action);
|
return toggleOffline(state);
|
||||||
case TypeKeys.CONFIG_FORCE_OFFLINE:
|
case TypeKeys.CONFIG_FORCE_OFFLINE:
|
||||||
return forceOffline(state, action);
|
return forceOffline(state);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
import {
|
import { FetchCCRatesSucceeded, RatesAction, CCResponse } from 'actions/rates';
|
||||||
FetchCCRatesSucceeded,
|
|
||||||
FetchCCRatesFailed,
|
|
||||||
RatesAction,
|
|
||||||
CCResponse
|
|
||||||
} from 'actions/rates';
|
|
||||||
import { TypeKeys } from 'actions/rates/constants';
|
import { TypeKeys } from 'actions/rates/constants';
|
||||||
import { Optional } from 'utils/types';
|
import { Optional } from 'utils/types';
|
||||||
|
|
||||||
@ -22,7 +17,7 @@ function fetchCCRatesSucceeded(
|
|||||||
return { ...state, rates: action.payload };
|
return { ...state, rates: action.payload };
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchCCRatesFailed(state: State, action: FetchCCRatesFailed): State {
|
function fetchCCRatesFailed(state: State): State {
|
||||||
// TODO: Make library for error messages
|
// TODO: Make library for error messages
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
@ -38,7 +33,7 @@ export function rates(
|
|||||||
case TypeKeys.RATES_FETCH_CC_SUCCEEDED:
|
case TypeKeys.RATES_FETCH_CC_SUCCEEDED:
|
||||||
return fetchCCRatesSucceeded(state, action);
|
return fetchCCRatesSucceeded(state, action);
|
||||||
case TypeKeys.RATES_FETCH_CC_FAILED:
|
case TypeKeys.RATES_FETCH_CC_FAILED:
|
||||||
return fetchCCRatesFailed(state, action);
|
return fetchCCRatesFailed(state);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,7 @@ import { NODES } from 'config/data';
|
|||||||
import { getNodeConfig } from 'selectors/config';
|
import { getNodeConfig } from 'selectors/config';
|
||||||
import { AppState } from 'reducers';
|
import { AppState } from 'reducers';
|
||||||
import { TypeKeys } from 'actions/config/constants';
|
import { TypeKeys } from 'actions/config/constants';
|
||||||
import {
|
import { toggleOfflineConfig, changeNode } from 'actions/config';
|
||||||
toggleOfflineConfig,
|
|
||||||
TToggleOfflineConfig,
|
|
||||||
changeNode
|
|
||||||
} from 'actions/config';
|
|
||||||
import { State as ConfigState } from 'reducers/config';
|
import { State as ConfigState } from 'reducers/config';
|
||||||
|
|
||||||
export const getConfig = (state: AppState): ConfigState => state.config;
|
export const getConfig = (state: AppState): ConfigState => state.config;
|
||||||
|
@ -4,7 +4,7 @@ import { getAllRates } from 'api/bity';
|
|||||||
import { delay, SagaIterator } from 'redux-saga';
|
import { delay, SagaIterator } from 'redux-saga';
|
||||||
import { call, cancel, fork, put, take, takeLatest } from 'redux-saga/effects';
|
import { call, cancel, fork, put, take, takeLatest } from 'redux-saga/effects';
|
||||||
|
|
||||||
export function* loadBityRates(action?: any): SagaIterator {
|
export function* loadBityRates(): SagaIterator {
|
||||||
while (true) {
|
while (true) {
|
||||||
try {
|
try {
|
||||||
const data = yield call(getAllRates);
|
const data = yield call(getAllRates);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import Big, { BigNumber } from 'bignumber.js';
|
import { BigNumber } from 'bignumber.js';
|
||||||
|
|
||||||
export function toFixedIfLarger(num: number, fixedSize: number = 6): string {
|
export function toFixedIfLarger(num: number, fixedSize: number = 6): string {
|
||||||
return parseFloat(num.toFixed(fixedSize)).toString();
|
return parseFloat(num.toFixed(fixedSize)).toString();
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
export const REDUX_STATE = 'REDUX_STATE';
|
export const REDUX_STATE = 'REDUX_STATE';
|
||||||
import { State as CustomTokenState } from 'reducers/customTokens';
|
|
||||||
import { State as SwapState } from 'reducers/swap';
|
import { State as SwapState } from 'reducers/swap';
|
||||||
|
|
||||||
export function loadState<T>(): T | undefined {
|
export function loadState<T>(): T | undefined {
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
"lib": ["es2017", "dom"],
|
"lib": ["es2017", "dom"],
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"noEmitOnError": false
|
"noEmitOnError": false,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"./common/",
|
"./common/",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user