ESLint additional rules (#4186)

* Add eslint rule for consistent block padding

* Fix padding consistency issues

* Eslint test for duplicate imports

* Eslint closing bracket location

* Fix eslint jsx closing bracket

* missed a file

* Formatting

* Manual overrides for auto

* Manual overrides for auto

* More minor auto-override manual adjustments
This commit is contained in:
Jaco Greeff
2017-01-18 13:05:01 +01:00
committed by GitHub
parent d608ad2011
commit 08f80f2695
198 changed files with 1612 additions and 921 deletions

View File

@@ -26,7 +26,6 @@ import { fromWei } from '~/api/util/wei';
import styles from './accountCard.css';
export default class AccountCard extends Component {
static propTypes = {
account: PropTypes.object.isRequired,
onClick: PropTypes.func.isRequired,

View File

@@ -36,7 +36,6 @@ const initialState = {
};
export default class ActionbarImport extends Component {
static propTypes = {
onConfirm: PropTypes.func.isRequired,
renderValidation: PropTypes.func,
@@ -219,5 +218,4 @@ export default class ActionbarImport extends Component {
onCloseModal = () => {
this.setState(initialState);
}
}

View File

@@ -68,7 +68,8 @@ export default class ActionbarSearch extends Component {
return (
<div
className={ styles.searchcontainer }
key='searchAccount'>
key='searchAccount'
>
<div className={ inputContainerClasses.join(' ') }>
<InputChip
addOnBlur
@@ -87,7 +88,8 @@ export default class ActionbarSearch extends Component {
className={ styles.searchButton }
icon={ <ActionSearch /> }
label=''
onClick={ this.handleSearchClick } />
onClick={ this.handleSearchClick }
/>
</div>
);
}

View File

@@ -60,7 +60,7 @@ export default class ActionbarSort extends Component {
label=''
icon={ <SortIcon /> }
onClick={ this.store.handleMenuOpen }
/>
/>
}
open={ this.store.menuOpen }
onRequestChange={ this.store.handleMenuChange }
@@ -116,5 +116,4 @@ export default class ActionbarSort extends Component {
/>
);
}
}

View File

@@ -76,10 +76,12 @@ class Balance extends Component {
return (
<div
className={ styles.balance }
key={ token.tag }>
key={ token.tag }
>
<img
src={ imagesrc }
alt={ token.name } />
alt={ token.name }
/>
<div className={ styles.balanceValue }>
<span title={ value }> { value } </span>
</div>

View File

@@ -44,7 +44,8 @@ class BlockStatus extends Component {
defaultMessage='{blockNumber} best block'
values={ {
blockNumber: blockNumber.toFormat()
} } />
} }
/>
</div>
);
}
@@ -57,7 +58,8 @@ class BlockStatus extends Component {
defaultMessage='{percentage}% warp restore'
values={ {
percentage: syncing.warpChunksProcessed.mul(100).div(syncing.warpChunksAmount).toFormat(2)
} } />
} }
/>
</div>
);
}
@@ -74,7 +76,8 @@ class BlockStatus extends Component {
values={ {
currentBlock: syncing.currentBlock.toFormat(),
highestBlock: syncing.highestBlock.toFormat()
} } />
} }
/>
</span>
);
}
@@ -89,7 +92,8 @@ class BlockStatus extends Component {
defaultMessage=', {percentage}% historic'
values={ {
percentage: first.mul(100).div(last).toFormat(2)
} } />
} }
/>
</span>
);
}

View File

@@ -45,7 +45,8 @@ export default class Button extends Component {
icon={ icon }
label={ label }
primary={ primary }
onTouchTap={ onClick } />
onTouchTap={ onClick }
/>
);
}
}

View File

