lint(eslint): migrate to eslint and prettier (#25046)

This commit is contained in:
Liam DeBeasi
2022-04-04 11:12:53 -04:00
committed by GitHub
parent 12fd19dd4d
commit 5676bab316
826 changed files with 56539 additions and 52754 deletions

View File

@ -1,14 +1,14 @@
import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Method, Prop, State, Watch, h, readTask, writeTask } from '@stencil/core';
import type { ComponentInterface, EventEmitter } from '@stencil/core';
import { Component, Element, Event, Host, Method, Prop, State, Watch, h, readTask, writeTask } from '@stencil/core';
import { getIonMode } from '../../global/ionic-global';
import { componentOnReady } from '../../utils/helpers';
@Component({
tag: 'ion-infinite-scroll',
styleUrl: 'infinite-scroll.scss'
styleUrl: 'infinite-scroll.scss',
})
export class InfiniteScroll implements ComponentInterface {
private thrPx = 0;
private thrPc = 0;
private scrollEl?: HTMLElement;
@ -34,8 +34,7 @@ export class InfiniteScroll implements ComponentInterface {
const val = this.threshold;
if (val.lastIndexOf('%') > -1) {
this.thrPx = 0;
this.thrPc = (parseFloat(val) / 100);
this.thrPc = parseFloat(val) / 100;
} else {
this.thrPx = parseFloat(val);
this.thrPc = 0;
@ -83,7 +82,7 @@ export class InfiniteScroll implements ComponentInterface {
console.error('<ion-infinite-scroll> must be used inside an <ion-content>');
return;
}
await new Promise(resolve => componentOnReady(contentEl, resolve));
await new Promise((resolve) => componentOnReady(contentEl, resolve));
this.scrollEl = await contentEl.getScrollElement();
this.thresholdChanged();
this.disabledChanged();
@ -115,11 +114,12 @@ export class InfiniteScroll implements ComponentInterface {
const scrollTop = scrollEl.scrollTop;
const scrollHeight = scrollEl.scrollHeight;
const height = scrollEl.offsetHeight;
const threshold = this.thrPc !== 0 ? (height * this.thrPc) : this.thrPx;
const threshold = this.thrPc !== 0 ? height * this.thrPc : this.thrPx;
const distanceFromInfinite = (this.position === 'bottom')
? scrollHeight - infiniteHeight - scrollTop - threshold - height
: scrollTop - infiniteHeight - threshold;
const distanceFromInfinite =
this.position === 'bottom'
? scrollHeight - infiniteHeight - scrollTop - threshold - height
: scrollTop - infiniteHeight - threshold;
if (distanceFromInfinite < 0) {
if (!this.didFire) {
@ -133,7 +133,7 @@ export class InfiniteScroll implements ComponentInterface {
}
return 4;
}
};
/**
* Call `complete()` within the `ionInfinite` output event handler when
@ -199,12 +199,7 @@ export class InfiniteScroll implements ComponentInterface {
}
private canStart(): boolean {
return (
!this.disabled &&
!this.isBusy &&
!!this.scrollEl &&
!this.isLoading
);
return !this.disabled && !this.isBusy && !!this.scrollEl && !this.isLoading;
}
private enableScrollEvents(shouldListen: boolean) {
@ -225,7 +220,7 @@ export class InfiniteScroll implements ComponentInterface {
class={{
[mode]: true,
'infinite-scroll-loading': this.isLoading,
'infinite-scroll-enabled': !disabled
'infinite-scroll-enabled': !disabled,
}}
/>
);