Skip to content

Commit

Permalink
Applied ESLint
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrei15193 committed Jan 29, 2025
1 parent d3f125e commit 6fda0ef
Show file tree
Hide file tree
Showing 136 changed files with 3,972 additions and 2,929 deletions.
2 changes: 1 addition & 1 deletion src/collections/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export {

ObservableCollection,
ReadOnlyObservableCollection
} from './observableCollections'
} from './observableCollections';

export {
type INotifySetChanged,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IEvent } from '../../events';
import type { ICollectionChange } from './ICollectionChange';
import type { IEvent } from '../../events';

/**
* A specialized event for subscribing and unsubscribing from collection changed events.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IEventHandler } from '../../events';
import type { ICollectionChange } from './ICollectionChange';
import type { IEventHandler } from '../../events';

/**
* A specialized interface for handling collection changed events.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IEvent } from '../../events';
import type { ICollectionReorder } from './ICollectionReorder';
import type { IEvent } from '../../events';

/**
* A specialized event for subscribing and unsubscribing from collection reordering events.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { IEventHandler } from '../../events';
import type { ICollectionReorder } from './ICollectionReorder';
import type { IEventHandler } from '../../events';

/**
* A specialized interface for handling collection reorder events.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { INotifyCollectionChanged } from './INotifyCollectionChanged';
import type { ICollectionReorderedEvent } from './ICollectionReorderedEvent';
import type { INotifyCollectionChanged } from './INotifyCollectionChanged';

/**
* Notifies when a collection has its items reordered. Adding and removing items is handled through the {@linkcode INotifyCollectionChanged} interface.
* A core interface for observable collections. Components can react to this and display the new value as a consequence.
*
* Any collection change can be reduced to [Array.splice](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice),
* event handlers can splice entire mapped collections to get all items in the same order.
*
*
* Additionally, event handlers receive all the necessary information about how each item has moved inside the collection making it easy to
* add animations when it happens.
* @template TItem The type of items the collection contains.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface IObservableCollection<TItem> extends IReadOnlyObservableCollect
* Removes the last element from the collection and returns it. If the collection is empty, `undefined` is returned.
* @returns The last element in the collection that was removed.
* @see [Array.pop](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/pop)
*/
*/
pop(): TItem | undefined;

/**
Expand All @@ -39,7 +39,7 @@ export interface IObservableCollection<TItem> extends IReadOnlyObservableCollect
* Removes the first element from the collection and returns it. If the collection is empty, `undefined` is returned.
* @returns The first element in the collection that was removed.
* @see [Array.shift](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/shift)
*/
*/
shift(): TItem | undefined;

/**
Expand Down Expand Up @@ -74,7 +74,7 @@ export interface IObservableCollection<TItem> extends IReadOnlyObservableCollect
* @returns The observable collection on which the operation is performed.
* @see [Array.sort](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
*/
sort(compareCallback?: (left: Exclude<TItem, undefined>, right: Exclude<TItem, undefined>) => number): this;
sort(compareCallback?: (left: Exclude<TItem, undefined>, right: Exclude<TItem, undefined>)=> number): this;

/**
* Reverses the items in the collections and returns the observable collection.
Expand All @@ -101,4 +101,4 @@ export interface IObservableCollection<TItem> extends IReadOnlyObservableCollect
* @see [Array.fill](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/fill)
*/
fill(item: TItem, start?: number, end?: number): this;
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { INotifyPropertiesChanged } from '../../viewModels';
import type { INotifyCollectionChanged } from './INotifyCollectionChanged';
import type { INotifyCollectionReordered } from './INotifyCollectionReordered';
import type { ObservableCollection } from './ObservableCollection';
import type { INotifyPropertiesChanged } from '../../viewModels';

/**
* Represents a read-only observable collection based on the [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) interface.
Expand Down Expand Up @@ -75,7 +75,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @param thisArg A value to use as context when processing items.
* @see [Array.forEach](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
*/
forEach<TContext>(callback: (this: TContext, item: TItem, index: number, collection: this) => void, thisArg?: TContext): void;
forEach<TContext>(callback: (this: TContext, item: TItem, index: number, collection: this)=> void, thisArg?: TContext): void;

