Fix lint issues in new code

This commit is contained in:
Jorik Schellekens 2020-07-20 20:43:49 +01:00
parent c3ffbdbdbc
commit 4ba1f91a2b
19 changed files with 66 additions and 33 deletions

View file

@ -37,8 +37,8 @@ export default class ToastStore extends EventEmitter {
private countSeen = 0;
static sharedInstance() {
if (!window.mx_ToastStore) window.mx_ToastStore = new ToastStore();
return window.mx_ToastStore;
if (!window.mxToastStore) window.mxToastStore = new ToastStore();
return window.mxToastStore;
}
reset() {

View file

@ -70,4 +70,4 @@ export default class RoomListLayoutStore extends AsyncStoreWithClient<IState> {
}
}
window.mx_RoomListLayoutStore = RoomListLayoutStore.instance;
window.mxRoomListLayoutStore = RoomListLayoutStore.instance;

View file

@ -606,4 +606,4 @@ export default class RoomListStore {
}
}
window.mx_RoomListStore = RoomListStore.instance;
window.mxRoomListStore = RoomListStore.instance;

View file

@ -419,7 +419,9 @@ export class Algorithm extends EventEmitter {
if (!updatedTag || updatedTag === sticky.tag) {
if (SettingsStore.getValue("advancedRoomListLogging")) {
// TODO: Remove debug: https://github.com/vector-im/riot-web/issues/14602
console.log(`Inserting sticky room ${sticky.room.roomId} at position ${sticky.position} in ${sticky.tag}`);
console.log(
`Inserting sticky room ${sticky.room.roomId} at position ${sticky.position} in ${sticky.tag}`,
);
}
this._cachedStickyRooms[sticky.tag].splice(sticky.position, 0, sticky.room);
}
@ -823,6 +825,7 @@ export class Algorithm extends EventEmitter {
// Flag that we've done something
this.recalculateFilteredRoomsForTag(tag); // update filter to re-sort the list
this.recalculateStickyRoom(tag); // update sticky room to make sure it appears if needed
changed = true;
}
if (SettingsStore.getValue("advancedRoomListLogging")) {

View file

@ -218,7 +218,12 @@ export class ImportanceAlgorithm extends OrderingAlgorithm {
}
// noinspection JSMethodCanBeStatic
private moveRoomIndexes(nRooms: number, fromCategory: NotificationColor, toCategory: NotificationColor, indices: ICategoryIndex) {
private moveRoomIndexes(
nRooms: number,
fromCategory: NotificationColor,
toCategory: NotificationColor,
indices: ICategoryIndex,
) {
// We have to update the index of the category *after* the from/toCategory variables
// in order to update the indices correctly. Because the room is moving from/to those
// categories, the next category's index will change - not the category we're modifying.

View file

@ -56,7 +56,11 @@ export class NaturalAlgorithm extends OrderingAlgorithm {
// TODO: Optimize this to avoid useless operations: https://github.com/vector-im/riot-web/issues/14457
// For example, we can skip updates to alphabetic (sometimes) and manually ordered tags
this.cachedOrderedRooms = await sortRoomsWithAlgorithm(this.cachedOrderedRooms, this.tagId, this.sortingAlgorithm);
this.cachedOrderedRooms = await sortRoomsWithAlgorithm(
this.cachedOrderedRooms,
this.tagId,
this.sortingAlgorithm,
);
return true;
} finally {

View file

@ -26,7 +26,7 @@ import { EffectiveMembership, getEffectiveMembership } from "../../../../utils/m
* useful to the user.
*/
export class RecentAlgorithm implements IAlgorithm {
public async sortRooms(rooms: Room[], _: TagID): Promise<Room[]> {
public async sortRooms(rooms: Room[], tagID: TagID): Promise<Room[]> {
// We cache the timestamp lookup to avoid iterating forever on the timeline
// of events. This cache only survives a single sort though.
// We wouldn't need this if `.sort()` didn't constantly try and compare all