feat: eslint 적용 및 관련 코드 일괄 수정

This commit is contained in:
2026-01-05 15:46:47 +00:00
parent cb312f02b3
commit c965b1120f
387 changed files with 39808 additions and 38800 deletions
+12 -46
View File
@@ -1,9 +1,4 @@
import {
LogCategory,
type LogEntryDraft,
LogFormat,
LogScope,
} from './types.js';
import { LogCategory, type LogEntryDraft, LogFormat, LogScope } from './types.js';
export class ActionLogger {
private readonly generalId: number | undefined;
@@ -26,62 +21,42 @@ export class ActionLogger {
return backup;
}
public pushGeneralHistoryLog(
text: string | string[],
format: LogFormat = LogFormat.YEAR_MONTH
): void {
public pushGeneralHistoryLog(text: string | string[], format: LogFormat = LogFormat.YEAR_MONTH): void {
this.pushBatch(text, (message) => ({
scope: LogScope.GENERAL,
category: LogCategory.HISTORY,
text: message,
...(this.generalId !== undefined
? { generalId: this.generalId }
: {}),
...(this.generalId !== undefined ? { generalId: this.generalId } : {}),
format,
}));
}
public pushGeneralActionLog(
text: string | string[],
format: LogFormat = LogFormat.MONTH
): void {
public pushGeneralActionLog(text: string | string[], format: LogFormat = LogFormat.MONTH): void {
this.pushBatch(text, (message) => ({
scope: LogScope.GENERAL,
category: LogCategory.ACTION,
text: message,
...(this.generalId !== undefined
? { generalId: this.generalId }
: {}),
...(this.generalId !== undefined ? { generalId: this.generalId } : {}),
format,
}));
}
public pushGeneralBattleResultLog(
text: string | string[],
format: LogFormat = LogFormat.RAWTEXT
): void {
public pushGeneralBattleResultLog(text: string | string[], format: LogFormat = LogFormat.RAWTEXT): void {
this.pushBatch(text, (message) => ({
scope: LogScope.GENERAL,
category: LogCategory.BATTLE_BRIEF,
text: message,
...(this.generalId !== undefined
? { generalId: this.generalId }
: {}),
...(this.generalId !== undefined ? { generalId: this.generalId } : {}),
format,
}));
}
public pushGeneralBattleDetailLog(
text: string | string[],
format: LogFormat = LogFormat.PLAIN
): void {
public pushGeneralBattleDetailLog(text: string | string[], format: LogFormat = LogFormat.PLAIN): void {
this.pushBatch(text, (message) => ({
scope: LogScope.GENERAL,
category: LogCategory.BATTLE_DETAIL,
text: message,
...(this.generalId !== undefined
? { generalId: this.generalId }
: {}),
...(this.generalId !== undefined ? { generalId: this.generalId } : {}),
format,
}));
}
@@ -103,10 +78,7 @@ export class ActionLogger {
}));
}
public pushGlobalHistoryLog(
text: string | string[],
format: LogFormat = LogFormat.YEAR_MONTH
): void {
public pushGlobalHistoryLog(text: string | string[], format: LogFormat = LogFormat.YEAR_MONTH): void {
this.pushBatch(text, (message) => ({
scope: LogScope.SYSTEM,
category: LogCategory.HISTORY,
@@ -115,10 +87,7 @@ export class ActionLogger {
}));
}
public pushGlobalActionLog(
text: string | string[],
format: LogFormat = LogFormat.MONTH
): void {
public pushGlobalActionLog(text: string | string[], format: LogFormat = LogFormat.MONTH): void {
this.pushBatch(text, (message) => ({
scope: LogScope.SYSTEM,
category: LogCategory.SUMMARY,
@@ -127,10 +96,7 @@ export class ActionLogger {
}));
}
private pushBatch(
text: string | string[],
builder: (message: string) => LogEntryDraft
): void {
private pushBatch(text: string | string[], builder: (message: string) => LogEntryDraft): void {
if (Array.isArray(text)) {
for (const item of text) {
if (item) {
+2 -11
View File
@@ -1,11 +1,5 @@
import { formatLogText } from './formatter.js';
import {
type LogContext,
type LogEntryDraft,
type LogEntryRecord,
LogFormat,
LogScope,
} from './types.js';
import { type LogContext, type LogEntryDraft, type LogEntryRecord, LogFormat, LogScope } from './types.js';
const shouldDropEntry = (entry: LogEntryDraft): boolean => {
if (entry.scope === LogScope.GENERAL && !entry.generalId) {
@@ -20,10 +14,7 @@ const shouldDropEntry = (entry: LogEntryDraft): boolean => {
return false;
};
export const finalizeLogEntry = (
entry: LogEntryDraft,
context: LogContext
): LogEntryRecord | null => {
export const finalizeLogEntry = (entry: LogEntryDraft, context: LogContext): LogEntryRecord | null => {
if (shouldDropEntry(entry)) {
return null;
}
+1 -6
View File
@@ -1,12 +1,7 @@
import { LogFormat } from './types.js';
// 로그 포맷은 기존 표시 규칙(<C>/<S>/<R> + 기호)을 그대로 유지한다.
export const formatLogText = (
text: string,
format: LogFormat,
year: number,
month: number
): string => {
export const formatLogText = (text: string, format: LogFormat, year: number, month: number): string => {
switch (format) {
case LogFormat.RAWTEXT:
return text;
+1 -2
View File
@@ -16,8 +16,7 @@ export const LogCategory = {
USER: 'USER',
} as const;
export type LogCategory =
(typeof LogCategory)[keyof typeof LogCategory];
export type LogCategory = (typeof LogCategory)[keyof typeof LogCategory];
export interface LogEntryDraft {
scope: LogScope;