From f9b7f6d4b46d7c926e6f2db63cc3658abfd488a6 Mon Sep 17 00:00:00 2001 From: Ardalan Amini Date: Sun, 24 Mar 2019 01:20:14 +0430 Subject: [PATCH] multiple lint fixes --- src/EventEmitter.ts | 5 +++-- tslint.json | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/EventEmitter.ts b/src/EventEmitter.ts index bc91ddb..88c31c0 100644 --- a/src/EventEmitter.ts +++ b/src/EventEmitter.ts @@ -15,6 +15,7 @@ function assertListener(listener: (...args: any[]) => void) { assert(typeof listener === "function", "'listener' must be a function"); } +// tslint:disable-next-line:function-name function _addListener( emitter: EventEmitter, event: string | symbol, @@ -80,7 +81,7 @@ class EventEmitter { if (!listeners) return []; const length = listeners.length; - const ret = new Array(length); + const ret = []; for (let i = 0; i < length; i++) { ret[i] = listeners[i].listener; @@ -198,7 +199,7 @@ class EventEmitter { if (index < 0) return this; - if (index === 0) listeners.shift()!; + if (index === 0) listeners.shift(); else listeners.splice(index, 1); this._listeners[event as string] = listeners; diff --git a/tslint.json b/tslint.json index e812f49..3096c0a 100644 --- a/tslint.json +++ b/tslint.json @@ -5,6 +5,7 @@ "rules": { "no-namespace": false, "no-increment-decrement": false, + "no-parameter-reassignment": false, "interface-name": false, "quotemark": [true, "double"], "variable-name": [ @@ -22,7 +23,7 @@ "static-method-regex": "^\\*?\\[?[a-zA-Z][\\w\\d\\.]*\\]?$", "function-regex": "^\\*?\\[?[a-zA-Z][\\w\\d\\.]*\\]?$" } - ], + ] }, "rulesDirectory": ["src"] }