From a84b91da8fd394a8748e41b88b9c2242152295e9 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Sun, 16 Jan 2022 22:30:51 +0200 Subject: [PATCH] formatting --- .eslintrc.json | 10 ++++++++-- .../settings/moderation/MuteSetting.js | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 5792719..20f2489 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,6 +14,10 @@ // "sourceType": "module" // }, "rules": { + "max-len": ["warn", { + "code": 140, + "ignoreComments": true + }], "accessor-pairs": "warn", "array-callback-return": "warn", "arrow-parens": "warn", @@ -52,7 +56,7 @@ "func-name-matching": "warn", "func-names": "warn", "func-style": "warn", - "function-paren-newline": "warn", + "function-paren-newline": ["warn", "consistent"], "generator-star-spacing": "warn", "grouped-accessor-pairs": "warn", "guard-for-in": "warn", @@ -157,7 +161,9 @@ "no-var": "warn", "no-void": "warn", "no-whitespace-before-property": "warn", - "nonblock-statement-body-position": "warn", + "nonblock-statement-body-position": ["warn", "any", { + + }], "object-curly-spacing": [ "warn", "always" diff --git a/src/structure/components/settings/moderation/MuteSetting.js b/src/structure/components/settings/moderation/MuteSetting.js index 752b78d..9106ab9 100644 --- a/src/structure/components/settings/moderation/MuteSetting.js +++ b/src/structure/components/settings/moderation/MuteSetting.js @@ -15,7 +15,11 @@ const addField = (array, type) => { }; const sorted = array.sort((a, b) => a.position - b.position) || []; for (const i of sorted) { - const text = `${Emojis.role} **${i.role}** has ${i.permissions.map((p) => `\`${PermissionNames[p]}\``).join(', ')} in ${Emojis[i.type === 'text' ? 'text-channel' : 'voice-channel']} **${i.channel}**\n`; + const text = `${Emojis.role} **${i.role}** has ${i.permissions.map( + (p) => `\`${PermissionNames[p]}\`` + ).join(', ')} in ${Emojis[i.type === 'text' + ? 'text-channel' + : 'voice-channel']} **${i.channel}**\n`; if (field.value.length + text.length <= EmbedLimits.fieldValue) field.value += text; } return field; @@ -264,7 +268,7 @@ class MuteSetting extends Setting { } - async fields(guild) { + fields(guild) { const setting = guild._settings[this.name] || {}; return [ { @@ -277,7 +281,7 @@ class MuteSetting extends Setting { value: `\`${setting.type || 0}\``, inline: true }, - //{ name: '\u200b', value: '\u200b', inline: true }, + { name: '\u200b', value: '\u200b', inline: true }, { name: guild.format('SETTING_MUTE_PERMANENT'), value: guild.format('GENERAL_STATE', { bool: setting.permanent }, { code: true }), @@ -288,7 +292,7 @@ class MuteSetting extends Setting { value: setting.default ? Util.humanise(setting.default) : '`N/A`', inline: true }, - //{ name: '\u200b', value: '\u200b', inline: true } + { name: '\u200b', value: '\u200b', inline: true } ]; } @@ -301,8 +305,10 @@ class MuteSetting extends Setting { return async (interaction) => { if (interaction.isButton()) { if ((/^\d$/u).test(interaction.customId)) setting.type = parseInt(interaction.customId); - else if (['allow_permanent', 'disallow_permanent'].includes(interaction.customId)) setting.allowPermanent = interaction.customId === 'allow_permanent'; - else if ((/\d+h/u).test(interaction.customId)) setting.defaultDuration = this.client.resolver.resolveTime(interaction.customId); + else if (['allow_permanent', 'disallow_permanent'].includes(interaction.customId)) + setting.allowPermanent = interaction.customId === 'allow_permanent'; + else if ((/\d+h/u).test(interaction.customId)) + setting.defaultDuration = this.client.resolver.resolveTime(interaction.customId); } else if (interaction.customId === 'role') { if (interaction.value === 'create') await this.createRole(); [setting.role] = interaction.values;