fix(all): updated tslint rules to latest

This commit is contained in:
Manu Mtz.-Almeida
2018-07-29 13:03:47 +02:00
parent d1969bdf1d
commit 92e21a8cf3
112 changed files with 546 additions and 574 deletions

View File

@ -5,9 +5,9 @@ export interface AnimationController {
export interface Animation {
new (): any;
parent: Animation|undefined;
parent: Animation | undefined;
hasChildren: boolean;
addElement(el: Node|Node[]|NodeList): Animation;
addElement(el: Node | Node[] | NodeList): Animation;
add(childAnimation: Animation): Animation;
duration(milliseconds: number): Animation;
easing(name: string): Animation;
@ -21,8 +21,8 @@ export interface Animation {
beforeRemoveClass(className: string): Animation;
beforeStyles(styles: { [property: string]: any; }): Animation;
beforeClearStyles(propertyNames: string[]): Animation;
beforeAddRead(domReadFn: Function): Animation;
beforeAddWrite(domWriteFn: Function): Animation;
beforeAddRead(domReadFn: () => void): Animation;
beforeAddWrite(domWriteFn: () => void): Animation;
duringAddClass(className: string): Animation;
afterAddClass(className: string): Animation;
afterRemoveClass(className: string): Animation;
@ -43,9 +43,7 @@ export interface Animation {
}
export interface AnimationBuilder {
(Animation: Animation, baseEl: HTMLElement, opts?: any): Promise<Animation>;
}
export type AnimationBuilder = (Animation: Animation, baseEl: HTMLElement, opts?: any) => Promise<Animation>;
export interface PlayOptions {
duration?: number;

View File

@ -23,7 +23,7 @@ export const TRANSFORM_PROPS: {[key: string]: number} = {
'perspective': 1
};
const raf = window.requestAnimationFrame || ((f: Function) => f());
const raf = window.requestAnimationFrame || ((f: FrameRequestCallback) => f(Date.now()));
export class Animator {
@ -42,21 +42,21 @@ export class Animator {
private _hasTweenEffect = false;
private _isAsync = false;
private _isReverse = false;
private _onFinishCallbacks?: Function[];
private _onFinishOneTimeCallbacks?: Function[];
private _readCallbacks?: Function[];
private _onFinishCallbacks?: ((a: Animator) => void)[];
private _onFinishOneTimeCallbacks?: ((a: Animator) => void)[];
private _readCallbacks?: (() => void)[];
private _reversedEasingName?: string;
private _timerId?: any;
private _unregisterTrnsEnd?: Function;
private _writeCallbacks?: Function[];
private _unregisterTrnsEnd?: (() => void);
private _writeCallbacks?: (() => void)[];
private _destroyed = false;
parent: Animator|undefined;
parent: Animator | undefined;
hasChildren = false;
isPlaying = false;
hasCompleted = false;
addElement(el: Node|Node[]|NodeList): Animator {
addElement(el: Node | Node[] | NodeList): Animator {
if (el) {
if ((el as NodeList).length) {
for (let i = 0; i < (el as NodeList).length; i++) {
@ -123,7 +123,7 @@ export class Animator {
* Get the easing of this animation. If this animation does
* not have an easing, then it'll get the easing from its parent.
*/
getEasing(): string|null {
getEasing(): string | null {
if (this._isReverse && this._reversedEasingName) {
return this._reversedEasingName;
}
@ -205,7 +205,7 @@ export class Animator {
// add from/to EffectState to the EffectProperty
const fxState: EffectState = {
val: val,
val,
num: 0,
effectUnit: '',
};
@ -280,7 +280,7 @@ export class Animator {
* Add a function which contains DOM reads, which will run
* before the animation begins.
*/
beforeAddRead(domReadFn: Function): Animator {
beforeAddRead(domReadFn: () => void): Animator {
(this._readCallbacks = this._readCallbacks || []).push(domReadFn);
return this;
}
@ -289,7 +289,7 @@ export class Animator {
* Add a function which contains DOM writes, which will run
* before the animation begins.
*/
beforeAddWrite(domWriteFn: Function): Animator {
beforeAddWrite(domWriteFn: () => void): Animator {
(this._writeCallbacks = this._writeCallbacks || []).push(domWriteFn);
return this;
}
@ -372,7 +372,7 @@ export class Animator {
playAsync(opts?: PlayOptions): Promise<Animator> {
return new Promise(resolve => {
this.onFinish(resolve, {oneTimeCallback: true, clearExistingCallacks: true });
this.onFinish(resolve, { oneTimeCallback: true, clearExistingCallacks: true });
this.play(opts);
return this;
});
@ -393,7 +393,7 @@ export class Animator {
* DOM WRITE
* RECURSION
*/
private _playInit(opts: PlayOptions|undefined) {
private _playInit(opts: PlayOptions | undefined) {
// always default that an animation does not tween
// a tween requires that an Animation class has an element
// and that it has at least one FROM/TO effect
@ -427,7 +427,7 @@ export class Animator {
* NO RECURSION
* ROOT ANIMATION
*/
_playDomInspect(opts: PlayOptions|undefined) {
_playDomInspect(opts: PlayOptions | undefined) {
const self = this;
// fire off all the "before" function that have DOM READS in them
// elements will be in the DOM, however visibily hidden
@ -460,7 +460,7 @@ export class Animator {
* DOM WRITE
* RECURSION
*/
_playProgress(opts: PlayOptions|undefined) {
_playProgress(opts: PlayOptions | undefined) {
const children = this._childAnimations;
if (children) {
for (let i = 0; i < children.length; i++) {
@ -598,7 +598,7 @@ export class Animator {
* NO DOM
* RECURSION
*/
_hasDuration(opts: PlayOptions|undefined) {
_hasDuration(opts: PlayOptions | undefined) {
if (this.getDuration(opts) > DURATION_MIN) {
return true;
}
@ -1257,7 +1257,7 @@ export class Animator {
/**
* NO DOM
*/
_transEl(): HTMLElement|null {
_transEl(): HTMLElement | null {
// get the lowest level element that has an Animator
const children = this._childAnimations;
if (children) {

View File

@ -1,4 +1,5 @@
// tslint:disable-next-line:only-arrow-functions
export const CSS_PROP = function(docEle: HTMLElement) {
// transform
const transformProp = [

View File

@ -1,7 +1,7 @@
export function transitionEnd(el: HTMLElement|null, callback: {(ev?: TransitionEvent): void}) {
let unRegTrans: Function;
export function transitionEnd(el: HTMLElement | null, callback: (ev?: TransitionEvent) => void) {
let unRegTrans: () => void;
const opts: any = { passive: true };
function unregister() {
@ -19,7 +19,7 @@ export function transitionEnd(el: HTMLElement|null, callback: {(ev?: TransitionE
el.addEventListener('webkitTransitionEnd', onTransitionEnd, opts);
el.addEventListener('transitionend', onTransitionEnd, opts);
unRegTrans = function() {
unRegTrans = () => {
el.removeEventListener('webkitTransitionEnd', onTransitionEnd, opts);
el.removeEventListener('transitionend', onTransitionEnd, opts);
};