Add no-floating-promises ignore comments

This commit is contained in:
fragosti
2018-07-11 16:50:00 -07:00
parent 1ee78062d7
commit 0941e0a929
12 changed files with 24 additions and 5 deletions

View File

@@ -508,6 +508,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
}
private _trackOrderEvent(eventName: string): void {
const parsedOrder = this.state.parsedOrder;
// tslint:disable-next-line:no-floating-promises
analytics.trackOrderEventAsync(eventName, parsedOrder);
}
private async _onFillOrderClickFireAndForgetAsync(): Promise<void> {

View File

@@ -114,6 +114,7 @@ export class SubscribeForm extends React.Component<SubscribeFormProps, Subscribe
const response = await backendClient.subscribeToNewsletterAsync(this.state.emailText);
const status = response.status === 200 ? SubscribeFormStatus.Success : SubscribeFormStatus.Error;
if (status === SubscribeFormStatus.Success) {
// tslint:disable-next-line:no-floating-promises
analytics.indentifyAsync(this.state.emailText, 'email');
}
this.setState({ status, emailText: '' });

View File

@@ -268,6 +268,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
const signedOrder = await this._signTransactionAsync();
const doesSignedOrderExist = !_.isUndefined(signedOrder);
if (doesSignedOrderExist) {
// tslint:disable-next-line:no-floating-promises
analytics.trackOrderEventAsync('Sign Order Success', signedOrder);
this.setState({
globalErrMsg: '',
@@ -281,6 +282,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
globalErrMsg = 'You must enable wallet communication';
this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen(true);
}
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Sign Order Failure', {
makerTokenAmount: debitToken.amount.toString(),
makerToken: this.props.tokenByAddress[debitToken.address].symbol,

View File

@@ -117,9 +117,11 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow
};
try {
await this.props.blockchain.setProxyAllowanceAsync(this.props.token, newAllowanceAmountInBaseUnits);
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Set Allowances Success', logData);
await this.props.refetchTokenStateAsync();
} catch (err) {
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Set Allowance Failure', logData);
this.setState({
isSpinnerVisible: false,

View File

@@ -224,6 +224,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
(this.props.stepIndex === 0 && !this.props.isRunning && this.props.blockchainIsLoaded) ||
(!this.props.isRunning && !this.props.hasBeenClosed && this.props.blockchainIsLoaded)
) {
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Onboarding Started', {
reason: 'automatic',
stepIndex: this.props.stepIndex,
@@ -236,6 +237,7 @@ class PlainPortalOnboardingFlow extends React.Component<PortalOnboardingFlowProp
}
private _closeOnboarding(): void {
this.props.updateIsRunning(false);
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('OnboardingClosed', {
stepIndex: this.props.stepIndex,
});

View File

@@ -389,6 +389,7 @@ export class Portal extends React.Component<PortalProps, PortalState> {
);
}
private _startOnboarding(): void {
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Onboarding Started', {
reason: 'manual',
stepIndex: this.props.portalOnboardingStep,

View File

@@ -65,6 +65,7 @@ export const RelayerGridTile: React.StatelessComponent<RelayerGridTileProps> = (
const topTokens = props.relayerInfo.topTokens;
const weeklyTxnVolume = props.relayerInfo.weeklyTxnVolume;
const onClick = () => {
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Relayer Click', {
name: props.relayerInfo.name,
});

View File

@@ -1,8 +1,4 @@
import {
colors,
EtherscanLinkSuffixes,
utils as sharedUtils,
} from '@0xproject/react-shared';
import { colors, EtherscanLinkSuffixes, utils as sharedUtils } from '@0xproject/react-shared';
import * as _ from 'lodash';
import * as React from 'react';
@@ -47,6 +43,7 @@ class TokenLink extends React.Component<TokenLinkProps, TokenLinkState> {
public render(): React.ReactNode {
const onClick = (event: React.MouseEvent<HTMLElement>) => {
event.stopPropagation();
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Token Click', {
tokenSymbol: this.props.tokenInfo.symbol,
});

View File

@@ -490,6 +490,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
private _openWrappedEtherActionRow(wrappedEtherDirection: Side): void {
const action =
wrappedEtherDirection === Side.Deposit ? 'Wallet - Wrap ETH Opened' : 'Wallet - Unwrap WETH Opened';
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync(action);
this.setState({
wrappedEtherDirection,
@@ -498,6 +499,7 @@ export class Wallet extends React.Component<WalletProps, WalletState> {
private _closeWrappedEtherActionRow(wrappedEtherDirection: Side): void {
const action =
wrappedEtherDirection === Side.Deposit ? 'Wallet - Wrap ETH Closed' : 'Wallet - Unwrap WETH Closed';
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync(action);
this.setState({
wrappedEtherDirection: undefined,

View File

@@ -196,12 +196,14 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther
if (this.props.direction === Side.Deposit) {
await this.props.blockchain.convertEthToWrappedEthTokensAsync(etherToken.address, amountToConvert);
this.props.dispatcher.showFlashMessage(`Successfully wrapped ${ethAmount} ETH to WETH`);
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Wrap ETH Success', {
amount: ethAmount,
});
} else {
await this.props.blockchain.convertWrappedEthTokensToEthAsync(etherToken.address, amountToConvert);
this.props.dispatcher.showFlashMessage(`Successfully unwrapped ${tokenAmount} WETH to ETH`);
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Unwrap WETH Success', {
amount: tokenAmount,
});
@@ -217,11 +219,13 @@ export class WrapEtherItem extends React.Component<WrapEtherItemProps, WrapEther
logUtils.log(err.stack);
if (this.props.direction === Side.Deposit) {
this.props.dispatcher.showFlashMessage('Failed to wrap your ETH. Please try again.');
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Wrap ETH Failure', {
amount: ethAmount,
});
} else {
this.props.dispatcher.showFlashMessage('Failed to unwrap your WETH. Please try again.');
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Unwrap WETH Failed', {
amount: tokenAmount,
});

View File

@@ -8,28 +8,33 @@ export const analyticsMiddleware: Middleware = store => next => action => {
const nextState = (store.getState() as any) as State;
switch (action.type) {
case ActionTypes.UpdateInjectedProviderName:
// tslint:disable-next-line:no-floating-promises
analytics.addEventPropertiesAsync({
injectedProviderName: nextState.injectedProviderName,
});
break;
case ActionTypes.UpdateNetworkId:
// tslint:disable-next-line:no-floating-promises
analytics.addEventPropertiesAsync({
networkId: nextState.networkId,
});
break;
case ActionTypes.UpdateUserAddress:
// tslint:disable-next-line:no-floating-promises
analytics.addUserPropertiesAsync({
ethAddress: nextState.userAddress,
});
break;
case ActionTypes.UpdateUserEtherBalance:
if (nextState.userEtherBalanceInWei) {
// tslint:disable-next-line:no-floating-promises
analytics.addUserPropertiesAsync({
ethBalance: nextState.userEtherBalanceInWei.toString(),
});
}
break;
case ActionTypes.UpdatePortalOnboardingStep:
// tslint:disable-next-line:no-floating-promises
analytics.trackAsync('Update Onboarding Step', {
stepIndex: nextState.portalOnboardingStep,
});

View File

@@ -66,6 +66,7 @@ export class Analytics {
takerToken: order.metadata.takerToken.symbol,
makerToken: order.metadata.makerToken.symbol,
};
// tslint:disable-next-line:no-floating-promises
this.trackAsync(eventName, orderLoggingData);
}
/**