/**
* Checks whether the provided item is in the collection.
Expand Down Expand Up @@ -112,7 +112,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns the index of the first item for which the provided `predicate` evaluates to `true`; otherwise `-1`.
* @see [Array.findIndex](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/findIndex)
*/
findIndex<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => boolean, thisArg?: TContext): number;
findIndex<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> boolean, thisArg?: TContext): number;

/**
* Returns the index of the last item that satisfies the given condition.
Expand All @@ -122,7 +122,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns the index of the last item for which the provided `predicate` evaluates to `true`; otherwise `-1`.
* @see [Array.findLastIndex](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/findLastIndex)
*/
findLastIndex<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => boolean, thisArg?: TContext): number;
findLastIndex<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> boolean, thisArg?: TContext): number;

/**
* Returns the first item that satisfies the given condition.
Expand All @@ -132,7 +132,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns the first item for which the provided `predicate` evaluates to `true`; otherwise `undefined`.
* @see [Array.find](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
*/
find<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => boolean, thisArg?: TContext): TItem | undefined;
find<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> boolean, thisArg?: TContext): TItem | undefined;
/**
* Returns the first item that satisfies the given condition.
* @template TResult The type of item to return.
Expand All @@ -142,7 +142,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns the first item for which the provided `predicate` evaluates to `true`; otherwise `undefined`.
* @see [Array.find](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
*/
find<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => item is TResult, thisArg?: TContext): TResult | undefined;
find<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> item is TResult, thisArg?: TContext): TResult | undefined;

/**
* Returns the last item that satisfies the given condition.
Expand All @@ -152,7 +152,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns the last item for which the provided `predicate` evaluates to `true`; otherwise `undefined`.
* @see [Array.findLast](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast)
*/
findLast<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => boolean, thisArg?: TContext): TItem | undefined;
findLast<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> boolean, thisArg?: TContext): TItem | undefined;
/**
* Returns the last item that satisfies the given condition.
* @template TResult The type of item to return.
Expand All @@ -162,7 +162,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns the last item for which the provided `predicate` evaluates to `true`; otherwise `undefined`.
* @see [Array.findLast](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/findLast)
*/
findLast<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => item is TResult, thisArg?: TContext): TResult | undefined;
findLast<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> item is TResult, thisArg?: TContext): TResult | undefined;

/**
* Merges the current collection with the given [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) and returns a new JavaScript [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array).
Expand All @@ -181,7 +181,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns A new [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) containing the mapped items.
* @see [Array.map](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
*/
map<TResult, TContext>(callback: (this: TContext, item: TItem, index: number, collection: this) => TResult, thisArg?: TContext): TResult[];
map<TResult, TContext>(callback: (this: TContext, item: TItem, index: number, collection: this)=> TResult, thisArg?: TContext): TResult[];

/**
* Creates a new JavaScript [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) containing only the items the satisfy the given collection.
Expand All @@ -191,7 +191,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns A new [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) containing the items for which the provided `predicate` evaluated to `true`.
* @see [Array.filter](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
*/
filter<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => boolean, thisArg?: TContext): TItem[];
filter<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> boolean, thisArg?: TContext): TItem[];
/**
* Creates a new JavaScript [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) containing only the items the satisfy the given collection.
* @template TContext The context type in which the callback is executed.
Expand All @@ -201,7 +201,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns A new [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) containing the items for which the provided `predicate` evaluated to `true`.
* @see [Array.filter](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
*/
filter<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => item is TResult, thisArg?: TContext): TResult[];
filter<TResult extends TItem, TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> item is TResult, thisArg?: TContext): TResult[];

