1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Conform to new typescript eslint rules

This commit is contained in:
Michael Telatynski
2021-07-19 22:47:32 +01:00
parent b936b4a2ce
commit 5cf6684129
5 changed files with 13 additions and 12 deletions

View File

@@ -16,6 +16,7 @@
"gendoc": "jsdoc -c jsdoc.json -P package.json", "gendoc": "jsdoc -c jsdoc.json -P package.json",
"lint": "yarn lint:types && yarn lint:js", "lint": "yarn lint:types && yarn lint:js",
"lint:js": "eslint --max-warnings 57 src spec", "lint:js": "eslint --max-warnings 57 src spec",
"lint:js-fix": "eslint --fix src spec",
"lint:types": "tsc --noEmit", "lint:types": "tsc --noEmit",
"test": "jest", "test": "jest",
"test:watch": "jest --watch", "test:watch": "jest --watch",

View File

@@ -4426,7 +4426,7 @@ export class MatrixClient extends EventEmitter {
* @return {Promise} Resolves: to nothing * @return {Promise} Resolves: to nothing
* @return {module:http-api.MatrixError} Rejects: with an error response. * @return {module:http-api.MatrixError} Rejects: with an error response.
*/ */
public _unstable_setStatusMessage(newMessage: string): Promise<void> { // eslint-disable-line camelcase public _unstable_setStatusMessage(newMessage: string): Promise<void> { // eslint-disable-line
const type = "im.vector.user_status"; const type = "im.vector.user_status";
return Promise.all(this.getRooms().map(async (room) => { return Promise.all(this.getRooms().map(async (room) => {
const isJoined = room.getMyMembership() === "join"; const isJoined = room.getMyMembership() === "join";
@@ -5732,7 +5732,7 @@ export class MatrixClient extends EventEmitter {
* @return {Promise<string[]>} Resolves to a set of rooms * @return {Promise<string[]>} Resolves to a set of rooms
* @return {module:http-api.MatrixError} Rejects: with an error response. * @return {module:http-api.MatrixError} Rejects: with an error response.
*/ */
public async _unstable_getSharedRooms(userId: string): Promise<string[]> { // eslint-disable-line camelcase public async _unstable_getSharedRooms(userId: string): Promise<string[]> { // eslint-disable-line
if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) { if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) {
throw Error('Server does not support shared_rooms API'); throw Error('Server does not support shared_rooms API');
} }

View File

@@ -208,7 +208,7 @@ export class User extends EventEmitter {
* @param {MatrixEvent} event The <code>im.vector.user_status</code> event. * @param {MatrixEvent} event The <code>im.vector.user_status</code> event.
* @fires module:client~MatrixClient#event:"User.unstable_statusMessage" * @fires module:client~MatrixClient#event:"User.unstable_statusMessage"
*/ */
// eslint-disable-next-line camelcase // eslint-disable-next-line
public unstable_updateStatusMessage(event: MatrixEvent): void { public unstable_updateStatusMessage(event: MatrixEvent): void {
if (!event.getContent()) this.unstable_statusMessage = ""; if (!event.getContent()) this.unstable_statusMessage = "";
else this.unstable_statusMessage = event.getContent()["status"]; else this.unstable_statusMessage = event.getContent()["status"];

View File

@@ -642,12 +642,12 @@ export class SyncApi {
// Now wait for the saved sync to finish... // Now wait for the saved sync to finish...
debuglog("Waiting for saved sync before starting sync processing..."); debuglog("Waiting for saved sync before starting sync processing...");
await savedSyncPromise; await savedSyncPromise;
this._sync({ filterId }); this.doSync({ filterId });
}; };
if (client.isGuest()) { if (client.isGuest()) {
// no push rules for guests, no access to POST filter for guests. // no push rules for guests, no access to POST filter for guests.
this._sync({}); this.doSync({});
} else { } else {
// Pull the saved sync token out first, before the worker starts sending // Pull the saved sync token out first, before the worker starts sending
// all the sync data which could take a while. This will let us send our // all the sync data which could take a while. This will let us send our
@@ -753,7 +753,7 @@ export class SyncApi {
* @param {string} syncOptions.filterId * @param {string} syncOptions.filterId
* @param {boolean} syncOptions.hasSyncedBefore * @param {boolean} syncOptions.hasSyncedBefore
*/ */
private async _sync(syncOptions: ISyncOptions): Promise<void> { private async doSync(syncOptions: ISyncOptions): Promise<void> {
const client = this.client; const client = this.client;
if (!this.running) { if (!this.running) {
@@ -850,7 +850,7 @@ export class SyncApi {
} }
// Begin next sync // Begin next sync
this._sync(syncOptions); this.doSync(syncOptions);
} }
private doSyncRequest(syncOptions: ISyncOptions, syncToken: string): IRequestPromise<ISyncResponse> { private doSyncRequest(syncOptions: ISyncOptions, syncToken: string): IRequestPromise<ISyncResponse> {
@@ -955,7 +955,7 @@ export class SyncApi {
catchingUp: true, catchingUp: true,
}); });
} }
this._sync(syncOptions); this.doSync(syncOptions);
}); });
this.currentSyncRequest = null; this.currentSyncRequest = null;

View File

@@ -129,10 +129,10 @@ export function isFunction(value: any) {
* @throws If the object is missing keys. * @throws If the object is missing keys.
*/ */
// note using 'keys' here would shadow the 'keys' function defined above // note using 'keys' here would shadow the 'keys' function defined above
export function checkObjectHasKeys(obj: object, keys_: string[]) { export function checkObjectHasKeys(obj: object, keys: string[]) {
for (let i = 0; i < keys_.length; i++) { for (let i = 0; i < keys.length; i++) {
if (!obj.hasOwnProperty(keys_[i])) { if (!obj.hasOwnProperty(keys[i])) {
throw new Error("Missing required key: " + keys_[i]); throw new Error("Missing required key: " + keys[i]);
} }
} }
} }