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

@@ -24,7 +24,6 @@ import IdentityIcon from '../../IdentityIcon';
import styles from './account-selector.css';
class AccountSelectorItem extends Component {
static propTypes = {
onSelectAccount: PropTypes.func.isRequired,
account: PropTypes.object.isRequired
@@ -37,15 +36,19 @@ class AccountSelectorItem extends Component {
delete props.account;
delete props.onSelectAccount;
const icon = (<IdentityIcon
inline center
address={ account.address } />
const icon = (
<IdentityIcon
inline center
address={ account.address }
/>
);
const avatar = (<Avatar
className={ styles.avatar }
backgroundColor='none'
icon={ icon } />
const avatar = (
<Avatar
className={ styles.avatar }
backgroundColor='none'
icon={ icon }
/>
);
return (
@@ -55,18 +58,17 @@ class AccountSelectorItem extends Component {
primaryText={ account.name }
secondaryText={ account.address }
leftAvatar={ avatar }
{ ...props } />
{ ...props }
/>
);
}
onSelectAccount = () => {
this.props.onSelectAccount(this.props.account.address);
}
}
export default class AccountSelector extends Component {
static propTypes = {
list: PropTypes.array.isRequired,
selected: PropTypes.object.isRequired,
@@ -87,7 +89,8 @@ export default class AccountSelector extends Component {
open={ this.state.open }
onSelectAccount={ this.onToggleOpen }
autoGenerateNestedIndicator={ false }
nestedListStyle={ { maxHeight: '14em', overflow: 'auto' } } />
nestedListStyle={ { maxHeight: '14em', overflow: 'auto' } }
/>
);
return (
@@ -106,7 +109,8 @@ export default class AccountSelector extends Component {
<AccountSelectorItem
account={ account }
onSelectAccount={ this.onSelectAccount }
key={ index } />
key={ index }
/>
));
}
@@ -122,5 +126,4 @@ export default class AccountSelector extends Component {
this.props.handleSetSelected(address);
this.onToggleOpen();
}
}

View File

@@ -23,9 +23,11 @@ import { setSelectedAccount } from '../actions';
class AccountSelectorContainer extends Component {
render () {
return (<AccountSelector
{ ...this.props }
/>);
return (
<AccountSelector
{ ...this.props }
/>
);
}
}
@@ -42,4 +44,7 @@ const mapDispatchToProps = (dispatch) => {
};
};
export default connect(mapStateToProps, mapDispatchToProps)(AccountSelectorContainer);
export default connect(
mapStateToProps,
mapDispatchToProps
)(AccountSelectorContainer);

View File

@@ -35,7 +35,6 @@ const initState = {
};
export default class QueryAction extends Component {
static propTypes = {
show: PropTypes.bool.isRequired,
loading: PropTypes.bool.isRequired,
@@ -56,7 +55,8 @@ export default class QueryAction extends Component {
open={ this.props.show }
className={ styles.dialog }
onRequestClose={ this.onClose }
actions={ this.renderActions() } >
actions={ this.renderActions() }
>
{ this.renderContent() }
</Dialog>
);
@@ -70,7 +70,8 @@ export default class QueryAction extends Component {
<FlatButton
label='Loading...'
primary
disabled />
disabled
/>
);
}
@@ -81,7 +82,8 @@ export default class QueryAction extends Component {
<FlatButton
label='Close'
primary
onTouchTap={ this.onClose } />
onTouchTap={ this.onClose }
/>
]);
}
@@ -91,12 +93,14 @@ export default class QueryAction extends Component {
<FlatButton
label='Cancel'
primary
onTouchTap={ this.onClose } />,
onTouchTap={ this.onClose }
/>,
<FlatButton
label='Query'
primary
disabled={ !isValid }
onTouchTap={ this.onQuery } />
onTouchTap={ this.onQuery }
/>
]);
}
@@ -140,31 +144,38 @@ export default class QueryAction extends Component {
floatingLabelText='Select which field to query'
fullWidth
value={ this.state.queryKey }
onChange={ this.onQueryKeyChange }>
onChange={ this.onQueryKeyChange }
>
<MenuItem value='tla' label='TLA' primaryText='TLA' />
<MenuItem value='address' label='Address' primaryText='Address' />
</SelectField>
{
this.state.queryKey !== 'tla'
? (<InputText
key={ 0 }
? (
<InputText
key={ 0 }
floatingLabelText="Token's address"
hintText='0xdeadbeef...'
floatingLabelText="Token's address"
hintText='0xdeadbeef...'
validationType={ SIMPLE_TOKEN_ADDRESS_TYPE }
onChange={ this.onChange }
onEnter={ this.onQuery } />)
: (<InputText
key={ 1 }
validationType={ SIMPLE_TOKEN_ADDRESS_TYPE }
onChange={ this.onChange }
onEnter={ this.onQuery }
/>
)
: (
<InputText
key={ 1 }
floatingLabelText="Token's TLA"
hintText='GAV'
floatingLabelText="Token's TLA"
hintText='GAV'
validationType={ SIMPLE_TLA_TYPE }
onChange={ this.onChange }
onEnter={ this.onQuery } />)
validationType={ SIMPLE_TLA_TYPE }
onChange={ this.onChange }
onEnter={ this.onQuery }
/>
)
}
</div>
);
@@ -203,5 +214,4 @@ export default class QueryAction extends Component {
this.setState(initState);
this.props.onClose();
}
}

