mirror of
https://github.com/matrix-org/mjolnir.git
synced 2024-07-02 17:41:50 +00:00
Lint: Enabling 'noImplicitReturns'
This commit is contained in:
parent
43da763bb2
commit
2a77509f9e
|
@ -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 message = "I am not a Synapse administrator, or the endpoint is blocked";
|
||||||
const reply = RichReply.createFor(inRoomId, event, message, message);
|
const reply = RichReply.createFor(inRoomId, event, message, message);
|
||||||
reply['msgtype'] = "m.notice";
|
reply['msgtype'] = "m.notice";
|
||||||
return mjolnir.client.sendMessage(inRoomId, reply);
|
mjolnir.client.sendMessage(inRoomId, reply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const targetRoomId = await mjolnir.client.resolveRoom(roomRef);
|
const targetRoomId = await mjolnir.client.resolveRoom(roomRef);
|
||||||
|
|
|
@ -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 message = "I am not a Synapse administrator, or the endpoint is blocked";
|
||||||
const reply = RichReply.createFor(roomId, event, message, message);
|
const reply = RichReply.createFor(roomId, event, message, message);
|
||||||
reply['msgtype'] = "m.notice";
|
reply['msgtype'] = "m.notice";
|
||||||
return mjolnir.client.sendMessage(roomId, reply);
|
mjolnir.client.sendMessage(roomId, reply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await mjolnir.client.deleteRoomAlias(movingAlias);
|
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 message = "I am not a Synapse administrator, or the endpoint is blocked";
|
||||||
const reply = RichReply.createFor(roomId, event, message, message);
|
const reply = RichReply.createFor(roomId, event, message, message);
|
||||||
reply['msgtype'] = "m.notice";
|
reply['msgtype'] = "m.notice";
|
||||||
return mjolnir.client.sendMessage(roomId, reply);
|
mjolnir.client.sendMessage(roomId, reply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const newRoomId = await mjolnir.client.resolveRoom(targetRoom);
|
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 message = "I am not a Synapse administrator, or the endpoint is blocked";
|
||||||
const reply = RichReply.createFor(roomId, event, message, message);
|
const reply = RichReply.createFor(roomId, event, message, message);
|
||||||
reply['msgtype'] = "m.notice";
|
reply['msgtype'] = "m.notice";
|
||||||
return mjolnir.client.sendMessage(roomId, reply);
|
mjolnir.client.sendMessage(roomId, reply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await mjolnir.client.deleteRoomAlias(aliasToRemove);
|
await mjolnir.client.deleteRoomAlias(aliasToRemove);
|
||||||
|
|
|
@ -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 message = "I am not a Synapse administrator, or the endpoint is blocked";
|
||||||
const reply = RichReply.createFor(roomId, event, message, message);
|
const reply = RichReply.createFor(roomId, event, message, message);
|
||||||
reply['msgtype'] = "m.notice";
|
reply['msgtype'] = "m.notice";
|
||||||
return mjolnir.client.sendMessage(roomId, reply);
|
mjolnir.client.sendMessage(roomId, reply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await mjolnir.deactivateSynapseUser(victim);
|
await mjolnir.deactivateSynapseUser(victim);
|
||||||
|
|
|
@ -28,7 +28,8 @@ export async function execImportCommand(roomId: string, event: any, mjolnir: Mjo
|
||||||
const errMessage = "Unable to find list - check your shortcode.";
|
const errMessage = "Unable to find list - check your shortcode.";
|
||||||
const errReply = RichReply.createFor(roomId, event, errMessage, errMessage);
|
const errReply = RichReply.createFor(roomId, event, errMessage, errMessage);
|
||||||
errReply["msgtype"] = "m.notice";
|
errReply["msgtype"] = "m.notice";
|
||||||
return mjolnir.client.sendMessage(roomId, errReply);
|
mjolnir.client.sendMessage(roomId, errReply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let importedRules = 0;
|
let importedRules = 0;
|
||||||
|
|
|
@ -27,7 +27,8 @@ export async function execSetDefaultListCommand(roomId: string, event: any, mjol
|
||||||
const replyText = "No ban list with that shortcode was found.";
|
const replyText = "No ban list with that shortcode was found.";
|
||||||
const reply = RichReply.createFor(roomId, event, replyText, replyText);
|
const reply = RichReply.createFor(roomId, event, replyText, replyText);
|
||||||
reply["msgtype"] = "m.notice";
|
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});
|
await mjolnir.client.setAccountData(DEFAULT_LIST_EVENT_TYPE, {shortcode});
|
||||||
|
|
|
@ -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 message = "I am not a Synapse administrator, or the endpoint is blocked";
|
||||||
const reply = RichReply.createFor(roomId, event, message, message);
|
const reply = RichReply.createFor(roomId, event, message, message);
|
||||||
reply['msgtype'] = "m.notice";
|
reply['msgtype'] = "m.notice";
|
||||||
return mjolnir.client.sendMessage(roomId, reply);
|
mjolnir.client.sendMessage(roomId, reply);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await mjolnir.shutdownSynapseRoom(await mjolnir.client.resolveRoom(victim));
|
await mjolnir.shutdownSynapseRoom(await mjolnir.client.resolveRoom(victim));
|
||||||
|
|
|
@ -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 replyText = "Cannot watch list due to error - is that a valid room alias?";
|
||||||
const reply = RichReply.createFor(roomId, event, replyText, replyText);
|
const reply = RichReply.createFor(roomId, event, replyText, replyText);
|
||||||
reply["msgtype"] = "m.notice";
|
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'], '✅');
|
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 replyText = "Cannot unwatch list due to error - is that a valid room alias?";
|
||||||
const reply = RichReply.createFor(roomId, event, replyText, replyText);
|
const reply = RichReply.createFor(roomId, event, replyText, replyText);
|
||||||
reply["msgtype"] = "m.notice";
|
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'], '✅');
|
await mjolnir.client.unstableApis.addReactionToEvent(roomId, event['event_id'], '✅');
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,12 @@ export class ListRule {
|
||||||
this.glob = new MatrixGlob(entity);
|
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;
|
if (RECOMMENDATION_BAN_TYPES.includes(this.action)) return RECOMMENDATION_BAN;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public isMatch(entity: string): boolean {
|
public isMatch(entity: string): boolean {
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"alwaysStrict": true,
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
"module": "commonjs",
|
"module": "commonjs",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
|
"noImplicitReturns": true,
|
||||||
"target": "es2015",
|
"target": "es2015",
|
||||||
"noImplicitAny": false,
|
"noImplicitAny": false,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user