Add lint for unused locals (#8007)

This commit is contained in:
J. Ryan Stinnett 2022-03-09 12:05:16 +00:00 committed by GitHub
parent c7dfaa8f64
commit 65691202f7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 46 additions and 115 deletions

View file

@ -1,5 +1,5 @@
/*
Copyright 2020 The Matrix.org Foundation C.I.C.
Copyright 2020 - 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -17,7 +17,6 @@ limitations under the License.
import { Room } from "matrix-js-sdk/src/models/room";
import { NotificationColor } from "./NotificationColor";
import { TagID } from "../room-list/models";
import { arrayDiff } from "../../utils/arrays";
import { RoomNotificationState } from "./RoomNotificationState";
import { NotificationState, NotificationStateEvents } from "./NotificationState";
@ -28,7 +27,7 @@ export class ListNotificationState extends NotificationState {
private rooms: Room[] = [];
private states: { [roomId: string]: RoomNotificationState } = {};
constructor(private byTileCount = false, private tagId: TagID, private getRoomFn: FetchRoomFn) {
constructor(private byTileCount = false, private getRoomFn: FetchRoomFn) {
super();
}

View file

@ -1,5 +1,5 @@
/*
Copyright 2020 The Matrix.org Foundation C.I.C.
Copyright 2020 - 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -68,7 +68,7 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient<IState> {
const getRoomFn: FetchRoomFn = (room: Room) => {
return this.getRoomState(room);
};
const state = new ListNotificationState(useTileCount, tagId, getRoomFn);
const state = new ListNotificationState(useTileCount, getRoomFn);
this.listMap.set(tagId, state);
return state;
}

View file

@ -1,5 +1,5 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
Copyright 2021 - 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -26,7 +26,7 @@ export class SpaceNotificationState extends NotificationState {
public rooms: Room[] = []; // exposed only for tests
private states: { [spaceId: string]: RoomNotificationState } = {};
constructor(private spaceId: string | symbol, private getRoomFn: FetchRoomFn) {
constructor(private getRoomFn: FetchRoomFn) {
super();
}

View file

@ -1,5 +1,5 @@
/*
Copyright 2018-2021 The Matrix.org Foundation C.I.C.
Copyright 2018 - 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -64,8 +64,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
private algorithm = new Algorithm();
private filterConditions: IFilterCondition[] = [];
private prefilterConditions: IFilterCondition[] = [];
private tagWatcher: TagWatcher;
private spaceWatcher: SpaceWatcher;
private updateFn = new MarkedExecution(() => {
for (const tagId of Object.keys(this.orderedLists)) {
RoomNotificationStateStore.instance.getListState(tagId).setRooms(this.orderedLists[tagId]);
@ -83,10 +81,11 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
}
private setupWatchers() {
// TODO: Maybe destroy these if this class supports destruction
if (SpaceStore.spacesEnabled) {
this.spaceWatcher = new SpaceWatcher(this);
new SpaceWatcher(this);
} else {
this.tagWatcher = new TagWatcher(this);
new TagWatcher(this);
}
}
@ -106,7 +105,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
this.filterConditions = [];
this.prefilterConditions = [];
this.initialListsGenerated = false;
this.setupWatchers();
this.algorithm.off(LIST_UPDATED_EVENT, this.onAlgorithmListUpdated);
this.algorithm.off(FILTER_CHANGED, this.onAlgorithmListUpdated);
@ -131,7 +129,6 @@ export class RoomListStoreClass extends AsyncStoreWithClient<IState> {
this.algorithm.on(FILTER_CHANGED, this.onAlgorithmFilterUpdated);
this.setupWatchers();
// Update any settings here, as some may have happened before we were logically ready.
// Update any settings here, as some may have happened before we were logically ready.
logger.log("Regenerating room lists: Startup");
await this.readAndCacheSettingsFromStore();

View file

@ -1,5 +1,5 @@
/*
Copyright 2021 The Matrix.org Foundation C.I.C.
Copyright 2021 - 2022 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -1236,7 +1236,7 @@ export class SpaceStoreClass extends AsyncStoreWithClient<IState> {
return this.notificationStateMap.get(key);
}
const state = new SpaceNotificationState(key, getRoomFn);
const state = new SpaceNotificationState(getRoomFn);
this.notificationStateMap.set(key, state);
return state;
}

View file

@ -1,5 +1,5 @@
/*
* Copyright 2020 - 2021 The Matrix.org Foundation C.I.C.
* Copyright 2020 - 2022 The Matrix.org Foundation C.I.C.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -238,10 +238,6 @@ export class StopGapWidget extends EventEmitter {
return !!this.messaging;
}
private get widgetId() {
return this.messaging.widget.id;
}
private onOpenModal = async (ev: CustomEvent<IModalWidgetOpenRequest>) => {
ev.preventDefault();
if (ModalWidgetStore.instance.canOpenModalWidget()) {