@@ -28,12 +28,14 @@ import styles from './confirmDialog.css';
const DEFAULT_NO = (
<FormattedMessage
id='ui.confirmDialog.no'
defaultMessage='no' />
defaultMessage='no'
/>
);
const DEFAULT_YES = (
<FormattedMessage
id='ui.confirmDialog.yes'
defaultMessage='yes' />
defaultMessage='yes'
/>
);
export default class ConfirmDialog extends Component {
@@ -58,7 +60,8 @@ export default class ConfirmDialog extends Component {
className={ className }
actions={ this.renderActions() }
title={ title }
visible={ visible }>
visible={ visible }
>
<div className={ styles.body }>
{ children }
</div>
@@ -73,11 +76,13 @@ export default class ConfirmDialog extends Component {
<Button
icon={ iconDeny || <CancelIcon /> }
label={ labelDeny || DEFAULT_NO }
onClick={ onDeny } />,
onClick={ onDeny }
/>,
<Button
icon={ iconConfirm || <CheckIcon /> }
label={ labelConfirm || DEFAULT_YES }
onClick={ onConfirm } />
onClick={ onConfirm }
/>
];
}
}

View File

@@ -54,7 +54,8 @@ function render (props = {}) {
{ ...props }
title='test title'
onConfirm={ onConfirm }
onDeny={ onDeny }>
onDeny={ onDeny }
>
<div id='testContent'>
some test content
</div>

View File

@@ -25,7 +25,6 @@ import 'brace/mode/json';
import './mode-solidity';
export default class Editor extends Component {
static propTypes = {
className: PropTypes.string,
value: PropTypes.string,
@@ -99,5 +98,4 @@ export default class Editor extends Component {
handleOnChange = (value) => {
this.props.onChange(value);
}
}

View File

@@ -25,7 +25,6 @@ import { sha3 } from '~/api/util/sha3';
const ZERO = /^(0x)?0*$/;
export default class AddressSelectStore {
@observable loading = false;
@observable values = [];
@observable registryValues = [];
@@ -305,5 +304,4 @@ export default class AddressSelectStore {
return nameA.localeCompare(nameB);
});
}
}

View File

@@ -168,7 +168,8 @@ export default class Input extends Component {
underlineStyle={ underlineStyle }
underlineFocusStyle={ underlineFocusStyle }
underlineShow={ !hideUnderline }
value={ value }>
value={ value }
>
{ children }
</TextField>
</div>

View File

@@ -134,7 +134,8 @@ class InputAddress extends Component {
<IdentityIcon
address={ value }
center
inline />
inline
/>
</div>
);
}

View File

@@ -203,5 +203,4 @@ export default class InputChip extends Component {
onTokensChange(tokens.filter(token => token && token.length > 0));
}
}

View File

@@ -50,7 +50,8 @@ export default class InputInline extends Component {
return (
<div
className={ styles.inlineedit }
onClick={ this.onToggle }>
onClick={ this.onToggle }
>
{ this.props.static || value }
</div>
);
@@ -66,7 +67,8 @@ export default class InputInline extends Component {
onBlur={ this.onBlur }
onChange={ this.props.onChange }
onKeyDown={ this.onKeyDown }
onSubmit={ this.props.onSubmit } />
onSubmit={ this.props.onSubmit }
/>
);
}

View File

@@ -48,7 +48,8 @@ export default class RadioButtons extends Component {
<RadioButtonGroup
name={ name }
onChange={ this.onChange }
valueSelected={ key } >
valueSelected={ key }
>
{ this.renderContent() }
</RadioButtonGroup>
);
@@ -78,7 +79,8 @@ export default class RadioButtons extends Component {
}
</div>
}
value={ key } />
value={ key }
/>
);
});
}

View File

