Skip to content

Commit

Permalink
chore: eslint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sogehige committed Feb 4, 2025
1 parent f3f249e commit 4bf7490
Show file tree
Hide file tree
Showing 67 changed files with 446 additions and 440 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ dependencies:

eslint:
@echo -ne "\n\t ----- Checking eslint\n"
NODE_OPTIONS="--max-old-space-size=4096" npx eslint --ext .ts src --quiet
NODE_OPTIONS="--max-old-space-size=4096" npx eslint src --quiet

jsonlint:
@echo -ne "\n\t ----- Checking jsonlint\n"
Expand Down
2 changes: 2 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ export default [{

"@typescript-eslint/camelcase": "off",
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unused-expressions": "off",
"no-constant-binary-expression": "off",
"@typescript-eslint/explicit-function-return-type": 0,
"@typescript-eslint/no-use-before-define": 0,
"@typescript-eslint/class-name-casing": 0,
Expand Down
2 changes: 1 addition & 1 deletion src/_interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { randomUUID } from 'node:crypto';
import { setTimeout } from 'timers';

import chalk from 'chalk';
import { every, isEqual, set, isNil, cloneDeep, isFunction, get } from 'lodash-es';
import type { Namespace } from 'socket.io/dist/namespace';

import { ClientToServerEventsWithNamespace } from '../d.ts/src/helpers/socket.js';
Expand All @@ -28,7 +29,6 @@ import defaultPermissions from '~/helpers/permissions/defaultPermissions.js';
import { register } from '~/helpers/register.js';
import { addScope, withScope } from '~/helpers/socket.js';
import * as watchers from '~/watchers.js';
import { every, isEqual, set, isNil, cloneDeep, isFunction, get } from 'lodash-es';

let socket: import('~/socket').Socket | any = null;

Expand Down
2 changes: 1 addition & 1 deletion src/currency.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import chalk from 'chalk';
import { isNil } from 'lodash-es';

import currentRates from './helpers/currency/rates.js';

Expand All @@ -12,7 +13,6 @@ import { settings, ui } from '~/decorators.js';
import exchange from '~/helpers/currency/exchange.js';
import { mainCurrency } from '~/helpers/currency/index.js';
import { info } from '~/helpers/log.js';
import { isNil } from 'lodash-es';

class Currency extends Core {
mainCurrencyLoaded = false;
Expand Down
28 changes: 14 additions & 14 deletions src/dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,20 @@ import { settings } from '~/decorators.js';
class Dashboard extends Core {

@settings(undefined, false)
µWidgets = [
'twitch|status|' + randomUUID(),
'twitch|uptime|' + randomUUID(),
'twitch|viewers|' + randomUUID(),
'twitch|maxViewers|' + randomUUID(),
'twitch|newChatters|' + randomUUID(),
'twitch|chatMessages|' + randomUUID(),
'twitch|followers|' + randomUUID(),
'twitch|subscribers|' + randomUUID(),
'twitch|bits|' + randomUUID(),
'general|tips|' + randomUUID(),
'twitch|watchedTime|' + randomUUID(),
'general|currentSong|' + randomUUID(),
];
µWidgets = [
'twitch|status|' + randomUUID(),
'twitch|uptime|' + randomUUID(),
'twitch|viewers|' + randomUUID(),
'twitch|maxViewers|' + randomUUID(),
'twitch|newChatters|' + randomUUID(),
'twitch|chatMessages|' + randomUUID(),
'twitch|followers|' + randomUUID(),
'twitch|subscribers|' + randomUUID(),
'twitch|bits|' + randomUUID(),
'general|tips|' + randomUUID(),
'twitch|watchedTime|' + randomUUID(),
'general|currentSong|' + randomUUID(),
];
}

const dashboard = new Dashboard();
Expand Down
18 changes: 9 additions & 9 deletions src/database/entity/alias.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ export class Alias extends BotEntity {
});

@PrimaryColumn({ generated: 'uuid' })
id: string;
id: string;

@Column()
@Index('IDX_6a8a594f0a5546f8082b0c405c')
alias: string;
alias: string;

@Column({ type: 'text' })
command: string;
command: string;

@Column()
enabled: boolean;
enabled: boolean;

@Column()
visible: boolean;
visible: boolean;

@Column({ nullable: true, type: String })
permission: string | null;
permission: string | null;

@Column({ nullable: true, type: String })
group: string | null;
group: string | null;
}

@Entity()
Expand All @@ -43,10 +43,10 @@ export class AliasGroup extends BotEntity {

@PrimaryColumn()
@Index('IDX_alias_group_unique_name', { unique: true })
name: string;
name: string;

@Column({ type: 'simple-json' })
options: {
options: {
filter: string | null;
permission: string | null;
};
Expand Down
4 changes: 2 additions & 2 deletions src/database/entity/checklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { BotEntity } from '../BotEntity.js';
@Entity()
export class Checklist extends BotEntity {
@PrimaryColumn()
id: string;
id: string;

@Column()
isCompleted: boolean;
isCompleted: boolean;
}
24 changes: 12 additions & 12 deletions src/database/entity/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ export class Commands extends BotEntity {
});

@PrimaryColumn({ generated: 'uuid', type: 'uuid' })
id: string;
id: string;

@Column()
@Index('IDX_1a8c40f0a581447776c325cb4f')
command: string;
command: string;

@Column()
enabled: boolean;
enabled: boolean;

@Column()
visible: boolean;
visible: boolean;

@Column({ nullable: true, type: String })
group: string | null;
group: string | null;

@Column({ default: false })
areResponsesRandomized: boolean;
areResponsesRandomized: boolean;

@Column({ type: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') !== 'better-sqlite3' ? 'json' : 'simple-json' })
responses: {
responses: {
id: string;
order: number;
response: string;
Expand All @@ -44,10 +44,10 @@ export class Commands extends BotEntity {
export class CommandsGroup extends BaseEntity {
@PrimaryColumn()
@Index('IDX_commands_group_unique_name', { unique: true })
name: string;
name: string;

@Column({ type: 'simple-json' })
options: {
options: {
filter: string | null;
permission: string | null;
};
Expand All @@ -56,12 +56,12 @@ export class CommandsGroup extends BaseEntity {
@Entity()
export class CommandsCount extends BaseEntity {
@PrimaryColumn({ generated: 'uuid', type: 'uuid' })
id: string;
id: string;

@Index('IDX_2ccf816b1dd74e9a02845c4818')
@Column()
command: string;
command: string;

@Column({ type: 'varchar', length: '2022-07-27T00:30:34.569259834Z'.length })
timestamp: string;
timestamp: string;
}
20 changes: 10 additions & 10 deletions src/database/entity/cooldown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,33 @@ export class Cooldown extends BotEntity {
});

@PrimaryColumn({ generated: 'uuid', type: 'uuid' })
id: string;
id: string;

@Column()
@Index('IDX_aa85aa267ec6eaddf7f93e3665', { unique: true })
name: string;
name: string;

@Column()
miliseconds: number;
miliseconds: number;

@Column({ type: 'varchar', length: 10 })
type: 'global' | 'user';
type: 'global' | 'user';

@Column({ type: 'varchar', length: '2022-07-27T00:30:34.569259834Z'.length })
timestamp: string;
timestamp: string;

@Column()
isEnabled: boolean;
isEnabled: boolean;

@Column()
isErrorMsgQuiet: boolean;
isErrorMsgQuiet: boolean;

@Column()
isOwnerAffected: boolean;
isOwnerAffected: boolean;

@Column()
isModeratorAffected: boolean;
isModeratorAffected: boolean;

@Column()
isSubscriberAffected: boolean;
isSubscriberAffected: boolean;
}
16 changes: 8 additions & 8 deletions src/database/entity/event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ class Definitions {

export class Generic {
@Column({ type: 'text' })
name: string;
name: string;

@Column({ type: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') !== 'better-sqlite3' ? 'json' : 'simple-json' })
triggered: Record<string, never>;
triggered: Record<string, never>;

// TODO: write validator for all definitions if keys exist
@Column({ type: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') !== 'better-sqlite3' ? 'json' : 'simple-json' })
definitions: Definitions;
definitions: Definitions;
}
export class CommandSendXTimes {
name: 'command-send-x-times';
Expand Down Expand Up @@ -301,22 +301,22 @@ export class Event extends BotEntity {
});

@PrimaryColumn({ generated: 'uuid' })
id: string;
id: string;

@Column(() => Generic)
event:
event:
NumberOfViewersIsAtLeastX | StreamIsRunningXMinutes |
CommandSendXTimes | KeywordSendXTimes | RewardRedeemed | Raid |
EveryXMinutesOfStream | Generic;

@Column()
isEnabled: boolean;
isEnabled: boolean;

@Column()
filter: string;
filter: string;

@Column({ type: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') !== 'better-sqlite3' ? 'json' : 'simple-json' })
operations: Operations[];
operations: Operations[];
}

const defaultEventValidationSchema = (key: string) => z.object({
Expand Down
15 changes: 8 additions & 7 deletions src/database/entity/highlight.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
import { BeforeInsert, Column, Entity, PrimaryColumn } from 'typeorm';

import { BotEntity } from '../BotEntity.js';

@Entity()
export class Highlight extends BotEntity {
@PrimaryColumn({ generated: 'uuid', type: 'uuid' })
id: string;
id: string;

@Column()
videoId: string;
videoId: string;

@Column()
game: string;
game: string;

@Column()
title: string;
title: string;

@Column({ default: false })
expired: boolean;
expired: boolean;

@Column({ type: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') !== 'better-sqlite3' ? 'json' : 'simple-json' })
timestamp: {
timestamp: {
hours: number; minutes: number; seconds: number;
};

@Column({ nullable: false, type: 'varchar', length: '2022-07-27T00:30:34.569259834Z'.length })
createdAt?: string;
createdAt?: string;

@BeforeInsert()
generateCreatedAt() {
Expand Down
18 changes: 9 additions & 9 deletions src/database/entity/howLongToBeatGame.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ export class HowLongToBeatGame extends BotEntity {
});

@PrimaryColumn({ generated: 'uuid', type: 'uuid' })
id: string;
id: string;

@Column()
game: string;
game: string;

@Column({ nullable: false, type: 'varchar', length: '2022-07-27T00:30:34.569259834Z'.length })
startedAt?: string;
startedAt?: string;

@BeforeInsert()
generateStartedAt() {
this.startedAt = new Date().toISOString();
}

@Column({ nullable: false, type: 'varchar', length: '2022-07-27T00:30:34.569259834Z'.length })
updatedAt?: string;
updatedAt?: string;

@BeforeInsert()
@BeforeUpdate()
Expand All @@ -35,19 +35,19 @@ export class HowLongToBeatGame extends BotEntity {
}

@Column({ type: 'float', default: 0, precision: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') === 'mysql' ? 12 : undefined })
gameplayMain: number;
gameplayMain: number;

@Column({ type: 'float', default: 0, precision: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') === 'mysql' ? 12 : undefined })
gameplayMainExtra: number;
gameplayMainExtra: number;

@Column({ type: 'float', default: 0, precision: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') === 'mysql' ? 12 : undefined })
gameplayCompletionist: number;
gameplayCompletionist: number;

@Column({ type: 'bigint', transformer: new ColumnNumericTransformer(), default: 0 })
offset: number;
offset: number;

@Column({ type: (process.env.TYPEORM_CONNECTION ?? 'better-sqlite3') !== 'better-sqlite3' ? 'json' : 'simple-json' })
streams: {
streams: {
createdAt: string;
timestamp: number;
offset: number;
Expand Down
Loading

0 comments on commit 4bf7490

Please sign in to comment.