/**
* Returns a new JavaScript [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) containing the elements starting at the provided `start` index up to, but not including, the provided `end` index.
Expand All @@ -228,7 +228,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns `true` if the provided `predicate` is `true` for at least one item; otherwise `false`.
* @see [Array.some](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
*/
some<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => boolean, thisArg?: TContext): boolean;
some<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> boolean, thisArg?: TContext): boolean;

/**
* Checks whether all elements in the collection satisfy a given condition.
Expand All @@ -238,15 +238,15 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns `true` if the provided `predicate` is `true` for all items; otherwise `false`.
* @see [Array.every](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/every)
*/
every<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this) => boolean, thisArg?: TContext): boolean;
every<TContext>(predicate: (this: TContext, item: TItem, index: number, collection: this)=> boolean, thisArg?: TContext): boolean;

/**
* Reduces the collection to a single item.
* @param callback The callback that aggregates two items at a time.
* @returns Returns a single aggregated item.
* @see [Array.reduce](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
*/
reduce(callback: (previousItem: TItem, currentItem: TItem, currentIndex: number, collection: this) => TItem): TItem;
reduce(callback: (previousItem: TItem, currentItem: TItem, currentIndex: number, collection: this)=> TItem): TItem;
/**
* Reduces the collection to a single item.
* @template TResult The result value type to which items are aggregated.
Expand All @@ -255,15 +255,15 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns the value containing the aggregated collection.
* @see [Array.reduce](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
*/
reduce<TResult>(callback: (result: TResult, item: TItem, index: number, collection: this) => TResult, initialValue: TResult): TResult;
reduce<TResult>(callback: (result: TResult, item: TItem, index: number, collection: this)=> TResult, initialValue: TResult): TResult;

/**
* Reduces the collection to a single item iterating the collection from end to start.
* @param callback The callback that aggregates two items at a time.
* @returns Returns a single aggregated item.
* @see [Array.reduceRight](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight)
*/
reduceRight(callback: (previousItem: TItem, currentItem: TItem, currentIndex: number, collection: this) => TItem): TItem;
reduceRight(callback: (previousItem: TItem, currentItem: TItem, currentIndex: number, collection: this)=> TItem): TItem;
/**
* Reduces the collection to a single item iterating the collection from end to start.
* @template TResult The result value type to which items are aggregated.
Expand All @@ -272,7 +272,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns Returns the value containing the aggregated collection.
* @see [Array.reduceRight](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/reduceRight)
*/
reduceRight<TResult>(callback: (result: TResult, item: TItem, index: number, collection: this) => TResult, initialValue: TResult): TResult;
reduceRight<TResult>(callback: (result: TResult, item: TItem, index: number, collection: this)=> TResult, initialValue: TResult): TResult;

/**
* Converts the observable collection to a native JavaScript [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array).
Expand All @@ -293,7 +293,7 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @returns A new [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) containing the elements sorted in ascending order.
* @see [Array.toSorted](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/toSorted)
*/
toSorted(compareCallback?: (a: Exclude<TItem, undefined>, b: Exclude<TItem, undefined>) => number): TItem[];
toSorted(compareCallback?: (a: Exclude<TItem, undefined>, b: Exclude<TItem, undefined>)=> number): TItem[];

/**
* Returns a JavaScript [Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array) containing the spliced items of the collection.
Expand All @@ -305,4 +305,4 @@ export interface IReadOnlyObservableCollection<TItem> extends Iterable<TItem>, A
* @see [Array.toSpliced](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/toSpliced)
*/
toSpliced(start: number, deleteCount?: number, ...items: readonly TItem[]): TItem[];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class ObservableCollection<TItem> extends ReadOnlyObservableCollection<TI
* @returns The observable collection on which the operation is performed.
* @see [Array.sort](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/sort)
*/
public sort(compareCallback?: (left: Exclude<TItem, undefined>, right: Exclude<TItem, undefined>) => number): this {
public sort(compareCallback?: (left: Exclude<TItem, undefined>, right: Exclude<TItem, undefined>)=> number): this {
return super.sort.apply(this, arguments);
}

Expand Down
Loading

0 comments on commit 6fda0ef

Please sign in to comment.