diff --git a/package.json b/package.json index 0f51a2df2..93f2a74a2 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "gendoc": "jsdoc -c jsdoc.json -P package.json", "lint": "yarn lint:types && yarn lint:js", "lint:js": "eslint --max-warnings 57 src spec", + "lint:js-fix": "eslint --fix src spec", "lint:types": "tsc --noEmit", "test": "jest", "test:watch": "jest --watch", diff --git a/src/client.ts b/src/client.ts index 08e6e5dd2..2e1c97272 100644 --- a/src/client.ts +++ b/src/client.ts @@ -4426,7 +4426,7 @@ export class MatrixClient extends EventEmitter { * @return {Promise} Resolves: to nothing * @return {module:http-api.MatrixError} Rejects: with an error response. */ - public _unstable_setStatusMessage(newMessage: string): Promise { // eslint-disable-line camelcase + public _unstable_setStatusMessage(newMessage: string): Promise { // eslint-disable-line const type = "im.vector.user_status"; return Promise.all(this.getRooms().map(async (room) => { const isJoined = room.getMyMembership() === "join"; @@ -5732,7 +5732,7 @@ export class MatrixClient extends EventEmitter { * @return {Promise} Resolves to a set of rooms * @return {module:http-api.MatrixError} Rejects: with an error response. */ - public async _unstable_getSharedRooms(userId: string): Promise { // eslint-disable-line camelcase + public async _unstable_getSharedRooms(userId: string): Promise { // eslint-disable-line if (!(await this.doesServerSupportUnstableFeature("uk.half-shot.msc2666"))) { throw Error('Server does not support shared_rooms API'); } diff --git a/src/models/user.ts b/src/models/user.ts index 5eff5062c..613a03a69 100644 --- a/src/models/user.ts +++ b/src/models/user.ts @@ -208,7 +208,7 @@ export class User extends EventEmitter { * @param {MatrixEvent} event The im.vector.user_status event. * @fires module:client~MatrixClient#event:"User.unstable_statusMessage" */ - // eslint-disable-next-line camelcase + // eslint-disable-next-line public unstable_updateStatusMessage(event: MatrixEvent): void { if (!event.getContent()) this.unstable_statusMessage = ""; else this.unstable_statusMessage = event.getContent()["status"]; diff --git a/src/sync.ts b/src/sync.ts index 863329808..5f0cf59a8 100644 --- a/src/sync.ts +++ b/src/sync.ts @@ -642,12 +642,12 @@ export class SyncApi { // Now wait for the saved sync to finish... debuglog("Waiting for saved sync before starting sync processing..."); await savedSyncPromise; - this._sync({ filterId }); + this.doSync({ filterId }); }; if (client.isGuest()) { // no push rules for guests, no access to POST filter for guests. - this._sync({}); + this.doSync({}); } else { // 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 @@ -753,7 +753,7 @@ export class SyncApi { * @param {string} syncOptions.filterId * @param {boolean} syncOptions.hasSyncedBefore */ - private async _sync(syncOptions: ISyncOptions): Promise { + private async doSync(syncOptions: ISyncOptions): Promise { const client = this.client; if (!this.running) { @@ -850,7 +850,7 @@ export class SyncApi { } // Begin next sync - this._sync(syncOptions); + this.doSync(syncOptions); } private doSyncRequest(syncOptions: ISyncOptions, syncToken: string): IRequestPromise { @@ -955,7 +955,7 @@ export class SyncApi { catchingUp: true, }); } - this._sync(syncOptions); + this.doSync(syncOptions); }); this.currentSyncRequest = null; diff --git a/src/utils.ts b/src/utils.ts index a392006ea..deff800e5 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -129,10 +129,10 @@ export function isFunction(value: any) { * @throws If the object is missing keys. */ // note using 'keys' here would shadow the 'keys' function defined above -export function checkObjectHasKeys(obj: object, keys_: string[]) { - for (let i = 0; i < keys_.length; i++) { - if (!obj.hasOwnProperty(keys_[i])) { - throw new Error("Missing required key: " + keys_[i]); +export function checkObjectHasKeys(obj: object, keys: string[]) { + for (let i = 0; i < keys.length; i++) { + if (!obj.hasOwnProperty(keys[i])) { + throw new Error("Missing required key: " + keys[i]); } } }