Update to eslint-plugin-matrix-org 0.8 (#23825)

* Update to eslint-plugin-matrix-org 0.8

* Exclude some eslint rules for specs

* Fix eslint tests path
This commit is contained in:
Michael Weimann 2022-11-23 17:24:36 +01:00 committed by GitHub
parent c1d4abbeb0
commit cbf5c43ae7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 104 additions and 95 deletions

View file

@ -92,7 +92,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
// this is the opaque token we pass to the HS which when we get it in our callback we can resolve to a profile
private readonly ssoID: string = randomString(32);
constructor() {
public constructor() {
super();
dis.register(onAction);
@ -124,12 +124,12 @@ export default class ElectronPlatform extends VectorBasePlatform {
window.electron.on('userDownloadCompleted', (ev, { id, name }) => {
const key = `DOWNLOAD_TOAST_${id}`;
const onAccept = () => {
const onAccept = (): void => {
window.electron.send('userDownloadAction', { id, open: true });
ToastStore.sharedInstance().dismissToast(key);
};
const onDismiss = () => {
const onDismiss = (): void => {
window.electron.send('userDownloadAction', { id });
};
@ -156,7 +156,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
return this.ipc.call('getConfig');
}
private onUpdateDownloaded = async (ev, { releaseNotes, releaseName }) => {
private onUpdateDownloaded = async (ev, { releaseNotes, releaseName }): Promise<void> => {
dis.dispatch<CheckUpdatesPayload>({
action: Action.CheckUpdates,
status: UpdateCheckStatus.Ready,
@ -223,7 +223,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
);
const handler = notification.onclick as Function;
notification.onclick = () => {
notification.onclick = (): void => {
handler?.();
this.ipc.call('focusWindow');
};
@ -231,7 +231,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
return notification;
}
public loudNotification(ev: MatrixEvent, room: Room) {
public loudNotification(ev: MatrixEvent, room: Room): void {
window.electron.send('loudNotification');
}
@ -261,17 +261,17 @@ export default class ElectronPlatform extends VectorBasePlatform {
return this.ipc.call("setSettingValue", settingName, value);
}
async canSelfUpdate(): Promise<boolean> {
public async canSelfUpdate(): Promise<boolean> {
const feedUrl = await this.ipc.call('getUpdateFeedUrl');
return Boolean(feedUrl);
}
public startUpdateCheck() {
public startUpdateCheck(): void {
super.startUpdateCheck();
window.electron.send('check_updates');
}
public installUpdate() {
public installUpdate(): void {
// IPC to the main process to install the update, since quitAndInstall
// doesn't fire the before-quit event so the main process needs to know
// it should exit.
@ -290,7 +290,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
return Promise.resolve('granted');
}
public reload() {
public reload(): void {
window.location.reload();
}
@ -298,7 +298,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
return this.eventIndexManager;
}
public async setLanguage(preferredLangs: string[]) {
public async setLanguage(preferredLangs: string[]): Promise<any> {
return this.ipc.call('setLanguage', preferredLangs);
}
@ -353,7 +353,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
loginType: "sso" | "cas",
fragmentAfterLogin: string,
idpId?: string,
) {
): void {
// this will get intercepted by electron-main will-navigate
super.startSingleSignOn(mxClient, loginType, fragmentAfterLogin, idpId);
Modal.createDialog(InfoDialog, {

View file

@ -43,7 +43,7 @@ export default abstract class VectorBasePlatform extends BasePlatform {
* it uses canvas, which can trigger a permission prompt in Firefox's resist fingerprinting mode.
* See https://github.com/vector-im/element-web/issues/9605.
*/
public get favicon() {
public get favicon(): Favicon {
if (this._favicon) {
return this._favicon;
}
@ -51,7 +51,7 @@ export default abstract class VectorBasePlatform extends BasePlatform {
return this._favicon;
}
private updateFavicon() {
private updateFavicon(): void {
let bgColor = "#d00";
let notif: string | number = this.notificationCount;
@ -63,13 +63,13 @@ export default abstract class VectorBasePlatform extends BasePlatform {
this.favicon.badge(notif, { bgColor });
}
public setNotificationCount(count: number) {
public setNotificationCount(count: number): void {
if (this.notificationCount === count) return;
super.setNotificationCount(count);
this.updateFavicon();
}
public setErrorStatus(errorDidOccur: boolean) {
public setErrorStatus(errorDidOccur: boolean): void {
if (this.errorDidOccur === errorDidOccur) return;
super.setErrorStatus(errorDidOccur);
this.updateFavicon();
@ -78,7 +78,7 @@ export default abstract class VectorBasePlatform extends BasePlatform {
/**
* Begin update polling, if applicable
*/
public startUpdater() {
public startUpdater(): void {
}
/**

View file

@ -40,7 +40,7 @@ function getNormalizedAppVersion(version: string): string {
}
export default class WebPlatform extends VectorBasePlatform {
constructor() {
public constructor() {
super();
// Register service worker if available on this platform
if ('serviceWorker' in navigator) {