Skip to content

Commit ff2e78c

Browse files
committed
[eslint] function-paren-newline: error, multiline
1 parent 337f6e2 commit ff2e78c

26 files changed

+154
-86
lines changed

.eslintrc.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@
153153
"allowArrowFunctions": true
154154
}
155155
],
156+
"function-paren-newline": ["error", "multiline"],
156157
"key-spacing": "error",
157158
"keyword-spacing": "error",
158159
"lines-around-comment": "error",

handlers/commands/addCommand.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,17 @@ const addCommandHandler = async ({ chat, reply, state }) => {
1111
if (chat.type !== 'private') return null;
1212

1313
if (!isAdmin) {
14-
return reply('ℹ️ <b>Sorry, only admins access this command.</b>',
15-
replyOptions);
14+
return reply(
15+
'ℹ️ <b>Sorry, only admins access this command.</b>',
16+
replyOptions
17+
);
1618
}
1719
await addCommand({ id: user.id });
18-
return reply('Enter a name for the command without forward slash "/".' +
20+
return reply(
21+
'Enter a name for the command without forward slash "/".' +
1922
'\n\nFor example: <b>rules</b>',
20-
replyOptions);
23+
replyOptions
24+
);
2125
};
2226

2327
module.exports = addCommandHandler;

handlers/commands/admin.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ const adminHandler = async ({ message, reply, state }) => {
3131
}
3232

3333
if (await isAdmin(userToAdmin)) {
34-
return reply(`⭐️ ${link(userToAdmin)} <b>is already admin.</b>`,
35-
replyOptions);
34+
return reply(
35+
`⭐️ ${link(userToAdmin)} <b>is already admin.</b>`,
36+
replyOptions
37+
);
3638
}
3739

3840
if (await getWarns(userToAdmin)) {

handlers/commands/ban.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ const banHandler = async ({ chat, message, reply, telegram, me, state }) => {
2323
const reason = message.text.split(' ').slice(1).join(' ').trim();
2424

2525
if (!userToBan) {
26-
return reply('ℹ️ <b>Reply to a message or mention a user.</b>',
27-
replyOptions).then(scheduleDeletion);
26+
return reply(
27+
'ℹ️ <b>Reply to a message or mention a user.</b>',
28+
replyOptions
29+
).then(scheduleDeletion);
2830
}
2931

3032
if (message.chat.type === 'private' || userToBan.username === me) {
@@ -43,12 +45,15 @@ const banHandler = async ({ chat, message, reply, telegram, me, state }) => {
4345
if (message.reply_to_message) {
4446
bot.telegram.deleteMessage(
4547
chat.id,
46-
message.reply_to_message.message_id);
48+
message.reply_to_message.message_id
49+
);
4750
}
4851

4952
if (await isBanned(userToBan)) {
50-
return reply(`🚫 ${link(userToBan)} <b>is already banned.</b>`,
51-
replyOptions);
53+
return reply(
54+
`🚫 ${link(userToBan)} <b>is already banned.</b>`,
55+
replyOptions
56+
);
5257
}
5358

5459
try {

handlers/commands/getwarns.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ const getWarnsHandler = async ({ message, reply, state }) => {
1919
? message.commandMention
2020
: null;
2121
if (!theUser) {
22-
return reply('ℹ️ <b>Reply to a message or mention a user.</b>',
23-
replyOptions).then(scheduleDeletion);
22+
return reply(
23+
'ℹ️ <b>Reply to a message or mention a user.</b>',
24+
replyOptions
25+
).then(scheduleDeletion);
2426
}
2527
let i = 0;
2628
const warns = await getWarns(theUser);

handlers/commands/groups.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,10 @@ const groupsHandler = async ({ replyWithHTML }) => {
2525

2626
const entries = groups.map(entry).join('\n');
2727

28-
return replyWithHTML(
29-
`🛠 <b>Groups I manage</b>:\n\n${entries}`, {
30-
disable_web_page_preview: true,
31-
reply_markup,
32-
}).then(scheduleDeletion);
28+
return replyWithHTML(`🛠 <b>Groups I manage</b>:\n\n${entries}`, {
29+
disable_web_page_preview: true,
30+
reply_markup,
31+
}).then(scheduleDeletion);
3332
};
3433

3534
module.exports = groupsHandler;

handlers/commands/help.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ const helpHandler = ({ chat, replyWithHTML }) => {
2323

2424
return replyWithHTML(
2525
message,
26-
Markup.inlineKeyboard(
27-
[ Markup.urlButton('🛠 Setup a New Bot', homepage) ])
28-
.extra());
26+
Markup.inlineKeyboard([
27+
Markup.urlButton('🛠 Setup a New Bot', homepage)
28+
]).extra()
29+
);
2930
};
3031

3132
module.exports = helpHandler;

handlers/commands/leave.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ const leaveCommandHandler = async ctx => {
1515
: { title: groupName };
1616
const isGroup = await managesGroup(group);
1717
if (!isGroup) {
18+
// eslint-disable-next-line function-paren-newline
1819
return replyWithHTML(
1920
'ℹ️ <b>Couldn\'t find a group with that ID/name.</b>'
21+
// eslint-disable-next-line function-paren-newline
2022
);
2123
}
2224
await Promise.all([
2325
removeGroup(isGroup),
2426
telegram.leaveChat(isGroup.id)
2527
]);
26-
return replyWithHTML(
27-
'✅ <b>I no longer manage that group.</b>'
28-
);
28+
return replyWithHTML('✅ <b>I no longer manage that group.</b>');
2929
}
3030

3131
await removeGroup(chat);

handlers/commands/link.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ const { managesGroup } = require('../../stores/group');
99
const linkHandler = async ({ chat, replyWithHTML }) => {
1010
const group = await managesGroup({ id: chat.id });
1111

12-
return replyWithHTML(
13-
'ℹ️ <b>Group\'s link:</b>\n\n' +
14-
`<a href="${group.link}">${group.title}</a>`
15-
).then(scheduleDeletion);
12+
return replyWithHTML('ℹ️ <b>Group\'s link:</b>\n\n' +
13+
`<a href="${group.link}">${group.title}</a>`).then(scheduleDeletion);
1614
};
1715

1816
module.exports = linkHandler;

handlers/commands/nowarns.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ const nowarnsHandler = async ({ message, reply, state }) => {
2121
: null;
2222

2323
if (!userToUnwarn) {
24-
return reply('ℹ️ <b>Reply to a message or mention a user.</b>',
25-
replyOptions).then(scheduleDeletion);
24+
return reply(
25+
'ℹ️ <b>Reply to a message or mention a user.</b>',
26+
replyOptions
27+
).then(scheduleDeletion);
2628
}
2729

2830
const warns = await getWarns(userToUnwarn);
2931

3032
if (!warns) {
31-
return reply(`ℹ️ ${link(userToUnwarn)} <b>already has no warnings.</b>`,
32-
replyOptions);
33+
return reply(
34+
`ℹ️ ${link(userToUnwarn)} <b>already has no warnings.</b>`,
35+
replyOptions
36+
);
3337
}
3438
try {
3539
await nowarns(userToUnwarn);
@@ -40,7 +44,8 @@ const nowarnsHandler = async ({ message, reply, state }) => {
4044
return reply(
4145
`♻️ ${link(user)} <b>pardoned</b> ${link(userToUnwarn)} ` +
4246
'<b>for all of their warnings.</b>',
43-
replyOptions);
47+
replyOptions
48+
);
4449
};
4550

4651

0 commit comments

Comments
 (0)