@@ -32,7 +32,6 @@ import { ABI_TYPES, parseAbiType } from '~/util/abi';
import styles from './typedInput.css';
export default class TypedInput extends Component {
static propTypes = {
param: PropTypes.oneOfType([
PropTypes.object,
@@ -359,7 +358,8 @@ export default class TypedInput extends Component {
<MenuItem
key={ bool }
label={ bool }
value={ bool }>
value={ bool }
>
{ bool }
</MenuItem>
);
@@ -377,7 +377,8 @@ export default class TypedInput extends Component {
value
? 'true'
: 'false'
}>
}
>
{ boolitems }
</Select>
);
@@ -445,5 +446,4 @@ export default class TypedInput extends Component {
return param;
}
}

View File

@@ -31,7 +31,8 @@ function render (props) {
component = shallow(
<TypedInput
{ ...props }
onChange={ onChange } />
onChange={ onChange }
/>
);
select = component.find('Select');

View File

@@ -36,7 +36,8 @@ export default class Form extends Component {
return (
<form
autoComplete='new-password'
className={ classes.join(' ') }>
className={ classes.join(' ') }
>
<div className={ styles.autofill }>
<input type='text' name='fakeusernameremembered' />
<input type='password' name='fakepasswordremembered' />

View File

@@ -53,7 +53,8 @@ export default class GasPriceEditor extends Component {
<GasPriceSelector
histogram={ histogram }
onChange={ this.onEditGasPrice }
price={ price } />
price={ price }
/>
<div className={ styles.gasPriceDesc }>
You can choose the gas price based on the distribution of recent included transaction gas prices. The lower the gas price is, the cheaper the transaction will be. The higher the gas price is, the faster it should get mined by the network.
</div>
@@ -66,13 +67,15 @@ export default class GasPriceEditor extends Component {
hint='the amount of gas to use for the transaction'
label={ gasLabel }
onChange={ this.onEditGas }
value={ gas } />
value={ gas }
/>
<Input
error={ errorPrice }
hint='the price of gas to use for the transaction'
label={ priceLabel }
onChange={ this.onEditGasPrice }
value={ price } />
value={ price }
/>
</div>
<div className={ styles.row }>
<Input
@@ -80,7 +83,8 @@ export default class GasPriceEditor extends Component {
error={ errorTotal }
hint='the total amount of the transaction'
label='total transaction amount'
value={ `${eth} ETH` } />
value={ `${eth} ETH` }
/>
</div>
<div className={ styles.row }>
{ children }

View File

@@ -111,17 +111,22 @@ export default class GasPriceSelector extends Component {
] }
isAnimationActive={ false }
line
shape={ <CustomShape showValue={ selectedCount } /> } />
shape={
<CustomShape showValue={ selectedCount } />
}
/>
<XAxis
dataKey='x'
domain={ [0, 1] }
hide
height={ 0 } />
height={ 0 }
/>
<YAxis
dataKey='y'
domain={ chartData.yDomain }
hide
width={ 0 } />
width={ 0 }
/>
</ScatterChart>
</ResponsiveContainer>
</div>
@@ -132,24 +137,29 @@ export default class GasPriceSelector extends Component {
barCategoryGap={ 1 }
data={ chartData.values }
margin={ { top: 0, right: 0, left: 0, bottom: 0 } }
ref='barChart'>
ref='barChart'
>
<Bar
dataKey='value'
onClick={ this.onClickprice }
shape={ <CustomBar selected={ selectedIndex } onClick={ this.onClickprice } /> }stroke={ COLORS.line } />
shape={ <CustomBar selected={ selectedIndex } onClick={ this.onClickprice } /> }stroke={ COLORS.line }
/>
<Tooltip
content={ <CustomTooltip histogram={ histogram } /> }
cursor={ this.renderCustomCursor() }
wrapperStyle={ TOOL_STYLE } />
wrapperStyle={ TOOL_STYLE }
/>
<XAxis
dataKey='index'
domain={ chartData.xDomain }
hide
type='category' />
type='category'
/>
<YAxis
domain={ chartData.yDomain }
hide
type='number' />
type='number'
/>
</BarChart>
</ResponsiveContainer>
</div>

View File

@@ -112,7 +112,8 @@ class IdentityIcon extends Component {
background: '#eee',
height: size,
width: size
} } />
} }
/>
);
} else if (isNullAddress(address)) {
return (
@@ -123,7 +124,8 @@ class IdentityIcon extends Component {
background: '#333',
height: size,
width: size
} } />
} }
/>
);
}
@@ -133,7 +135,8 @@ class IdentityIcon extends Component {
data-address-img
height={ size }
width={ size }
src={ iconsrc } />
src={ iconsrc }
/>
);
}
}