View File

@@ -57,7 +57,6 @@ const initState = {
};
export default class RegisterAction extends Component {
static propTypes = {
show: PropTypes.bool.isRequired,
sending: PropTypes.bool.isRequired,
@@ -97,7 +96,8 @@ export default class RegisterAction extends Component {
<FlatButton
label='Close'
primary
onTouchTap={ this.onClose } />
onTouchTap={ this.onClose }
/>
);
}
@@ -106,7 +106,8 @@ export default class RegisterAction extends Component {
<FlatButton
label='Done'
primary
onTouchTap={ this.onClose } />
onTouchTap={ this.onClose }
/>
);
}
@@ -116,12 +117,14 @@ export default class RegisterAction extends Component {
<FlatButton
label='Cancel'
primary
onTouchTap={ this.onClose } />,
onTouchTap={ this.onClose }
/>,
<FlatButton
label={ sending ? 'Sending...' : 'Register' }
primary
disabled={ !isValid || sending }
onTouchTap={ this.onRegister } />
onTouchTap={ this.onRegister }
/>
]);
}
@@ -177,7 +180,8 @@ export default class RegisterAction extends Component {
hintText={ field.hintText }
validationType={ field.type }
onChange={ onChange } />
onChange={ onChange }
/>
);
});
}
@@ -227,5 +231,4 @@ export default class RegisterAction extends Component {
this.setState(initState);
this.props.onClose();
}
}

View File

@@ -29,7 +29,6 @@ const REGISTER_ACTION = 'REGISTER_ACTION';
const QUERY_ACTION = 'QUERY_ACTION';
export default class Actions extends Component {
static propTypes = {
handleRegisterToken: PropTypes.func.isRequired,
handleRegisterClose: PropTypes.func.isRequired,
@@ -62,26 +61,30 @@ export default class Actions extends Component {
icon={ <ContentSendIcon /> }
label='Register Token'
primary
onTouchTap={ this.onShowRegister } />
onTouchTap={ this.onShowRegister }
/>
<RaisedButton
className={ styles.button }
icon={ <ActionSearchIcon /> }
label='Search Token'
primary
onTouchTap={ this.onShowQuery } />
onTouchTap={ this.onShowQuery }
/>
<Register
show={ this.state.show[ REGISTER_ACTION ] }
onClose={ this.onRegisterClose }
handleRegisterToken={ this.props.handleRegisterToken }
{ ...this.props.register } />
{ ...this.props.register }
/>
<Query
show={ this.state.show[ QUERY_ACTION ] }
onClose={ this.onQueryClose }
handleQueryToken={ this.props.handleQueryToken }
{ ...this.props.query } />
{ ...this.props.query }
/>
</div>
);
}
@@ -113,5 +116,4 @@ export default class Actions extends Component {
}
});
}
}

