chore: fix leftover eslint exceptions

This commit is contained in:
iCrawl
2022-09-01 21:26:09 +02:00
parent edadb9fe5d
commit 3b7ba4062e
80 changed files with 141 additions and 337 deletions

View File

@@ -85,12 +85,10 @@ export class Collection<K, V> extends Map<K, V> {
public first(): V | undefined;
public first(amount: number): V[];
public first(amount?: number): V | V[] | undefined {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
if (typeof amount === 'undefined') return this.values().next().value;
if (amount < 0) return this.last(amount * -1);
amount = Math.min(this.size, amount);
const iter = this.values();
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Array.from({ length: amount }, (): V => iter.next().value);
}
@@ -104,12 +102,10 @@ export class Collection<K, V> extends Map<K, V> {
public firstKey(): K | undefined;
public firstKey(amount: number): K[];
public firstKey(amount?: number): K | K[] | undefined {
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
if (typeof amount === 'undefined') return this.keys().next().value;
if (amount < 0) return this.lastKey(amount * -1);
amount = Math.min(this.size, amount);
const iter = this.keys();
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
return Array.from({ length: amount }, (): K => iter.next().value);
}
@@ -426,9 +422,7 @@ export class Collection<K, V> extends Map<K, V> {
if (typeof thisArg !== 'undefined') fn = fn.bind(thisArg);
const iter = this.entries();
return Array.from({ length: this.size }, (): T => {
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const [key, value] = iter.next().value;
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
return fn(value, key, this);
});
}
@@ -636,7 +630,6 @@ export class Collection<K, V> extends Map<K, V> {
* @returns Whether the collections have identical contents
*/
public equals(collection: ReadonlyCollection<K, V>) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!collection) return false; // runtime check
if (this === collection) return true;
if (this.size !== collection.size) return false;