Permalink
Browse files

Bump XO and fix new lint issues

  • Loading branch information...
sindresorhus committed Jan 14, 2019
1 parent b5a3948 commit cb7635f1b0cae29dbcab7e69ec97dfe8c4c86525
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
import util from 'util';
import electron from 'electron';
import {sha256} from 'crypto-hash';
@@ -16,7 +17,6 @@ const uuidPredicate = ow.string.alphanumeric.lowercase;
const errorWithObject = (message, object) => new Error(`${message}:\n${util.format(object)}`);
const genericError = object => errorWithObject('Encountered an error', object);

/* eslint-disable camelcase */
export default class Api {
constructor({endpoint, seedPhrase, concurrency = 1}) {
ow(endpoint, ow.string.label('endpoint'));
@@ -344,6 +344,7 @@ export default class Api {
if (hasBroadcast) {
throw new Error('Transaction has already been broadcast');
}

hasBroadcast = true;

const response = await this.request({
@@ -25,12 +25,17 @@ Button.propTypes = {
primary: PropTypes.bool,
fullwidth: PropTypes.bool,
color: PropTypes.string,
disabled: PropTypes.bool,
className: PropTypes.string,
value: PropTypes.string.isRequired,
};

Button.defaultProps = {
primary: false,
fullwidth: false,
color: undefined,
disabled: false,
className: '',
};

export default Button;
@@ -16,6 +16,14 @@ const WrappedInput = React.forwardRef((props, ref) => {
return <Input {...props} ref={ref} pattern={validateInput} onChange={onChange}/>;
});

WrappedInput.propTypes = {
onChange: PropTypes.func,
};

WrappedInput.defaultProps = {
onChange: () => {},
};

class DateInput extends React.Component {
static propTypes = {
forwardedRef: PropTypes.oneOfType([
@@ -24,12 +32,18 @@ class DateInput extends React.Component {
]),
autoCorrect: PropTypes.bool,
onDayChange: PropTypes.func,
onBlur: PropTypes.func,
inputProps: PropTypes.object,
dayPickerProps: PropTypes.object.isRequired,
value: PropTypes.any.isRequired, // TODO: Validate it as a `Date`. PropTypes doesn't have support for that.
}

static defaultProps = {
forwardedRef: undefined,
autoCorrect: false,
onDayChange: () => {},
onBlur: () => {},
inputProps: undefined,
};

constructor(props) {
@@ -55,9 +69,7 @@ class DateInput extends React.Component {
}, 600);
}

if (typeof onBlur === 'function') {
onBlur(event);
}
onBlur(event);
}

handleDayChange = (day, modifiers, input) => {
@@ -40,6 +40,11 @@ class Input extends React.Component {
view: PropTypes.func,
button: PropTypes.func,
onChange: PropTypes.func,
value: PropTypes.string,
pattern: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func,
]),
}

static defaultProps = {
@@ -59,6 +64,8 @@ class Input extends React.Component {
view: undefined,
button: undefined,
onChange: undefined,
value: '',
pattern: undefined,
}

static getDerivedStateFromProps(props, state) {
@@ -83,7 +90,7 @@ class Input extends React.Component {

state = {
level: this.props.level,
value: this.props.value || '',
value: this.props.value,
};

handleChange = event => {
@@ -152,7 +152,7 @@ class SwapDetails extends React.Component {
color={
(swap.status === 'completed' && 'var(--success-color)') ||
(swap.status === 'failed' && 'var(--error-color)') ||
null
null
}
/>
<div className="section overview">
@@ -18,7 +18,6 @@ const SortDirections = {
DESC: Symbol('desc'),
};

// eslint-disable-next-line no-unused-vars
class CancelButton extends React.Component {
static propTypes = {
swap: PropTypes.object.isRequired,
@@ -115,6 +115,7 @@ class AppContainer extends SuperContainer {
if (theme === 'system' && is.macos) {
cssTheme = darkMode.isEnabled ? 'dark' : 'light';
}

document.documentElement.dataset.theme = cssTheme;

this.setState({theme});
@@ -37,6 +37,7 @@ class ExchangeContainer extends SuperContainer {
});
this.setBaseCurrency(newBaseCurrency);
}

if (!appContainer.state.enabledCoins.includes(this.state.quoteCurrency)) {
const newQuoteCurrency = appContainer.state.enabledCoins.find(enabledCoin => {
return enabledCoin !== this.state.baseCurrency;
@@ -52,6 +52,7 @@ const createApi = async seedPhrase => {
// Example: `_api.debug({method: 'portfolio'})`
window._api = api;
}

console.timeEnd('create-api');
return api;
};
@@ -142,6 +143,7 @@ class LoginContainer extends Container {
if (isDevelopment) {
window._swapDB = swapDB;
}

console.timeEnd('swap-db');

this.setActiveView('LoggingIn');
@@ -55,6 +55,7 @@ const addLifeCycleHooks = (self, lifecycleHooks) => {
if (typeof originalMethod === 'function') {
originalMethod.call(this, ...args);
}

hook.call(this, ...args);
};
}
@@ -106,6 +107,7 @@ class SuperContainer extends Container {
if (this._connectedComponent) {
throw new Error(`The container is already connected to the \`${this._connectedComponent}\` component`);
}

this._connectedComponent = component.displayName || component.name;

const self = this;
@@ -59,10 +59,10 @@ module.exports = options => {
svg.setAttribute('viewBox', `0 0 ${actualSideLength} ${actualSideLength}`);

const defs = createSvgElement('defs');
svg.appendChild(defs);
svg.append(defs);

const group = createSvgElement('g');
svg.appendChild(group);
svg.append(group);

if (typeof options.color === 'string') {
group.setAttribute('fill', options.color);
@@ -71,17 +71,17 @@ module.exports = options => {
gradient.setAttribute('id', 'gradient');
gradient.setAttribute('gradientUnits', 'userSpaceOnUse');
gradient.setAttribute('gradientTransform', `rotate(${options.color.angle})`);
defs.appendChild(gradient);
defs.append(gradient);

const stop1 = createSvgElement('stop');
stop1.setAttribute('offset', '0%');
stop1.setAttribute('style', `stop-color:${options.color.from};stop-opacity:1`);
gradient.appendChild(stop1);
gradient.append(stop1);

const stop2 = createSvgElement('stop');
stop2.setAttribute('offset', '100%');
stop2.setAttribute('style', `stop-color:${options.color.to};stop-opacity:1`);
gradient.appendChild(stop2);
gradient.append(stop2);

group.setAttribute('fill', 'url(#gradient)');
}
@@ -99,7 +99,7 @@ module.exports = options => {
rect.setAttribute('y', row * scale);
rect.setAttribute('width', scale);
rect.setAttribute('height', scale);
group.appendChild(rect);
group.append(rect);
}

if (options.outputFormat === 'dataUrl') {
@@ -161,6 +161,7 @@ class SwapDB {
if (message.requestid) {
swap.requestId = message.requestid;
}

if (message.quoteid) {
swap.quoteId = message.quoteid;
}
@@ -270,9 +271,11 @@ class SwapDB {
if (swap.error.code === -9999) {
swap.statusFormatted = t('status.unmatched').toLowerCase();
}

if (swap.error.code === -9998 || cancelled) {
swap.statusFormatted = t('status.cancelled').toLowerCase();
}

if (swap.transactions.find(tx => tx.stage === 'alicereclaim')) {
swap.statusFormatted = t('status.reverted').toLowerCase();
swap.statusInformation = t('statusInformation.reverted');
@@ -99,6 +99,7 @@ const Center = props => {
<td>{roundTo(row.maxVolume, 8)}</td>
</tr>
));
/* eslint-enable react/no-array-index-key */
})()}
</tbody>
</table>
@@ -165,6 +166,7 @@ class Bottom extends React.Component {
if (error === 'only one pending request at a time') {
error = t('order.maxOnePendingSwap', {wait: result.wait});
}

orderError(error);
return;
}
@@ -69,7 +69,7 @@
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
"@babel/preset-react": "^7.0.0",
"ava": "^1.0.1",
"ava": "^1.1.0",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.4",
"babel-plugin-module-resolver": "^3.1.1",
@@ -87,8 +87,8 @@
"electron-reloader": "^0.2.0",
"enzyme": "^3.8.0",
"enzyme-adapter-react-16": "^1.7.1",
"eslint-config-xo-react": "^0.17.0",
"eslint-plugin-react": "^7.11.1",
"eslint-config-xo-react": "^0.18.0",
"eslint-plugin-react": "^7.12.3",
"file-loader": "^2.0.0",
"node-fetch": "^2.3.0",
"node-sass": "^4.11.0",
@@ -105,7 +105,7 @@
"webpack": "4.17.3",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.10",
"xo": "^0.23.0"
"xo": "^0.24.0"
},
"ava": {
"require": [
@@ -135,7 +135,8 @@
"always-multiline"
],
"unicorn/filename-case": "off",
"import/exports-last": "error"
"import/exports-last": "error",
"react/jsx-fragments": "off"
}
},
"stylelint": {
Oops, something went wrong.

0 comments on commit cb7635f

Please sign in to comment.