Skip to content

Commit

Permalink
Lint fixes and format as part of the pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremy-rifkin committed Aug 6, 2023
1 parent c3d7dc6 commit 53efb91
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 18 deletions.
9 changes: 3 additions & 6 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,6 @@ rules:
semi:
- error
- always
quotes:
- error
- double
no-unused-vars:
- off
no-constant-condition:
Expand All @@ -49,9 +46,6 @@ rules:
object-curly-spacing:
- error
- always
space-in-parens:
- error
- never
comma-spacing:
- error
computed-property-spacing:
Expand All @@ -65,6 +59,9 @@ rules:
semi-style:
- error
- last
prefer-const:
- error
- destructuring: all
"prettier/prettier": "error"
"@typescript-eslint/no-unused-vars":
- warn
Expand Down
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
. "$(dirname -- "$0")/_/husky.sh"

#tsc --noEmit
npm run format
npx lint-staged
#npm test
2 changes: 1 addition & 1 deletion src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@ export class TextBasedCommand extends Command {
this.member = reply_object.member;
this.user = reply_object.author;
}
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
} else if (args[0] == "c") {
// eslint-disable-line @typescript-eslint/no-unnecessary-condition
// construct from copy, used for edit
const [_, command, name, reply_object] = args;
this.name = name;
Expand Down
6 changes: 3 additions & 3 deletions src/components/buzzwords.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ export default class Buzzwords extends BotComponent {
}

override async on_ready() {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (ENABLED) {
// eslint-disable-line @typescript-eslint/no-unnecessary-condition
//await this.update_database();
//this.timeout = setTimeout(() => {
// this.update_database().catch(critical_error);
Expand Down Expand Up @@ -248,8 +248,8 @@ export default class Buzzwords extends BotComponent {
}

async updateRolesSingle(member: Discord.GuildMember) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (ENABLED) {
// eslint-disable-line @typescript-eslint/no-unnecessary-condition
// TODO: If we ever do this joke again, cache the quantiles from reflowRoles to save an expensive database
// query and computation here
const entries = await this.wheatley.database.buzzword_scoreboard.find().toArray();
Expand Down Expand Up @@ -448,8 +448,8 @@ export default class Buzzwords extends BotComponent {
});
}
// check the message for buzzwords
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (ENABLED) {
// eslint-disable-line @typescript-eslint/no-unnecessary-condition
if (!this.slowmode.has(message.author.id)) {
let total_score = 0;
let count = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/components/forum-channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ export default class ForumChannels extends BotComponent {
colors.red,
"When your question is answered use **`!solved`** to " +
"mark the question as resolved.\n\nRemember to ask __specific questions__, provide " +
"__necessary details__, and reduce your question to its __simplest form__. For tips on how " +
"to ask a good question run `!howto ask`.",
"__necessary details__, and reduce your question to its __simplest form__. For tips " +
"on how to ask a good question run `!howto ask`.",
),
],
});
Expand Down
6 changes: 4 additions & 2 deletions src/components/inspect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ export default class Inspect extends BotComponent {
"Attachments: " +
JSON.stringify(
message.attachments.map(
// This looks silly, but it is the best way I can think of to call all the getters and re-package
// This looks silly, but it is the best way I can think of to call all the getters and
// re-package
({
contentType,
description,
Expand Down Expand Up @@ -96,7 +97,8 @@ export default class Inspect extends BotComponent {
"Embeds: " +
JSON.stringify(
message.embeds.map(
// This looks silly, but it is the best way I can think of to call all the getters and re-package
// This looks silly, but it is the best way I can think of to call all the getters and
// re-package
({
author,
color,
Expand Down
6 changes: 3 additions & 3 deletions src/components/modmail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ export default class Modmail extends BotComponent {
create_embed(
"Modmail",
"If you have a **moderation** or **administration** related issue you " +
"can reach out to the staff team by pressing the modmail thread button below.\n\nBecause, in " +
"our experience, a surprising number of users also can't read, there is also a monkey " +
"button.",
"can reach out to the staff team by pressing the modmail thread button below.\n\n" +
"Because, in our experience, a surprising number of users also can't read, there is also " +
"a monkey button.",
),
],
components: [row],
Expand Down
1 change: 0 additions & 1 deletion src/infra/member-tracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class MemberTracker {
// -- ping/link maps --
for (const map of [this.ping_map, this.link_map]) {
for (let [k, v] of map) {
/* eslint-disable-line prefer-const */
v = v.filter(m => now - m.createdTimestamp <= LOG_DURATION);
if (v.length == 0) {
this.ping_map.delete(k);
Expand Down

0 comments on commit 53efb91

Please sign in to comment.