View File

@@ -22,11 +22,12 @@ import Actions from './component';
import { registerToken, registerReset, queryToken, queryReset } from './actions';
class TokensContainer extends Component {
render () {
return (<Actions
{ ...this.props }
/>);
return (
<Actions
{ ...this.props }
/>
);
}
}

View File

@@ -56,7 +56,8 @@ export default class Application extends Component {
<div className={ styles.application }>
<Status
address={ contract.address }
fee={ contract.fee } />
fee={ contract.fee }
/>
<Actions />
@@ -73,5 +74,4 @@ export default class Application extends Component {
muiTheme
};
}
}

View File

@@ -44,7 +44,8 @@ export default class CustomChip extends Component {
background: '#27ae60',
display: 'flex',
flexDirection: 'column'
} }>
} }
>
{ this.renderIcon(isAddress, value) }
<span className={ styles.value } title={ value }>
{ displayValue }
@@ -64,7 +65,8 @@ export default class CustomChip extends Component {
return (
<IdentityIcon
inline center
address={ address } />
address={ address }
/>
);
}
}

View File

@@ -36,10 +36,12 @@ class Container extends Component {
render () {
const { isLoading, contract } = this.props;
return (<Application
isLoading={ isLoading }
contract={ contract }
/>);
return (
<Application
isLoading={ isLoading }
contract={ contract }
/>
);
}
}

View File

@@ -30,7 +30,8 @@ export default class IdentityIcon extends Component {
return (
<img
className={ styles.icon }
src={ api.util.createIdentityImg(address, 4) } />
src={ api.util.createIdentityImg(address, 4) }
/>
);
}
}

View File

@@ -20,11 +20,12 @@ import { connect } from 'react-redux';
import InputText from './input-text';
class InputTextContainer extends Component {
render () {
return (<InputText
{ ...this.props }
/>);
return (
<InputText
{ ...this.props }
/>
);
}
}

View File

