Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 6569120

Browse files
authored
Add lint for unused locals (#8007)
1 parent c7dfaa8 commit 6569120

25 files changed

+46
-115
lines changed

src/ActiveRoomObserver.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2017 New Vector Ltd
2+
Copyright 2017 - 2022 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import { EventSubscription } from 'fbemitter';
1817
import { logger } from "matrix-js-sdk/src/logger";
1918

2019
import RoomViewStore from './stores/RoomViewStore';
@@ -33,11 +32,10 @@ type Listener = (isActive: boolean) => void;
3332
export class ActiveRoomObserver {
3433
private listeners: {[key: string]: Listener[]} = {};
3534
private _activeRoomId = RoomViewStore.getRoomId();
36-
private readonly roomStoreToken: EventSubscription;
3735

3836
constructor() {
3937
// TODO: We could self-destruct when the last listener goes away, or at least stop listening.
40-
this.roomStoreToken = RoomViewStore.addListener(this.onRoomViewStoreUpdate);
38+
RoomViewStore.addListener(this.onRoomViewStoreUpdate);
4139
}
4240

4341
public get activeRoomId(): string {

src/Analytics.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright 2017 Michael Telatynski <[email protected]>
3-
Copyright 2020 The Matrix.org Foundation C.I.C.
3+
Copyright 2020 - 2022 The Matrix.org Foundation C.I.C.
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -166,7 +166,6 @@ const HEARTBEAT_INTERVAL = 30 * 1000; // seconds
166166

167167
export class Analytics {
168168
private baseUrl: URL = null;
169-
private siteId: string = null;
170169
private visitVariables: Record<number, [string, string]> = {}; // {[id: number]: [name: string, value: string]}
171170
private firstPage = true;
172171
private heartbeatIntervalID: number = null;

src/CallHandler.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
33
Copyright 2017, 2018 New Vector Ltd
4-
Copyright 2019 - 2021 The Matrix.org Foundation C.I.C.
4+
Copyright 2019 - 2022 The Matrix.org Foundation C.I.C.
55
Copyright 2021 Šimon Brandner <[email protected]>
66
77
Licensed under the Apache License, Version 2.0 (the "License");
@@ -125,10 +125,6 @@ export default class CallHandler extends EventEmitter {
125125
private supportsPstnProtocol = null;
126126
private pstnSupportPrefixed = null; // True if the server only support the prefixed pstn protocol
127127
private supportsSipNativeVirtual = null; // im.vector.protocol.sip_virtual and im.vector.protocol.sip_native
128-
private pstnSupportCheckTimer: number;
129-
// For rooms we've been invited to, true if they're from virtual user, false if we've checked and they aren't.
130-
private invitedRoomsAreVirtual = new Map<string, boolean>();
131-
private invitedRoomCheckInProgress = false;
132128

133129
// Map of the asserted identity users after we've looked them up using the API.
134130
// We need to be be able to determine the mapped room synchronously, so we
@@ -255,7 +251,7 @@ export default class CallHandler extends EventEmitter {
255251
logger.log("Failed to check for protocol support and no retries remain: assuming no support", e);
256252
} else {
257253
logger.log("Failed to check for protocol support: will retry", e);
258-
this.pstnSupportCheckTimer = setTimeout(() => {
254+
setTimeout(() => {
259255
this.checkProtocols(maxTries - 1);
260256
}, 10000);
261257
}

src/PasswordReset.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright 2015, 2016 OpenMarket Ltd
3-
Copyright 2019 The Matrix.org Foundation C.I.C.
3+
Copyright 2019 - 2022 The Matrix.org Foundation C.I.C.
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@ import { _t } from './languageHandler';
2929
export default class PasswordReset {
3030
private client: MatrixClient;
3131
private clientSecret: string;
32-
private identityServerDomain: string;
3332
private password: string;
3433
private sessionId: string;
3534

@@ -44,7 +43,6 @@ export default class PasswordReset {
4443
idBaseUrl: identityUrl,
4544
});
4645
this.clientSecret = this.client.generateClientSecret();
47-
this.identityServerDomain = identityUrl ? identityUrl.split("://")[1] : null;
4846
}
4947

5048
/**

src/audio/PlaybackQueue.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2021 The Matrix.org Foundation C.I.C.
2+
Copyright 2021 - 2022 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
import { MatrixClient } from "matrix-js-sdk/src/client";
1817
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
1918
import { Room } from "matrix-js-sdk/src/models/room";
2019
import { EventType } from "matrix-js-sdk/src/@types/event";
@@ -49,7 +48,7 @@ export class PlaybackQueue {
4948
private currentPlaybackId: string; // event ID, broken out from above for ease of use
5049
private recentFullPlays = new Set<string>(); // event IDs
5150

52-
constructor(private client: MatrixClient, private room: Room) {
51+
constructor(private room: Room) {
5352
this.loadClocks();
5453

5554
RoomViewStore.addListener(() => {
@@ -71,7 +70,7 @@ export class PlaybackQueue {
7170
if (PlaybackQueue.queues.has(room.roomId)) {
7271
return PlaybackQueue.queues.get(room.roomId);
7372
}
74-
const queue = new PlaybackQueue(cli, room);
73+
const queue = new PlaybackQueue(room);
7574
PlaybackQueue.queues.set(room.roomId, queue);
7675
return queue;
7776
}

src/components/structures/InteractiveAuth.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ export default class InteractiveAuthComponent extends React.Component<IProps, IS
177177
}
178178
};
179179

180-
private tryContinue = (): void => {
181-
this.stageComponent.current?.tryContinue?.();
182-
};
183-
184180
private authStateUpdated = (stageType: AuthType, stageState: IStageStatus): void => {
185181
const oldStage = this.state.authStage;
186182
this.setState({

src/components/structures/LoggedInView.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2015 - 2021 The Matrix.org Foundation C.I.C.
2+
Copyright 2015 - 2022 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -58,6 +58,7 @@ import AudioFeedArrayForCall from '../views/voip/AudioFeedArrayForCall';
5858
import { OwnProfileStore } from '../../stores/OwnProfileStore';
5959
import { UPDATE_EVENT } from "../../stores/AsyncStore";
6060
import RoomView from './RoomView';
61+
import type { RoomView as RoomViewType } from './RoomView';
6162
import ToastContainer from './ToastContainer';
6263
import MyGroups from "./MyGroups";
6364
import UserView from "./UserView";
@@ -139,7 +140,7 @@ class LoggedInView extends React.Component<IProps, IState> {
139140
static displayName = 'LoggedInView';
140141

141142
protected readonly _matrixClient: MatrixClient;
142-
protected readonly _roomView: React.RefObject<any>;
143+
protected readonly _roomView: React.RefObject<RoomViewType>;
143144
protected readonly _resizeContainer: React.RefObject<HTMLDivElement>;
144145
protected readonly resizeHandler: React.RefObject<HTMLDivElement>;
145146
protected layoutWatcherRef: string;

src/components/structures/MatrixChat.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
229229
private firstSyncPromise: IDeferred<void>;
230230

231231
private screenAfterLogin?: IScreen;
232-
private pageChanging: boolean;
233232
private tokenLogin?: boolean;
234233
private accountPassword?: string;
235234
private accountPasswordTimer?: number;
@@ -284,8 +283,6 @@ export default class MatrixChat extends React.PureComponent<IProps, IState> {
284283
this.prevWindowWidth = UIStore.instance.windowWidth || 1000;
285284
UIStore.instance.on(UI_EVENTS.Resize, this.handleResize);
286285

287-
this.pageChanging = false;
288-
289286
// For PersistentElement
290287
this.state.resizeNotifier.on("middlePanelResized", this.dispatchTimelineResize);
291288

src/components/structures/RoomDirectory.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ interface IState {
7878

7979
@replaceableComponent("structures.RoomDirectory")
8080
export default class RoomDirectory extends React.Component<IProps, IState> {
81-
private readonly startTime: number;
8281
private unmounted = false;
8382
private nextBatch: string = null;
8483
private filterTimeout: number;

src/components/structures/RoomView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1681,8 +1681,8 @@ export class RoomView extends React.Component<IRoomProps, IRoomState> {
16811681
*
16821682
* We pass it down to the scroll panel.
16831683
*/
1684-
private handleScrollKey = ev => {
1685-
let panel;
1684+
public handleScrollKey = ev => {
1685+
let panel: ScrollPanel | TimelinePanel;
16861686
if (this.searchResultsPanel.current) {
16871687
panel = this.searchResultsPanel.current;
16881688
} else if (this.messagePanel) {

src/components/views/auth/InteractiveAuthEntryComponents.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,6 @@ export class TermsAuthEntry extends React.Component<ITermsAuthEntryProps, ITerms
326326
this.props.onPhaseChange(DEFAULT_PHASE);
327327
}
328328

329-
public tryContinue = () => {
330-
this.trySubmit();
331-
};
332-
333329
private togglePolicy(policyId: string) {
334330
const newToggles = {};
335331
for (const policy of this.state.policies) {
@@ -832,7 +828,6 @@ export interface IStageComponentProps extends IAuthEntryProps {
832828
}
833829

834830
export interface IStageComponent extends React.ComponentClass<React.PropsWithRef<IStageComponentProps>> {
835-
tryContinue?(): void;
836831
attemptFailed?(): void;
837832
focus?(): void;
838833
}

src/components/views/dialogs/LogoutDialog.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
Copyright 2018, 2019 New Vector Ltd
3-
Copyright 2020 The Matrix.org Foundation C.I.C.
3+
Copyright 2020 - 2022 The Matrix.org Foundation C.I.C.
44
55
Licensed under the Apache License, Version 2.0 (the "License");
66
you may not use this file except in compliance with the License.
@@ -81,11 +81,6 @@ export default class LogoutDialog extends React.Component<IProps, IState> {
8181
}
8282
}
8383

84-
private onSettingsLinkClick = (): void => {
85-
// close dialog
86-
this.props.onFinished(true);
87-
};
88-
8984
private onExportE2eKeysClicked = (): void => {
9085
Modal.createTrackedDialogAsync('Export E2E Keys', '',
9186
import(

src/components/views/settings/Notifications.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2016 - 2021 The Matrix.org Foundation C.I.C.
2+
Copyright 2016 - 2022 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import {
2828
VectorPushRulesDefinitions,
2929
VectorState,
3030
} from "../../../notifications";
31+
import type { VectorPushRuleDefinition } from "../../../notifications";
3132
import { _t, TranslatedString } from "../../../languageHandler";
3233
import LabelledToggleSwitch from "../elements/LabelledToggleSwitch";
3334
import SettingsStore from "../../../settings/SettingsStore";
@@ -209,7 +210,7 @@ export default class Notifications extends React.PureComponent<IProps, IState> {
209210
for (const category of vectorCategories) {
210211
preparedNewState.vectorPushRules[category] = [];
211212
for (const rule of defaultRules[category]) {
212-
const definition = VectorPushRulesDefinitions[rule.rule_id];
213+
const definition: VectorPushRuleDefinition = VectorPushRulesDefinitions[rule.rule_id];
213214
const vectorState = definition.ruleToVectorState(rule);
214215
preparedNewState.vectorPushRules[category].push({
215216
ruleId: rule.rule_id,
@@ -356,7 +357,7 @@ export default class Notifications extends React.PureComponent<IProps, IState> {
356357
}
357358
}
358359
} else {
359-
const definition = VectorPushRulesDefinitions[rule.ruleId];
360+
const definition: VectorPushRuleDefinition = VectorPushRulesDefinitions[rule.ruleId];
360361
const actions = definition.vectorStateToActions[checkedState];
361362
if (!actions) {
362363
await cli.setPushRuleEnabled('global', rule.rule.kind, rule.rule.rule_id, false);

src/components/views/settings/tabs/user/HelpUserSettingsTab.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2019-2022 The Matrix.org Foundation C.I.C.
2+
Copyright 2019 - 2022 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -100,18 +100,6 @@ export default class HelpUserSettingsTab extends React.Component<IProps, IState>
100100
});
101101
};
102102

103-
private showSpoiler = (event) => {
104-
const target = event.target;
105-
target.innerHTML = target.getAttribute('data-spoiler');
106-
107-
const range = document.createRange();
108-
range.selectNodeContents(target);
109-
110-
const selection = window.getSelection();
111-
selection.removeAllRanges();
112-
selection.addRange(range);
113-
};
114-
115103
private renderLegal() {
116104
const tocLinks = SdkConfig.get().terms_and_conditions_links;
117105
if (!tocLinks) return null;

src/components/views/settings/tabs/user/SecurityUserSettingsTab.tsx

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/*
2-
Copyright 2019 New Vector Ltd
3-
Copyright 2020 The Matrix.org Foundation C.I.C.
2+
Copyright 2019 - 2022 The Matrix.org Foundation C.I.C.
43
54
Licensed under the Apache License, Version 2.0 (the "License");
65
you may not use this file except in compliance with the License.
@@ -147,14 +146,6 @@ export default class SecurityUserSettingsTab extends React.Component<IProps, ISt
147146
});
148147
};
149148

150-
private onGoToUserProfileClick = (): void => {
151-
dis.dispatch({
152-
action: 'view_user_info',
153-
userId: MatrixClientPeg.get().getUserId(),
154-
});
155-
this.props.closeSettingsFn();
156-
};
157-
158149
private onUserUnignored = async (userId: string): Promise<void> => {
159150
const { ignoredUserIds, waitingUnignored } = this.state;
160151
const currentlyIgnoredUserIds = ignoredUserIds.filter(e => !waitingUnignored.includes(e));

src/components/views/spaces/SpacePanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2021 The Matrix.org Foundation C.I.C.
2+
Copyright 2021 - 2022 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -205,7 +205,7 @@ const CreateSpaceButton = ({
205205
}: Pick<IInnerSpacePanelProps, "isPanelCollapsed" | "setPanelCollapsed">) => {
206206
// We don't need the handle as we position the menu in a constant location
207207
// eslint-disable-next-line @typescript-eslint/no-unused-vars
208-
const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu<void>();
208+
const [menuDisplayed, _handle, openMenu, closeMenu] = useContextMenu<void>();
209209

210210
useEffect(() => {
211211
if (!isPanelCollapsed && menuDisplayed) {

src/components/views/voip/CallViewForRoom.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright 2020 The Matrix.org Foundation C.I.C.
2+
Copyright 2020 - 2022 The Matrix.org Foundation C.I.C.
33
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
@@ -42,8 +42,6 @@ interface IState {
4242
*/
4343
@replaceableComponent("views.voip.CallViewForRoom")
4444
export default class CallViewForRoom extends React.Component<IProps, IState> {
45-
private dispatcherRef: string;
46-
4745
constructor(props: IProps) {
4846
super(props);
4947
this.state = {

0 commit comments

Comments
 (0)