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') @Listen('ionBackdropTap')
protected onBackdropTap() { protected onBackdropTap() {
return this.dismiss(undefined, BACKDROP); this.dismiss(undefined, BACKDROP);
} }
@Listen('ionActionSheetWillDismiss') @Listen('ionActionSheetWillDismiss')

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,9 +11,8 @@ export class NavPop {
pop() { pop() {
const nav = this.el.closest('ion-nav'); const nav = this.el.closest('ion-nav');
if (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 nav = this.el.closest('ion-nav');
const toPush = this.component; const toPush = this.component;
if (nav && toPush !== undefined) { if (nav && toPush !== undefined) {
return nav.push(toPush, this.componentProps, { skipIfBusy: true }); nav.push(toPush, this.componentProps, { skipIfBusy: true });
} }
return Promise.resolve(false);
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -314,7 +314,6 @@ export class Select {
disabled: o.disabled, disabled: o.disabled,
handler: () => { handler: () => {
this.value = o.value; this.value = o.value;
// tslint:disable-next-line:no-floating-promises
this.close(); this.close();
} }
} as SelectPopoverOption; } 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 { Mode } from '../../interface';
import { rIC } from '../../utils/helpers.js'; import { rIC } from '../../utils/helpers.js';

View File

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

View File

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

View File

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

View File

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

View File

@ -64,7 +64,6 @@ function jsSetFocus(
inputEl.focus(); inputEl.focus();
// scroll the input into place // scroll the input into place
// tslint:disable-next-line:no-floating-promises
contentEl.scrollByPoint(0, scrollData.scrollAmount, scrollData.scrollDuration).then(() => { contentEl.scrollByPoint(0, scrollData.scrollAmount, scrollData.scrollDuration).then(() => {
// the scroll view is in the correct position now // the scroll view is in the correct position now
// give the native text input focus // 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 => { doc.body.addEventListener('keyup', ev => {
if (ev.key === 'Escape') { if (ev.key === 'Escape') {
// tslint:disable-next-line:no-floating-promises
closeTopOverlay(doc); closeTopOverlay(doc);
} }
}); });
@ -48,7 +47,6 @@ export function connectListeners(doc: Document) {
if (ev.key === 'Escape') { if (ev.key === 'Escape') {
const lastOverlay = getOverlay(doc); const lastOverlay = getOverlay(doc);
if (lastOverlay && lastOverlay.backdropDismiss) { if (lastOverlay && lastOverlay.backdropDismiss) {
// tslint:disable-next-line:no-floating-promises
lastOverlay.dismiss('backdrop'); lastOverlay.dismiss('backdrop');
} }
} }

View File

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

View File

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