Lint: Enabling 'noImplicitReturns'

This commit is contained in:
David Teller 2021-07-22 08:24:12 +02:00
parent 43da763bb2
commit 2a77509f9e
9 changed files with 27 additions and 11 deletions

View File

@ -23,7 +23,8 @@ async function addRemoveFromDirectory(inRoomId: string, event: any, mjolnir: Mjo
const message = "I am not a Synapse administrator, or the endpoint is blocked";
const reply = RichReply.createFor(inRoomId, event, message, message);
reply['msgtype'] = "m.notice";
return mjolnir.client.sendMessage(inRoomId, reply);
mjolnir.client.sendMessage(inRoomId, reply);
return;
}
const targetRoomId = await mjolnir.client.resolveRoom(roomRef);

View File

@ -28,7 +28,8 @@ export async function execMoveAliasCommand(roomId: string, event: any, mjolnir:
const message = "I am not a Synapse administrator, or the endpoint is blocked";
const reply = RichReply.createFor(roomId, event, message, message);
reply['msgtype'] = "m.notice";
return mjolnir.client.sendMessage(roomId, reply);
mjolnir.client.sendMessage(roomId, reply);
return;
}
await mjolnir.client.deleteRoomAlias(movingAlias);
@ -48,7 +49,8 @@ export async function execAddAliasCommand(roomId: string, event: any, mjolnir: M
const message = "I am not a Synapse administrator, or the endpoint is blocked";
const reply = RichReply.createFor(roomId, event, message, message);
reply['msgtype'] = "m.notice";
return mjolnir.client.sendMessage(roomId, reply);
mjolnir.client.sendMessage(roomId, reply);
return;
}
const newRoomId = await mjolnir.client.resolveRoom(targetRoom);
@ -66,7 +68,8 @@ export async function execRemoveAliasCommand(roomId: string, event: any, mjolnir
const message = "I am not a Synapse administrator, or the endpoint is blocked";
const reply = RichReply.createFor(roomId, event, message, message);
reply['msgtype'] = "m.notice";
return mjolnir.client.sendMessage(roomId, reply);
mjolnir.client.sendMessage(roomId, reply);
return;
}
await mjolnir.client.deleteRoomAlias(aliasToRemove);

View File

@ -26,7 +26,8 @@ export async function execDeactivateCommand(roomId: string, event: any, mjolnir:
const message = "I am not a Synapse administrator, or the endpoint is blocked";
const reply = RichReply.createFor(roomId, event, message, message);
reply['msgtype'] = "m.notice";
return mjolnir.client.sendMessage(roomId, reply);
mjolnir.client.sendMessage(roomId, reply);
return;
}
await mjolnir.deactivateSynapseUser(victim);

View File

@ -28,7 +28,8 @@ export async function execImportCommand(roomId: string, event: any, mjolnir: Mjo
const errMessage = "Unable to find list - check your shortcode.";
const errReply = RichReply.createFor(roomId, event, errMessage, errMessage);
errReply["msgtype"] = "m.notice";
return mjolnir.client.sendMessage(roomId, errReply);
mjolnir.client.sendMessage(roomId, errReply);
return;
}
let importedRules = 0;

View File

@ -27,7 +27,8 @@ export async function execSetDefaultListCommand(roomId: string, event: any, mjol
const replyText = "No ban list with that shortcode was found.";
const reply = RichReply.createFor(roomId, event, replyText, replyText);
reply["msgtype"] = "m.notice";
return mjolnir.client.sendMessage(roomId, reply);
mjolnir.client.sendMessage(roomId, reply);
return;
}
await mjolnir.client.setAccountData(DEFAULT_LIST_EVENT_TYPE, {shortcode});

View File

@ -26,7 +26,8 @@ export async function execShutdownRoomCommand(roomId: string, event: any, mjolni
const message = "I am not a Synapse administrator, or the endpoint is blocked";
const reply = RichReply.createFor(roomId, event, message, message);
reply['msgtype'] = "m.notice";
return mjolnir.client.sendMessage(roomId, reply);
mjolnir.client.sendMessage(roomId, reply);
return;
}
await mjolnir.shutdownSynapseRoom(await mjolnir.client.resolveRoom(victim));

View File

@ -24,7 +24,8 @@ export async function execWatchCommand(roomId: string, event: any, mjolnir: Mjol
const replyText = "Cannot watch list due to error - is that a valid room alias?";
const reply = RichReply.createFor(roomId, event, replyText, replyText);
reply["msgtype"] = "m.notice";
return mjolnir.client.sendMessage(roomId, reply);
mjolnir.client.sendMessage(roomId, reply);
return;
}
await mjolnir.client.unstableApis.addReactionToEvent(roomId, event['event_id'], '✅');
}
@ -36,7 +37,8 @@ export async function execUnwatchCommand(roomId: string, event: any, mjolnir: Mj
const replyText = "Cannot unwatch list due to error - is that a valid room alias?";
const reply = RichReply.createFor(roomId, event, replyText, replyText);
reply["msgtype"] = "m.notice";
return mjolnir.client.sendMessage(roomId, reply);
mjolnir.client.sendMessage(roomId, reply);
return;
}
await mjolnir.client.unstableApis.addReactionToEvent(roomId, event['event_id'], '✅');
}

View File

@ -32,8 +32,12 @@ export class ListRule {
this.glob = new MatrixGlob(entity);
}
public get recommendation(): string {
/**
* The recommendation for this rule, or `null` if there is no recommendation or the recommendation is invalid.
*/
public get recommendation(): string|null {
if (RECOMMENDATION_BAN_TYPES.includes(this.action)) return RECOMMENDATION_BAN;
return null;
}
public isMatch(entity: string): boolean {

View File

@ -1,9 +1,11 @@
{
"compilerOptions": {
"alwaysStrict": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitReturns": true,
"target": "es2015",
"noImplicitAny": false,
"sourceMap": true,