View File

@@ -24,12 +24,14 @@ import ShortenedHash from '../ShortenedHash';
const defaultName = (
<FormattedMessage
id='ui.identityName.unnamed'
defaultMessage='UNNAMED' />
defaultMessage='UNNAMED'
/>
);
const defaultNameNull = (
<FormattedMessage
id='ui.identityName.null'
defaultMessage='NULL' />
defaultMessage='NULL'
/>
);
class IdentityName extends Component {

View File

@@ -47,7 +47,8 @@ function render (props) {
return shallow(
<IdentityName
store={ STORE }
{ ...props } />
{ ...props }
/>
).find('IdentityName').shallow();
}

View File

@@ -36,15 +36,18 @@ export default class LanguageSelector extends Component {
hint={
<FormattedMessage
id='settings.parity.languages.hint'
defaultMessage='the language this interface is displayed with' />
defaultMessage='the language this interface is displayed with'
/>
}
label={
<FormattedMessage
id='settings.parity.languages.label'
defaultMessage='UI language' />
defaultMessage='UI language'
/>
}
value={ this.store.locale }
onChange={ this.onChange }>
onChange={ this.onChange }
>
{ this.renderOptions() }
</Select>
);
@@ -58,7 +61,8 @@ export default class LanguageSelector extends Component {
<MenuItem
key={ locale }
value={ locale }
label={ label }>
label={ label }
>
{ label }
</MenuItem>
);

View File

@@ -465,7 +465,6 @@ class MethodDecoding extends Component {
inputType: ascii.valid ? 'raw' : 'ascii'
});
}
}
function mapStateToProps (initState, initProps) {
@@ -478,6 +477,8 @@ function mapStateToProps (initState, initProps) {
return { token };
};
}
export default connect(
mapStateToProps
mapStateToProps,
null
)(MethodDecoding);

View File

@@ -25,7 +25,6 @@ const CONTRACT_CREATE = '0x60606040';
let instance = null;
export default class MethodDecodingStore {
api = null;
_bytecodes = {};
@@ -311,5 +310,4 @@ export default class MethodDecodingStore {
return Promise.resolve(this._bytecodes[contractAddress]);
}
}

View File

