Fix lint issues in new code
This commit is contained in:
parent
c3ffbdbdbc
commit
4ba1f91a2b
19 changed files with 66 additions and 33 deletions
16
src/@types/global.d.ts
vendored
16
src/@types/global.d.ts
vendored
|
@ -33,14 +33,14 @@ declare global {
|
|||
init: () => Promise<void>;
|
||||
};
|
||||
|
||||
mx_ContentMessages: ContentMessages;
|
||||
mx_ToastStore: ToastStore;
|
||||
mx_DeviceListener: DeviceListener;
|
||||
mx_RebrandListener: RebrandListener;
|
||||
mx_RoomListStore: RoomListStoreClass;
|
||||
mx_RoomListLayoutStore: RoomListLayoutStore;
|
||||
mx_PlatformPeg: PlatformPeg;
|
||||
mx_IntegrationManagers: typeof IntegrationManagers;
|
||||
mxContentMessages: ContentMessages;
|
||||
mxToastStore: ToastStore;
|
||||
mxDeviceListener: DeviceListener;
|
||||
mxRebrandListener: RebrandListener;
|
||||
mxRoomListStore: RoomListStoreClass;
|
||||
mxRoomListLayoutStore: RoomListLayoutStore;
|
||||
mxPlatformPeg: PlatformPeg;
|
||||
mxIntegrationManagers: typeof IntegrationManagers;
|
||||
}
|
||||
|
||||
// workaround for https://github.com/microsoft/TypeScript/issues/30933
|
||||
|
|
|
@ -621,9 +621,9 @@ export default class ContentMessages {
|
|||
}
|
||||
|
||||
static sharedInstance() {
|
||||
if (window.mx_ContentMessages === undefined) {
|
||||
window.mx_ContentMessages = new ContentMessages();
|
||||
if (window.mxContentMessages === undefined) {
|
||||
window.mxContentMessages = new ContentMessages();
|
||||
}
|
||||
return window.mx_ContentMessages;
|
||||
return window.mxContentMessages;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,8 +48,8 @@ export default class DeviceListener {
|
|||
private displayingToastsForDeviceIds = new Set<string>();
|
||||
|
||||
static sharedInstance() {
|
||||
if (!window.mx_DeviceListener) window.mx_DeviceListener = new DeviceListener();
|
||||
return window.mx_DeviceListener;
|
||||
if (!window.mxDeviceListener) window.mxDeviceListener = new DeviceListener();
|
||||
return window.mxDeviceListener;
|
||||
}
|
||||
|
||||
start() {
|
||||
|
|
|
@ -45,7 +45,7 @@ export class PlatformPeg {
|
|||
}
|
||||
}
|
||||
|
||||
if (!window.mx_PlatformPeg) {
|
||||
window.mx_PlatformPeg = new PlatformPeg();
|
||||
if (!window.mxPlatformPeg) {
|
||||
window.mxPlatformPeg = new PlatformPeg();
|
||||
}
|
||||
export default window.mx_PlatformPeg;
|
||||
export default window.mxPlatformPeg;
|
||||
|
|
|
@ -67,8 +67,8 @@ export default class RebrandListener {
|
|||
private nagAgainAt?: number = null;
|
||||
|
||||
static sharedInstance() {
|
||||
if (!window.mx_RebrandListener) window.mx_RebrandListener = new RebrandListener();
|
||||
return window.mx_RebrandListener;
|
||||
if (!window.mxRebrandListener) window.mxRebrandListener = new RebrandListener();
|
||||
return window.mxRebrandListener;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
|
|
|
@ -29,6 +29,9 @@ import {getAddressType} from "./UserAddress";
|
|||
|
||||
const E2EE_WK_KEY = "im.vector.riot.e2ee";
|
||||
|
||||
// we define a number of interfaces which in effect take their names from the js-sdk
|
||||
/* eslint-disable camelcase */
|
||||
|
||||
// TODO move these interfaces over to js-sdk once it has been typescripted enough to accept them
|
||||
enum Visibility {
|
||||
Public = "public",
|
||||
|
@ -42,6 +45,7 @@ enum Preset {
|
|||
}
|
||||
|
||||
interface Invite3PID {
|
||||
|
||||
id_server: string;
|
||||
id_access_token?: string; // this gets injected by the js-sdk
|
||||
medium: string;
|
||||
|
|
|
@ -30,7 +30,7 @@ export const useAccountData = <T extends {}>(cli: MatrixClient, eventType: strin
|
|||
const handler = useCallback((event) => {
|
||||
if (event.getType() !== eventType) return;
|
||||
setValue(event.getContent());
|
||||
}, [cli, eventType]);
|
||||
}, [eventType]);
|
||||
useEventEmitter(cli, "accountData", handler);
|
||||
|
||||
return value || {} as T;
|
||||
|
@ -43,7 +43,7 @@ export const useRoomAccountData = <T extends {}>(room: Room, eventType: string)
|
|||
const handler = useCallback((event) => {
|
||||
if (event.getType() !== eventType) return;
|
||||
setValue(event.getContent());
|
||||
}, [room, eventType]);
|
||||
}, [eventType]);
|
||||
useEventEmitter(room, "Room.accountData", handler);
|
||||
|
||||
return value || {} as T;
|
||||
|
|
|
@ -123,7 +123,12 @@ export class IntegrationManagers {
|
|||
const apiUrl = data['api_url'];
|
||||
if (!apiUrl || !uiUrl) return;
|
||||
|
||||
const manager = new IntegrationManagerInstance(Kind.Account, apiUrl, uiUrl, w['id'] || w['state_key'] || '');
|
||||
const manager = new IntegrationManagerInstance(
|
||||
Kind.Account,
|
||||
apiUrl,
|
||||
uiUrl,
|
||||
w['id'] || w['state_key'] || '',
|
||||
);
|
||||
this.managers.push(manager);
|
||||
});
|
||||
this.primaryManager = null; // reset primary
|
||||
|
@ -245,4 +250,4 @@ export class IntegrationManagers {
|
|||
}
|
||||
|
||||
// For debugging
|
||||
window.mx_IntegrationManagers = IntegrationManagers;
|
||||
window.mxIntegrationManagers = IntegrationManagers;
|
||||
|
|
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||
*/
|
||||
|
||||
import {PushRuleVectorState, State} from "./PushRuleVectorState";
|
||||
import {IExtendedPushRule, IPushRuleSet, IRuleSets} from "./types";
|
||||
import {IExtendedPushRule, IRuleSets} from "./types";
|
||||
|
||||
export interface IContentRules {
|
||||
vectorState: State;
|
||||
|
|
|
@ -22,10 +22,12 @@ export enum NotificationSetting {
|
|||
}
|
||||
|
||||
export interface ISoundTweak {
|
||||
// eslint-disable-next-line camelcase
|
||||
set_tweak: "sound";
|
||||
value: string;
|
||||
}
|
||||
export interface IHighlightTweak {
|
||||
// eslint-disable-next-line camelcase
|
||||
set_tweak: "highlight";
|
||||
value?: boolean;
|
||||
}
|
||||
|
@ -86,6 +88,7 @@ export enum RuleIds {
|
|||
|
||||
export interface IPushRule {
|
||||
enabled: boolean;
|
||||
// eslint-disable-next-line camelcase
|
||||
rule_id: RuleIds | string;
|
||||
actions: Action[];
|
||||
default: boolean;
|
||||
|
|
|
@ -19,7 +19,6 @@ import SettingsStore, {SettingLevel} from '../SettingsStore';
|
|||
import IWatcher from "./Watcher";
|
||||
import { toPx } from '../../utils/units';
|
||||
import { Action } from '../../dispatcher/actions';
|
||||
import { UpdateSystemFontPayload } from '../../dispatcher/payloads/UpdateSystemFontPayload';
|
||||
|
||||
export class FontWatcher implements IWatcher {
|
||||
public static readonly MIN_SIZE = 8;
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -70,4 +70,4 @@ export default class RoomListLayoutStore extends AsyncStoreWithClient<IState> {
|
|||
}
|
||||
}
|
||||
|
||||
window.mx_RoomListLayoutStore = RoomListLayoutStore.instance;
|
||||
window.mxRoomListLayoutStore = RoomListLayoutStore.instance;
|
||||
|
|
|
@ -606,4 +606,4 @@ export default class RoomListStore {
|
|||
}
|
||||
}
|
||||
|
||||
window.mx_RoomListStore = RoomListStore.instance;
|
||||
window.mxRoomListStore = RoomListStore.instance;
|
||||
|
|
|
@ -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")) {
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -1264,11 +1264,21 @@
|
|||
resolved "https://registry.yarnpkg.com/@types/classnames/-/classnames-2.2.10.tgz#cc658ca319b6355399efc1f5b9e818f1a24bf999"
|
||||
integrity sha512-1UzDldn9GfYYEsWWnn/P4wkTlkZDH7lDb0wBMGbtIQc9zXEQq7FlKBdZUn6OBqD8sKZZ2RQO2mAjGpXiDGoRmQ==
|
||||
|
||||
"@types/color-name@^1.1.1":
|
||||
version "1.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
|
||||
integrity sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==
|
||||
|
||||
"@types/counterpart@^0.18.1":
|
||||
version "0.18.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/counterpart/-/counterpart-0.18.1.tgz#b1b784d9e54d9879f0a8cb12f2caedab65430fe8"
|
||||
integrity sha512-PRuFlBBkvdDOtxlIASzTmkEFar+S66Ek48NVVTWMUjtJAdn5vyMSN8y6IZIoIymGpR36q2nZbIYazBWyFxL+IQ==
|
||||
|
||||
"@types/eslint-visitor-keys@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#1ee30d79544ca84d68d4b3cdb0af4f205663dd2d"
|
||||
integrity sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==
|
||||
|
||||
"@types/fbemitter@*":
|
||||
version "2.0.32"
|
||||
resolved "https://registry.yarnpkg.com/@types/fbemitter/-/fbemitter-2.0.32.tgz#8ed204da0f54e9c8eaec31b1eec91e25132d082c"
|
||||
|
@ -5779,7 +5789,7 @@ lodash.sortby@^4.7.0:
|
|||
resolved "https://registry.yarnpkg.com/lodash.sortby/-/lodash.sortby-4.7.0.tgz#edd14c824e2cc9c1e0b0a1b42bb5210516a42438"
|
||||
integrity sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=
|
||||
|
||||
lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.2.1:
|
||||
lodash@^4.15.0, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.2.1:
|
||||
version "4.17.19"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b"
|
||||
integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==
|
||||
|
|
Loading…
Reference in a new issue