Merge pull request #8084 from bitjson/tslint/prefer-conditional-expression

lint: reenable tslint prefer-conditional-expression, fix
This commit is contained in:
Gustavo Maximiliano Cortez 2018-02-20 18:40:08 -03:00 committed by GitHub
commit f2fa241c0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 47 additions and 100 deletions

View File

@ -113,10 +113,10 @@ export class BackupGamePage {
};
private shouldContinue(): void {
if (this.customWords.length == this.shuffledMnemonicWords.length)
this.selectComplete = true;
else
this.selectComplete = false;
this.selectComplete =
this.customWords.length === this.shuffledMnemonicWords.length
? true
: false;
};
private showBackupResult(): void {

View File

@ -421,13 +421,9 @@ export class BitPayCardTopUpPage {
}
private openFinishModal(): void {
let finishComment: string;
if (this.wallet.credentials.m == 1) {
finishComment = this.translate.instant('Funds were added to debit card');
}
else {
finishComment = this.translate.instant('Transaction initiated');
}
const finishComment = this.wallet.credentials.m === 1
? this.translate.instant('Funds were added to debit card')
: this.translate.instant('Transaction initiated');
let finishText = '';
let modal = this.modalCtrl.create(FinishModalPage, { finishText, finishComment }, { showBackdrop: true, enableBackdropDismiss: false });
modal.present();

View File

@ -45,10 +45,9 @@ export class MercadoLibreCardDetailsPage {
}
public openRedeemLink() {
let url;
let isSandbox = this.mercadoLibreProvider.getNetwork() == 'testnet' ? true : false;
if (isSandbox) url = 'https://beta.mercadolivre.com.br/vale-presente/resgate';
else url = 'https://www.mercadolivre.com.br/vale-presente/resgate';
const url = this.mercadoLibreProvider.getNetwork() === 'testnet'
? 'https://beta.mercadolivre.com.br/vale-presente/resgate'
: 'https://www.mercadolivre.com.br/vale-presente/resgate';
this.openExternalLink(url);
}

View File

@ -355,11 +355,7 @@ export class AmountPage {
if (a) {
this.alternativeAmount = this.txFormatProvider.formatAmount(a * this.unitToSatoshi, true);
} else {
if (result) {
this.alternativeAmount = 'N/A';
} else {
this.alternativeAmount = null;
}
this.alternativeAmount = result ? 'N/A' : null;
this.allowSend = false;
}
} else {
@ -426,13 +422,9 @@ export class AmountPage {
};
} else {
let amount = _amount;
if (unit.isFiat) {
amount = (this.fromFiat(amount) * this.unitToSatoshi).toFixed(0);
} else {
amount = (amount * this.unitToSatoshi).toFixed(0);
}
amount = unit.isFiat
? (this.fromFiat(amount) * this.unitToSatoshi).toFixed(0)
: (amount * this.unitToSatoshi).toFixed(0);
data = {
recipientType: this.recipientType,
amount,

View File

@ -131,16 +131,11 @@ export class ChooseFeeLevelPage {
public checkFees(feePerSatByte: string): void {
let fee = Number(feePerSatByte);
if (fee <= this.minFeeAllowed) this.showError = true;
else this.showError = false;
if (fee > this.minFeeAllowed && fee < this.minFeeRecommended) this.showMinWarning = true;
else this.showMinWarning = false;
if (fee < this.maxFeeAllowed && fee > this.maxFeeRecommended) this.showMaxWarning = true;
else this.showMaxWarning = false;
this.showError = fee <= this.minFeeAllowed ? true : false;
this.showMinWarning =
fee > this.minFeeAllowed && fee < this.minFeeRecommended ? true : false;
this.showMaxWarning =
fee < this.maxFeeAllowed && fee > this.maxFeeRecommended ? true : false;
}
public ok(): void {

View File

@ -40,12 +40,8 @@ export class AddressbookViewPage {
this.name = this.navParams.data.contact.name;
this.email = this.navParams.data.contact.email;
var cashAddress = this.bitcoreCash.Address.isValid(this.address, 'livenet');
if (cashAddress) {
this.coin = 'bch';
} else {
this.coin = 'btc';
}
const cashAddress = this.bitcoreCash.Address.isValid(this.address, 'livenet');
this.coin = cashAddress ? 'bch' : 'btc';
}
ionViewDidLoad() {

View File

@ -65,11 +65,9 @@ export class TxDetailsPage {
this.txsUnsubscribedForNotifications = this.config.confirmedTxsNotifications ? !this.config.confirmedTxsNotifications.enabled : true;
let defaults = this.configProvider.getDefaults();
if (this.wallet.coin == 'bch') {
this.blockexplorerUrl = defaults.blockExplorerUrl.bch;
} else {
this.blockexplorerUrl = defaults.blockExplorerUrl.btc;
}
this.blockexplorerUrl = this.wallet.coin === 'bch'
? defaults.blockExplorerUrl.bch
: defaults.blockExplorerUrl.btc;
this.txConfirmNotificationProvider.checkIfEnabled(this.txId).then((res: any) => {
this.txNotification = {

View File

@ -122,11 +122,7 @@ export class WalletDetailsPage {
// };
// lodash.times(15, addOutput);
// txps.push(txp);
if (!txps) {
this.txps = [];
} else {
this.txps = _.sortBy(txps, 'createdOn').reverse();
}
this.txps = !txps ? [] : _.sortBy(txps, 'createdOn').reverse();
}
private updateTxHistory() {
@ -146,8 +142,7 @@ export class WalletDetailsPage {
this.updatingTxHistory = false;
let hasTx = txHistory[0];
if (hasTx) this.showNoTransactionsYetMsg = false;
else this.showNoTransactionsYetMsg = true;
this.showNoTransactionsYetMsg = hasTx ? false : true;
this.wallet.completeHistory = txHistory;
this.showHistory();

View File

@ -28,12 +28,9 @@ export class AmazonProvider {
* Production: 'livenet'
*/
this.credentials.NETWORK = 'livenet';
// TODO this.credentials.NETWORK = 'testnet';
if (this.credentials.NETWORK == 'testnet') {
this.credentials.BITPAY_API_URL = "https://test.bitpay.com";
} else {
this.credentials.BITPAY_API_URL = "https://bitpay.com";
};
this.credentials.BITPAY_API_URL = this.credentials.NETWORK === 'testnet'
? "https://test.bitpay.com"
: "https://bitpay.com";
this.limitPerDay = 2000;
this.homeItem = {
name: 'amazon',

View File

@ -12,15 +12,9 @@ export class BwcErrorProvider {
if (!err)
return 'Unknown error';
let name;
if (err.name) {
if (err.name == 'Error')
name = err.message
else
name = err.name.replace(/^bwc.Error/g, '');
} else
name = err;
const name = err.name ?
(err.name === 'Error' ? err.message : err.name.replace(/^bwc.Error/g, ''))
: err;
let body = '';
prefix = prefix || '';

View File

@ -100,11 +100,9 @@ export class CoinbaseProvider {
'wallet:payment-methods:read';
// NW has a bug with Window Object
if (this.isCordova) {
this.credentials.REDIRECT_URI = coinbase.redirect_uri.mobile;
} else {
this.credentials.REDIRECT_URI = coinbase.redirect_uri.desktop;
}
this.credentials.REDIRECT_URI = this.isCordova
? coinbase.redirect_uri.mobile
: coinbase.redirect_uri.desktop;
if (this.credentials.NETWORK == 'testnet') {
this.credentials.HOST = coinbase.sandbox.host;

View File

@ -61,10 +61,8 @@ export class LanguageProvider {
if (!_.isEmpty(lang)) this.current = lang;
else {
// Get from browser
let browserLang = this.translate.getBrowserLang();
let validBrowserLang = this.getName(browserLang) ? true : false;
if (validBrowserLang) this.current = browserLang;
else this.current = this.getDefault();
const browserLang = this.translate.getBrowserLang();
this.current = this.getName(browserLang) ? browserLang : this.getDefault();
}
this.logger.info('Default language: ' + this.current);
this.translate.setDefaultLang(this.current);

View File

@ -92,8 +92,7 @@ export class Logger {
if (typeof v == 'undefined') v = 'undefined';
if (!v) v = 'null';
if (typeof v == 'object') {
if (v.message) v = v.message;
else v = JSON.stringify(v);
v = v.message ? v.message : JSON.stringify(v);
}
} catch (e) {
// tslint:disable-next-line:no-console

View File

@ -36,12 +36,9 @@ export class MercadoLibreProvider {
*/
this.credentials = {};
this.credentials.NETWORK = 'livenet';
// TODO this.credentials.NETWORK = 'testnet';
if (this.credentials.NETWORK == 'testnet') {
this.credentials.BITPAY_API_URL = "https://test.bitpay.com";
} else {
this.credentials.BITPAY_API_URL = "https://bitpay.com";
}
this.credentials.BITPAY_API_URL = this.credentials.NETWORK === 'testnet'
? "https://test.bitpay.com"
: "https://bitpay.com";
this.homeItem = {
name: 'mercadoLibre',

View File

@ -58,11 +58,9 @@ export class PersistenceProvider {
};
public load() {
if (this.platform.isCordova) {
this.storage = new FileStorage(this.file, this.logger);
} else {
this.storage = new LocalStorage();
}
this.storage = this.platform.isCordova
? new FileStorage(this.file, this.logger)
: new LocalStorage();
}
storeNewProfile(profile): Promise<void> {

View File

@ -34,14 +34,10 @@ export class ShapeshiftProvider {
* Production: 'livenet'
*/
this.credentials.NETWORK = 'livenet';
// TODO this.credentials.NETWORK = 'testnet';
if (this.credentials.NETWORK == 'testnet') {
this.credentials.API_URL = "";
} else {
this.credentials.API_URL = this.credentials.NETWORK === 'testnet'
? ""
// CORS: cors.shapeshift.io
this.credentials.API_URL = "https://shapeshift.io";
}
: "https://shapeshift.io";
this.homeItem = {
name: 'shapeshift',

View File

@ -21,7 +21,6 @@
"no-implicit-dependencies": false,
"object-literal-sort-keys": false,
"interface-name": false,
"prefer-conditional-expression": false,
"prefer-for-of": false,
"forin": false,
"prefer-const": false,