@@ -58,8 +58,7 @@ export default class Title extends Component {
return (
<div className={ styles.steps }>
<Stepper
activeStep={ current }>
<Stepper activeStep={ current }>
{ this.renderTimeline() }
</Stepper>
</div>
@@ -71,8 +70,7 @@ export default class Title extends Component {
return steps.map((label, index) => {
return (
<Step
key={ label.key || index }>
<Step key={ label.key || index }>
<StepLabel>
{ label }
</StepLabel>

View File

@@ -67,7 +67,8 @@ class Modal extends Component {
current={ current }
steps={ steps }
title={ title }
waiting={ waiting } />
waiting={ waiting }
/>
);
const classes = `${styles.dialog} ${className}`;
@@ -89,7 +90,8 @@ class Modal extends Component {
repositionOnUpdate={ false }
style={ DIALOG_STYLE }
title={ header }
titleStyle={ TITLE_STYLE }>
titleStyle={ TITLE_STYLE }
>
<Container
compact={ compact }
light

View File

@@ -38,7 +38,8 @@ export default class Page extends Component {
actionbar = (
<Actionbar
buttons={ buttons }
title={ title } />
title={ title }
/>
);
}

View File

@@ -25,7 +25,6 @@ import ParityBackground from '~/ui/ParityBackground';
import styles from './portal.css';
export default class Portal extends Component {
static propTypes = {
onClose: PropTypes.func.isRequired,
open: PropTypes.bool.isRequired,

View File

@@ -40,9 +40,10 @@ class SignerIcon extends Component {
return (
<IdentityIcon
address={ signerSha }
center
className={ className }
address={ signerSha } />
/>
);
}
}

View File

@@ -67,22 +67,24 @@ class Tooltip extends Component {
key='skipButton'
icon={ <ContentClear /> }
label='Skip'
onTouchTap={ onCloseTooltips } />,
onTouchTap={ onCloseTooltips }
/>,
<FlatButton
key='nextButton'
icon={ <NavigationArrowForward /> }
label='Next'
onTouchTap={ onNextTooltip } />
onTouchTap={ onNextTooltip }
/>
] : (
<FlatButton
icon={ <ActionDoneAll /> }
label='Done'
onTouchTap={ onCloseTooltips } />
onTouchTap={ onCloseTooltips }
/>
);
return (
<div
className={ classes }>
<div className={ classes }>
<div className={ styles.title }>
{ this.props.title }
</div>

View File

@@ -79,7 +79,8 @@ class TxHash extends Component {
: <FormattedMessage
id='ui.txHash.posted'
defaultMessage='The transaction has been posted to the network with a hash of {hashLink}'
values={ { hashLink } } />
values={ { hashLink } }
/>
}</p>
{ this.renderConfirmations() }
</div>
@@ -101,7 +102,8 @@ class TxHash extends Component {
<div className={ styles.progressinfo }>
<FormattedMessage
id='ui.txHash.waiting'
defaultMessage='waiting for confirmations' />
defaultMessage='waiting for confirmations'
/>
</div>
</div>
);
@@ -123,7 +125,8 @@ class TxHash extends Component {
max={ maxConfirmations }
value={ value }
color='white'
mode='determinate' />
mode='determinate'
/>
<div className={ styles.progressinfo }>
<abbr title={ `block #${blockNumber.toFormat(0)}` }>
<FormattedMessage
@@ -132,7 +135,8 @@ class TxHash extends Component {
values={ {
count,
value
} } />
} }
/>
</abbr>
</div>
</div>

View File

@@ -72,7 +72,8 @@ function render (props) {
const baseComponent = shallow(
<TxHash
hash={ TXHASH }
{ ...props } />,
{ ...props }
/>,
{ context: { store: createRedux() } }
);
component = baseComponent.find('TxHash').shallow({ context: { api: createApi() } });

View File

@@ -58,7 +58,8 @@ export default class TxRow extends Component {
<a
className={ styles.link }
href={ txLink(tx.hash, isTest) }
target='_blank'>
target='_blank'
>
{ `${tx.hash.substr(2, 6)}...${tx.hash.slice(-6)}` }
</a>
</div>
@@ -68,7 +69,8 @@ export default class TxRow extends Component {
<MethodDecoding
historic={ historic }
address={ address }
transaction={ tx } />
transaction={ tx }
/>
</td>
</tr>
);
@@ -83,8 +85,12 @@ export default class TxRow extends Component {
<a
href={ addressLink(address, isTest) }
target='_blank'
className={ styles.link }>
<IdentityName address={ address } shorten />
className={ styles.link }
>
<IdentityName
address={ address }
shorten
/>
</a>
);
}
@@ -95,7 +101,8 @@ export default class TxRow extends Component {
<IdentityIcon
center
className={ styles.icon }
address={ address } />
address={ address }
/>
</div>
<div className={ styles.center }>
{ esLink || 'DEPLOY' }

View File

@@ -28,7 +28,8 @@ const api = new Api({ execute: sinon.stub() });
function render (props) {
return shallow(
<TxRow
{ ...props } />,
{ ...props }
/>,
{ context: { api } }
);
}

View File

@@ -40,7 +40,8 @@ function render (props) {
return shallow(
<TxList
store={ STORE }
{ ...props } />,
{ ...props }
/>,
{ context: { api } }
);
}