Merge pull request #18065 from vector-im/t3chguy/eslint

pull/18150/head
Michael Telatynski 2021-07-21 14:53:47 +01:00 committed by GitHub
commit 9babd7bcd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 65 additions and 64 deletions

View File

@ -49,6 +49,7 @@
"start:js": "webpack-dev-server --host=0.0.0.0 --output-filename=bundles/_dev_/[name].js --output-chunk-filename=bundles/_dev_/[name].js -w --progress --mode development --disable-host-check",
"lint": "yarn lint:types && yarn lint:js && yarn lint:style",
"lint:js": "eslint src",
"lint:js-fix": "eslint --fix src",
"lint:types": "tsc --noEmit --jsx react",
"lint:style": "stylelint 'res/css/**/*.scss'",
"test": "jest"

View File

@ -71,7 +71,7 @@ const CompatibilityView: React.FC<IProps> = ({ onAccept }) => {
android = [];
}
let mobileHeader = <h2 id="step2_heading">{_t("Use %(brand)s on mobile", { brand })}</h2>;
let mobileHeader = <h2 id="step2_heading">{ _t("Use %(brand)s on mobile", { brand }) }</h2>;
if (!android.length && !ios) {
mobileHeader = null;
}
@ -102,11 +102,11 @@ const CompatibilityView: React.FC<IProps> = ({ onAccept }) => {
'or <safariLink>Safari</safariLink> for the best experience.',
{},
{
'chromeLink': (sub) => <a href="https://www.google.com/chrome">{sub}</a>,
'firefoxLink': (sub) => <a href="https://firefox.com">{sub}</a>,
'safariLink': (sub) => <a href="https://apple.com/safari">{sub}</a>,
'chromeLink': (sub) => <a href="https://www.google.com/chrome">{ sub }</a>,
'firefoxLink': (sub) => <a href="https://firefox.com">{ sub }</a>,
'safariLink': (sub) => <a href="https://apple.com/safari">{ sub }</a>,
},
)}
) }
</p>
<p>
{ _t(
@ -124,9 +124,9 @@ const CompatibilityView: React.FC<IProps> = ({ onAccept }) => {
<div className="mx_HomePage_col">
<div className="mx_HomePage_row">
<div>
{mobileHeader}
{ios}
{android}
{ mobileHeader }
{ ios }
{ android }
</div>
</div>
</div>

View File

@ -40,9 +40,9 @@ const ErrorView: React.FC<IProps> = ({ title, messages }) => {
<div className="mx_HomePage_row">
<div>
<h2 id="step1_heading">{ title }</h2>
{messages && messages.map(msg => <p key={msg}>
{ messages && messages.map(msg => <p key={msg}>
{ msg }
</p>)}
</p>) }
</div>
</div>
</div>

View File

@ -35,14 +35,14 @@ const VectorAuthFooter = () => {
for (const linkEntry of links) {
authFooterLinks.push(
<a href={linkEntry.url} key={linkEntry.text} target="_blank" rel="noreferrer noopener">
{linkEntry.text}
{ linkEntry.text }
</a>,
);
}
return (
<div className="mx_AuthFooter">
{authFooterLinks}
{ authFooterLinks }
<a href="https://matrix.org" target="_blank" rel="noreferrer noopener">{ _t('Powered by Matrix') }</a>
</div>
);

View File

@ -110,10 +110,10 @@ class SeshatIndexManager extends BaseEventIndexManager {
constructor() {
super();
electron.on('seshatReply', this._onIpcReply);
electron.on('seshatReply', this.onIpcReply);
}
async _ipcCall(name: string, ...args: any[]): Promise<any> {
private async ipcCall(name: string, ...args: any[]): Promise<any> {
// TODO this should be moved into the preload.js file.
const ipcCallId = ++this.nextIpcCallId;
return new Promise((resolve, reject) => {
@ -122,7 +122,7 @@ class SeshatIndexManager extends BaseEventIndexManager {
});
}
_onIpcReply = (ev: {}, payload: IPCPayload) => {
private onIpcReply = (ev: {}, payload: IPCPayload) => {
if (payload.id === undefined) {
console.warn("Ignoring IPC reply with no ID");
return;
@ -143,35 +143,35 @@ class SeshatIndexManager extends BaseEventIndexManager {
};
async supportsEventIndexing(): Promise<boolean> {
return this._ipcCall('supportsEventIndexing');
return this.ipcCall('supportsEventIndexing');
}
async initEventIndex(userId: string, deviceId: string): Promise<void> {
return this._ipcCall('initEventIndex', userId, deviceId);
return this.ipcCall('initEventIndex', userId, deviceId);
}
async addEventToIndex(ev: IMatrixEvent, profile: IMatrixProfile): Promise<void> {
return this._ipcCall('addEventToIndex', ev, profile);
return this.ipcCall('addEventToIndex', ev, profile);
}
async deleteEvent(eventId: string): Promise<boolean> {
return this._ipcCall('deleteEvent', eventId);
return this.ipcCall('deleteEvent', eventId);
}
async isEventIndexEmpty(): Promise<boolean> {
return this._ipcCall('isEventIndexEmpty');
return this.ipcCall('isEventIndexEmpty');
}
async isRoomIndexed(roomId: string): Promise<boolean> {
return this._ipcCall('isRoomIndexed', roomId);
return this.ipcCall('isRoomIndexed', roomId);
}
async commitLiveEvents(): Promise<void> {
return this._ipcCall('commitLiveEvents');
return this.ipcCall('commitLiveEvents');
}
async searchEventIndex(searchConfig: ISearchArgs): Promise<IResultRoomEvents> {
return this._ipcCall('searchEventIndex', searchConfig);
return this.ipcCall('searchEventIndex', searchConfig);
}
async addHistoricEvents(
@ -179,43 +179,43 @@ class SeshatIndexManager extends BaseEventIndexManager {
checkpoint: ICrawlerCheckpoint | null,
oldCheckpoint: ICrawlerCheckpoint | null,
): Promise<boolean> {
return this._ipcCall('addHistoricEvents', events, checkpoint, oldCheckpoint);
return this.ipcCall('addHistoricEvents', events, checkpoint, oldCheckpoint);
}
async addCrawlerCheckpoint(checkpoint: ICrawlerCheckpoint): Promise<void> {
return this._ipcCall('addCrawlerCheckpoint', checkpoint);
return this.ipcCall('addCrawlerCheckpoint', checkpoint);
}
async removeCrawlerCheckpoint(checkpoint: ICrawlerCheckpoint): Promise<void> {
return this._ipcCall('removeCrawlerCheckpoint', checkpoint);
return this.ipcCall('removeCrawlerCheckpoint', checkpoint);
}
async loadFileEvents(args): Promise<IEventAndProfile[]> {
return this._ipcCall('loadFileEvents', args);
return this.ipcCall('loadFileEvents', args);
}
async loadCheckpoints(): Promise<ICrawlerCheckpoint[]> {
return this._ipcCall('loadCheckpoints');
return this.ipcCall('loadCheckpoints');
}
async closeEventIndex(): Promise<void> {
return this._ipcCall('closeEventIndex');
return this.ipcCall('closeEventIndex');
}
async getStats(): Promise<IIndexStats> {
return this._ipcCall('getStats');
return this.ipcCall('getStats');
}
async getUserVersion(): Promise<number> {
return this._ipcCall('getUserVersion');
return this.ipcCall('getUserVersion');
}
async setUserVersion(version: number): Promise<void> {
return this._ipcCall('setUserVersion', version);
return this.ipcCall('setUserVersion', version);
}
async deleteEventIndex(): Promise<void> {
return this._ipcCall('deleteEventIndex');
return this.ipcCall('deleteEventIndex');
}
}
@ -249,7 +249,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
rageshake.flush();
});
electron.on('ipcReply', this._onIpcReply);
electron.on('ipcReply', this.onIpcReply);
electron.on('update-downloaded', this.onUpdateDownloaded);
electron.on('preferences', () => {
@ -317,11 +317,11 @@ export default class ElectronPlatform extends VectorBasePlatform {
});
}
this._ipcCall("startSSOFlow", this.ssoID);
this.ipcCall("startSSOFlow", this.ssoID);
}
async getConfig(): Promise<{}> {
return this._ipcCall('getConfig');
return this.ipcCall('getConfig');
}
onUpdateDownloaded = async (ev, { releaseNotes, releaseName }) => {
@ -388,7 +388,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
room_id: room.roomId,
});
window.focus();
this._ipcCall('focusWindow');
this.ipcCall('focusWindow');
};
return notification;
@ -399,7 +399,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
async getAppVersion(): Promise<string> {
return this._ipcCall('getAppVersion');
return this.ipcCall('getAppVersion');
}
supportsAutoLaunch(): boolean {
@ -407,11 +407,11 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
async getAutoLaunchEnabled(): Promise<boolean> {
return this._ipcCall('getAutoLaunchEnabled');
return this.ipcCall('getAutoLaunchEnabled');
}
async setAutoLaunchEnabled(enabled: boolean): Promise<void> {
return this._ipcCall('setAutoLaunchEnabled', enabled);
return this.ipcCall('setAutoLaunchEnabled', enabled);
}
supportsWarnBeforeExit(): boolean {
@ -419,11 +419,11 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
async shouldWarnBeforeExit(): Promise<boolean> {
return this._ipcCall('shouldWarnBeforeExit');
return this.ipcCall('shouldWarnBeforeExit');
}
async setWarnBeforeExit(enabled: boolean): Promise<void> {
return this._ipcCall('setWarnBeforeExit', enabled);
return this.ipcCall('setWarnBeforeExit', enabled);
}
supportsAutoHideMenuBar(): boolean {
@ -432,11 +432,11 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
async getAutoHideMenuBarEnabled(): Promise<boolean> {
return this._ipcCall('getAutoHideMenuBarEnabled');
return this.ipcCall('getAutoHideMenuBarEnabled');
}
async setAutoHideMenuBarEnabled(enabled: boolean): Promise<void> {
return this._ipcCall('setAutoHideMenuBarEnabled', enabled);
return this.ipcCall('setAutoHideMenuBarEnabled', enabled);
}
supportsMinimizeToTray(): boolean {
@ -445,15 +445,15 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
async getMinimizeToTrayEnabled(): Promise<boolean> {
return this._ipcCall('getMinimizeToTrayEnabled');
return this.ipcCall('getMinimizeToTrayEnabled');
}
async setMinimizeToTrayEnabled(enabled: boolean): Promise<void> {
return this._ipcCall('setMinimizeToTrayEnabled', enabled);
return this.ipcCall('setMinimizeToTrayEnabled', enabled);
}
async canSelfUpdate(): Promise<boolean> {
const feedUrl = await this._ipcCall('getUpdateFeedUrl');
const feedUrl = await this.ipcCall('getUpdateFeedUrl');
return Boolean(feedUrl);
}
@ -492,7 +492,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
window.location.reload(false);
}
async _ipcCall(name: string, ...args: any[]): Promise<any> {
private async ipcCall(name: string, ...args: any[]): Promise<any> {
const ipcCallId = ++this.nextIpcCallId;
return new Promise((resolve, reject) => {
this.pendingIpcCalls[ipcCallId] = { resolve, reject };
@ -501,7 +501,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
});
}
_onIpcReply = (ev, payload) => {
private onIpcReply = (ev, payload) => {
if (payload.id === undefined) {
console.warn("Ignoring IPC reply with no ID");
return;
@ -526,22 +526,22 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
async setLanguage(preferredLangs: string[]) {
return this._ipcCall('setLanguage', preferredLangs);
return this.ipcCall('setLanguage', preferredLangs);
}
setSpellCheckLanguages(preferredLangs: string[]) {
this._ipcCall('setSpellCheckLanguages', preferredLangs).catch(error => {
this.ipcCall('setSpellCheckLanguages', preferredLangs).catch(error => {
console.log("Failed to send setSpellCheckLanguages IPC to Electron");
console.error(error);
});
}
async getSpellCheckLanguages(): Promise<string[]> {
return this._ipcCall('getSpellCheckLanguages');
return this.ipcCall('getSpellCheckLanguages');
}
async getAvailableSpellCheckLanguages(): Promise<string[]> {
return this._ipcCall('getAvailableSpellCheckLanguages');
return this.ipcCall('getAvailableSpellCheckLanguages');
}
getSSOCallbackUrl(fragmentAfterLogin: string): URL {
@ -561,7 +561,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
}
private navigateForwardBack(back: boolean) {
this._ipcCall(back ? "navigateBack" : "navigateForward");
this.ipcCall(back ? "navigateBack" : "navigateForward");
}
private navigateToSpace(num: number) {
dis.dispatch<SwitchSpacePayload>({
@ -608,7 +608,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
async getPickleKey(userId: string, deviceId: string): Promise<string | null> {
try {
return await this._ipcCall('getPickleKey', userId, deviceId);
return await this.ipcCall('getPickleKey', userId, deviceId);
} catch (e) {
// if we can't connect to the password storage, assume there's no
// pickle key
@ -618,7 +618,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
async createPickleKey(userId: string, deviceId: string): Promise<string | null> {
try {
return await this._ipcCall('createPickleKey', userId, deviceId);
return await this.ipcCall('createPickleKey', userId, deviceId);
} catch (e) {
// if we can't connect to the password storage, assume there's no
// pickle key
@ -628,7 +628,7 @@ export default class ElectronPlatform extends VectorBasePlatform {
async destroyPickleKey(userId: string, deviceId: string): Promise<void> {
try {
await this._ipcCall('destroyPickleKey', userId, deviceId);
await this.ipcCall('destroyPickleKey', userId, deviceId);
} catch (e) {}
}
}

View File

@ -49,7 +49,7 @@ export default abstract class VectorBasePlatform extends BasePlatform {
return this._favicon = new Favicon();
}
_updateFavicon() {
private updateFavicon() {
let bgColor = "#d00";
let notif: string | number = this.notificationCount;
@ -64,13 +64,13 @@ export default abstract class VectorBasePlatform extends BasePlatform {
setNotificationCount(count: number) {
if (this.notificationCount === count) return;
super.setNotificationCount(count);
this._updateFavicon();
this.updateFavicon();
}
setErrorStatus(errorDidOccur: boolean) {
if (this.errorDidOccur === errorDidOccur) return;
super.setErrorStatus(errorDidOccur);
this._updateFavicon();
this.updateFavicon();
}
/**

View File

@ -100,7 +100,7 @@ export default class WebPlatform extends VectorBasePlatform {
return notification;
}
_getVersion(): Promise<string> {
private getVersion(): Promise<string> {
// We add a cachebuster to the request to make sure that we know about
// the most recent version on the origin server. That might not
// actually be the version we'd get on a reload (particularly in the
@ -132,7 +132,7 @@ export default class WebPlatform extends VectorBasePlatform {
if (this.runningVersion !== null) {
return Promise.resolve(this.runningVersion);
}
return this._getVersion();
return this.getVersion();
}
startUpdater() {
@ -145,7 +145,7 @@ export default class WebPlatform extends VectorBasePlatform {
}
pollForUpdate = () => {
return this._getVersion().then((ver) => {
return this.getVersion().then((ver) => {
if (this.runningVersion === null) {
this.runningVersion = ver;
} else if (this.runningVersion !== ver) {

View File

@ -4273,7 +4273,7 @@ eslint-config-google@^0.14.0:
"eslint-plugin-matrix-org@github:matrix-org/eslint-plugin-matrix-org#main":
version "0.3.2"
resolved "https://codeload.github.com/matrix-org/eslint-plugin-matrix-org/tar.gz/383a1e4a9ef7944c921efda0de2ac9635d45cb5c"
resolved "https://codeload.github.com/matrix-org/eslint-plugin-matrix-org/tar.gz/8529f1d77863db6327cf1a1a4fa65d06cc26f91b"
eslint-plugin-react-hooks@^4.2.0:
version "4.2.0"