@@ -35,7 +35,6 @@ const initState = {
};
export default class InputText extends Component {
static propTypes = {
validationType: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
@@ -64,7 +63,8 @@ export default class InputText extends Component {
disabled={ disabled }
errorText={ error }
onChange={ this.onChange }
onKeyDown={ this.onKeyDown } />
onKeyDown={ this.onKeyDown }
/>
{ this.renderLoading() }
{ this.renderIsValid() }
@@ -146,5 +146,4 @@ export default class InputText extends Component {
return this.props.onChange(false, value);
}
}

View File

@@ -38,7 +38,8 @@ export default class Status extends Component {
<Chip
isAddress={ false }
value={ api.util.fromWei(fee).toFixed(3) + 'ETH' }
label='Fee' />
label='Fee'
/>
</div>
);
}

View File

@@ -56,7 +56,8 @@ export default class AddMeta extends Component {
icon={ <AddIcon /> }
primary
fullWidth
onTouchTap={ this.onShowDialog } />
onTouchTap={ this.onShowDialog }
/>
<Dialog
title='add meta data'
@@ -64,7 +65,8 @@ export default class AddMeta extends Component {
modal={ this.state.complete }
className={ styles.dialog }
onRequestClose={ this.onClose }
actions={ this.renderActions() } >
actions={ this.renderActions() }
>
{ this.renderContent() }
</Dialog>
</div>);
@@ -78,7 +80,8 @@ export default class AddMeta extends Component {
<FlatButton
label='Done'
primary
onTouchTap={ this.onClose } />
onTouchTap={ this.onClose }
/>
);
}
@@ -88,12 +91,14 @@ export default class AddMeta extends Component {
<FlatButton
label='Cancel'
primary
onTouchTap={ this.onClose } />,
onTouchTap={ this.onClose }
/>,
<FlatButton
label='Add'
primary
disabled={ !isValid }
onTouchTap={ this.onAdd } />
onTouchTap={ this.onAdd }
/>
]);
}
@@ -130,7 +135,8 @@ export default class AddMeta extends Component {
floatingLabelText='Choose the meta-data to add'
fullWidth
value={ this.state.metaKeyIndex }
onChange={ this.onMetaKeyChange }>
onChange={ this.onMetaKeyChange }
>
{ this.renderMetaKeyItems() }
@@ -142,7 +148,8 @@ export default class AddMeta extends Component {
hintText={ `The value of the ${selectedMeta.label.toLowerCase()} (${selectedMeta.validation === ADDRESS_TYPE ? 'Address' : 'Url Hint'})` }
validationType={ selectedMeta.validation }
onChange={ this.onChange } />
onChange={ this.onChange }
/>
</div>
);
}
@@ -152,7 +159,8 @@ export default class AddMeta extends Component {
<MenuItem
value={ index }
key={ index }
label={ key.label } primaryText={ key.label } />
label={ key.label } primaryText={ key.label }
/>
));
}
@@ -194,5 +202,4 @@ export default class AddMeta extends Component {
value: ''
} });
}
}

View File

@@ -99,7 +99,8 @@ export default class Token extends Component {
return (<div>
<Paper zDepth={ 1 } className={ styles.token } style={ {
backgroundColor: 'none'
} }>
} }
>
<div className={ styles['token-bg'] } />
{ this.renderContent() }
</Paper>
@@ -128,7 +129,8 @@ export default class Token extends Component {
floatingLabelText='Choose the meta-data to look-up'
fullWidth
value={ this.state.metaKeyIndex }
onChange={ this.onMetaKeyChange }>
onChange={ this.onMetaKeyChange }
>
{ this.renderMetaKeyItems() }
@@ -139,7 +141,8 @@ export default class Token extends Component {
icon={ <FindIcon /> }
primary
fullWidth
onTouchTap={ this.onMetaLookup } />
onTouchTap={ this.onMetaLookup }
/>
</div>
{ this.renderMeta(meta) }
@@ -157,7 +160,8 @@ export default class Token extends Component {
<MenuItem
value={ index }
key={ index }
label={ key.label } primaryText={ key.label } />
label={ key.label } primaryText={ key.label }
/>
));
}
@@ -169,7 +173,8 @@ export default class Token extends Component {
return (
<Chip
value={ Math.log10(base).toString() }
label='Decimals' />
label='Decimals'
/>
);
}
@@ -182,7 +187,8 @@ export default class Token extends Component {
<Chip
isAddress
value={ address }
label='Address' />
label='Address'
/>
);
}
@@ -192,7 +198,8 @@ export default class Token extends Component {
return (
<Chip
value={ `${balance.toString()} ${tla}` }
label='Total' />
label='Total'
/>
);
}
@@ -212,7 +219,8 @@ export default class Token extends Component {
isAddress
displayValue={ displayValue }
value={ owner }
label='Owner' />
label='Owner'
/>
);
}
@@ -237,7 +245,8 @@ export default class Token extends Component {
<AddMeta
handleAddMeta={ this.props.handleAddMeta }
isTokenOwner={ this.props.isTokenOwner }
index={ this.props.index } />
index={ this.props.index }
/>
);
}
@@ -253,7 +262,8 @@ export default class Token extends Component {
icon={ <DeleteIcon /> }
secondary
fullWidth
onTouchTap={ this.onUnregister } />
onTouchTap={ this.onUnregister }
/>
);
}