chore(tslint): disable 'no-floating-promises'

This commit is contained in:
Manu Mtz.-Almeida
2018-09-14 00:50:44 +02:00
parent 127da1ac79
commit 6e5c035b39
26 changed files with 18 additions and 45 deletions

View File

@ -125,7 +125,7 @@ export class ActionSheet implements OverlayInterface {
@Listen('ionBackdropTap')
protected onBackdropTap() {
return this.dismiss(undefined, BACKDROP);
this.dismiss(undefined, BACKDROP);
}
@Listen('ionActionSheetWillDismiss')

View File

@ -181,7 +181,7 @@ export class Alert implements OverlayInterface {
@Listen('ionBackdropTap')
protected onBackdropTap() {
return this.dismiss(undefined, BACKDROP);
this.dismiss(undefined, BACKDROP);
}
@Listen('ionAlertWillDismiss')

View File

@ -36,27 +36,23 @@ export class App {
function importHardwareBackButton(win: Window) {
if (isPlatform(win, 'hybrid')) {
// tslint:disable-next-line:no-floating-promises
import('../../utils/hardware-back-button').then(module => module.startHardwareBackButton(win));
}
}
function importStatusTap(win: Window, queue: QueueApi) {
if (isPlatform(win, 'hybrid')) {
// tslint:disable-next-line:no-floating-promises
import('../../utils/status-tap').then(module => module.startStatusTap(win, queue));
}
}
function importTapClick(win: Window) {
// tslint:disable-next-line:no-floating-promises
import('../../utils/tap-click').then(module => module.startTapClick(win.document));
}
function importInputShims(win: Window, config: Config) {
const inputShims = config.getBoolean('inputShims', needInputShims(win));
if (inputShims) {
// tslint:disable-next-line:no-floating-promises
import('../../utils/input-shims/input-shims').then(module => module.startInputShims(win.document, config));
}
}

View File

@ -126,7 +126,6 @@ export class ItemSliding {
@Method()
async closeOpened(): Promise<boolean> {
if (openSlidingItem !== undefined) {
// tslint:disable-next-line:no-floating-promises
openSlidingItem.close();
return true;
}
@ -159,7 +158,6 @@ export class ItemSliding {
private canStart(): boolean {
const selected = openSlidingItem;
if (selected && selected !== this.el) {
// tslint:disable-next-line:no-floating-promises
this.closeOpened();
return false;
}

View File

@ -137,7 +137,7 @@ export class Loading implements OverlayInterface {
@Listen('ionBackdropTap')
protected onBackdropTap() {
return this.dismiss(undefined, BACKDROP);
this.dismiss(undefined, BACKDROP);
}
/**

View File

@ -39,10 +39,9 @@ export class MenuToggle {
if (menuCtrl) {
const menu = await menuCtrl.get(this.menu);
if (menu) {
return menuCtrl.toggle(this.menu);
menuCtrl.toggle(this.menu);
}
}
return false;
}
@Listen('body:ionMenuChange')

View File

@ -223,10 +223,9 @@ export class Menu implements MenuI {
if (shouldClose) {
ev.preventDefault();
ev.stopPropagation();
return this.close();
this.close();
}
}
return Promise.resolve(false);
}
@Method()

View File

@ -127,12 +127,12 @@ export class Modal implements OverlayInterface {
ev.stopPropagation();
ev.preventDefault();
return this.dismiss();
this.dismiss();
}
@Listen('ionBackdropTap')
protected onBackdropTap() {
return this.dismiss(undefined, BACKDROP);
this.dismiss(undefined, BACKDROP);
}
@Listen('ionModalDidPresent')

View File

@ -11,9 +11,8 @@ export class NavPop {
pop() {
const nav = this.el.closest('ion-nav');
if (nav) {
return nav.pop({ skipIfBusy: true });
nav.pop({ skipIfBusy: true });
}
return Promise.resolve(false);
}
}

View File

@ -23,8 +23,7 @@ export class NavPush {
const nav = this.el.closest('ion-nav');
const toPush = this.component;
if (nav && toPush !== undefined) {
return nav.push(toPush, this.componentProps, { skipIfBusy: true });
}
return Promise.resolve(false);
nav.push(toPush, this.componentProps, { skipIfBusy: true });
}
}
}

View File

@ -24,8 +24,7 @@ export class NavSetRoot {
const nav = this.el.closest('ion-nav');
const toPush = this.component;
if (nav && toPush !== undefined) {
return nav.setRoot(toPush, this.componentProps, { skipIfBusy: true });
}
return Promise.resolve(false);
nav.setRoot(toPush, this.componentProps, { skipIfBusy: true });
}
}
}

View File

@ -68,7 +68,6 @@ export class Nav implements NavOutlet {
const isDev = Build.isDev;
if (this.root !== undefined) {
if (!this.useRouter) {
// tslint:disable-next-line:no-floating-promises
this.setRoot(this.root, this.rootParams);
} else if (isDev) {
console.warn(
@ -508,8 +507,6 @@ export class Nav implements NavOutlet {
const router = this.win.document.querySelector('ion-router');
if (router) {
const direction = result.direction === 'back' ? -1 : 1;
// tslint:disable-next-line:no-floating-promises
router.navChanged(direction);
}
}
@ -549,7 +546,6 @@ export class Nav implements NavOutlet {
return false;
}
// tslint:disable-next-line:no-floating-promises
this.runTransition(ti);
return true;
}
@ -915,7 +911,6 @@ export class Nav implements NavOutlet {
progressAnimation: true
};
// tslint:disable-next-line:no-floating-promises
this.queueTrns(
{
removeStart: -1,

View File

@ -42,7 +42,6 @@ export class ViewController {
const element = this.element;
if (element) {
if (this.delegate) {
// tslint:disable-next-line:no-floating-promises
this.delegate.removeViewFromDom(element.parentElement, element);
} else {
element.remove();

View File

@ -127,9 +127,9 @@ export class Picker implements OverlayInterface {
protected onBackdropTap() {
const cancelBtn = this.buttons.find(b => b.role === 'cancel');
if (cancelBtn) {
return this.buttonClick(cancelBtn);
this.buttonClick(cancelBtn);
} else {
return this.dismiss();
this.dismiss();
}
}

View File

@ -137,12 +137,12 @@ export class Popover implements OverlayInterface {
ev.stopPropagation();
ev.preventDefault();
return this.dismiss();
this.dismiss();
}
@Listen('ionBackdropTap')
protected onBackdropTap() {
return this.dismiss(undefined, BACKDROP);
this.dismiss(undefined, BACKDROP);
}
@Listen('ionPopoverDidPresent')

View File

@ -146,7 +146,6 @@ export class Router {
private onRedirectChanged() {
const path = this.getPath();
if (path && routeRedirect(path, readRedirects(this.el))) {
// tslint:disable-next-line:no-floating-promises
this.writeNavStateRoot(path, RouterIntent.None);
}
}

View File

@ -314,7 +314,6 @@ export class Select {
disabled: o.disabled,
handler: () => {
this.value = o.value;
// tslint:disable-next-line:no-floating-promises
this.close();
}
} as SelectPopoverOption;

View File

@ -1,4 +1,4 @@
import { Component, Element, Event, EventEmitter, Method, Prop, Watch, Listen } from '@stencil/core';
import { Component, Element, Event, EventEmitter, Listen, Method, Prop, Watch } from '@stencil/core';
import { Mode } from '../../interface';
import { rIC } from '../../utils/helpers.js';

View File

@ -123,11 +123,10 @@ export class Tabs implements NavOutlet {
if (this.useRouter && href !== undefined) {
const router = this.doc.querySelector('ion-router');
if (router) {
return router.push(href);
router.push(href);
}
return Promise.resolve(false);
} else {
return this.select(selectedTab);
this.select(selectedTab);
}
}

View File

@ -281,7 +281,6 @@ export class VirtualScroll {
}
};
if (node && node.componentOnReady) {
// tslint:disable-next-line:no-floating-promises
node.componentOnReady().then(update);
} else {
update();

View File

@ -147,7 +147,6 @@ export function createGesture(config: GestureConfig): Gesture {
detail.startTimeStamp = detail.timeStamp;
if (onWillStart) {
// tslint:disable-next-line:no-floating-promises
onWillStart(detail).then(fireOnStart);
} else {
fireOnStart();

View File

@ -36,7 +36,6 @@ export function startHardwareBackButton(win: Window) {
});
const result = handler!();
if (result != null) {
// tslint:disable-next-line:no-floating-promises
result.then(() => busy = false);
}
}

View File

@ -64,7 +64,6 @@ function jsSetFocus(
inputEl.focus();
// scroll the input into place
// tslint:disable-next-line:no-floating-promises
contentEl.scrollByPoint(0, scrollData.scrollAmount, scrollData.scrollDuration).then(() => {
// the scroll view is in the correct position now
// give the native text input focus

View File

@ -25,7 +25,6 @@ export function createOverlay<T extends HTMLIonOverlayElement>(element: T, opts:
doc.body.addEventListener('keyup', ev => {
if (ev.key === 'Escape') {
// tslint:disable-next-line:no-floating-promises
closeTopOverlay(doc);
}
});
@ -48,7 +47,6 @@ export function connectListeners(doc: Document) {
if (ev.key === 'Escape') {
const lastOverlay = getOverlay(doc);
if (lastOverlay && lastOverlay.backdropDismiss) {
// tslint:disable-next-line:no-floating-promises
lastOverlay.dismiss('backdrop');
}
}

View File

@ -11,7 +11,6 @@ export function startStatusTap(win: Window, queue: QueueApi) {
}
const contentEl = el.closest('ion-content');
if (contentEl) {
// tslint:disable-next-line:no-floating-promises
contentEl.componentOnReady().then(() => {
queue.write(() => contentEl.scrollToTop(300));
});

View File

@ -15,7 +15,7 @@
"no-null-keyword": false,
"no-console": false,
"no-unbound-method": true,
"no-floating-promises": true,
"no-floating-promises": false,
"jsx-key": false,
"jsx-self-close": false,