diff --git a/app/gateway-api/src/auth/postgresUserRepository.ts b/app/gateway-api/src/auth/postgresUserRepository.ts index 093a5f3..710f24a 100644 --- a/app/gateway-api/src/auth/postgresUserRepository.ts +++ b/app/gateway-api/src/auth/postgresUserRepository.ts @@ -1,4 +1,4 @@ -import { GatewayPrisma, type GatewayPrismaClient } from '@sammo-ts/infra'; +import type { GatewayPrisma, GatewayPrismaClient } from '@sammo-ts/infra'; import { createSimplePasswordHasher, type PasswordHasher } from './passwordHasher.js'; import type { CreateUserInput, UserOAuthInfo, UserRecord, UserRepository, UserSanctions } from './userRepository.js'; diff --git a/app/gateway-api/src/orchestrator/pm2ProcessManager.ts b/app/gateway-api/src/orchestrator/pm2ProcessManager.ts index 2e266ea..d9bd60f 100644 --- a/app/gateway-api/src/orchestrator/pm2ProcessManager.ts +++ b/app/gateway-api/src/orchestrator/pm2ProcessManager.ts @@ -1,8 +1,9 @@ import { createRequire } from 'node:module'; +import type * as Pm2 from 'pm2'; import type { ProcessManager, ManagedProcessInfo, ProcessDefinition } from './processManager.js'; -type Pm2Module = typeof import('pm2'); +type Pm2Module = typeof Pm2; const require = createRequire(import.meta.url); diff --git a/app/gateway-api/src/orchestrator/profileRepository.ts b/app/gateway-api/src/orchestrator/profileRepository.ts index b14adc5..8a36062 100644 --- a/app/gateway-api/src/orchestrator/profileRepository.ts +++ b/app/gateway-api/src/orchestrator/profileRepository.ts @@ -1,4 +1,4 @@ -import { GatewayPrisma, type GatewayPrismaClient } from '@sammo-ts/infra'; +import type { GatewayPrisma, GatewayPrismaClient } from '@sammo-ts/infra'; export const GATEWAY_PROFILE_STATUSES = [ 'RESERVED', diff --git a/app/gateway-frontend/src/views/HomeView.vue b/app/gateway-frontend/src/views/HomeView.vue index 229586b..6aeebec 100644 --- a/app/gateway-frontend/src/views/HomeView.vue +++ b/app/gateway-frontend/src/views/HomeView.vue @@ -12,7 +12,7 @@ onMounted(async () => { try { const me = await trpc.me.query(); if (me) { - router.push('/lobby'); + await router.push('/lobby'); } } catch (e) { // Not logged in or error diff --git a/app/gateway-frontend/src/views/LobbyView.vue b/app/gateway-frontend/src/views/LobbyView.vue index 2dae6ad..af4a380 100644 --- a/app/gateway-frontend/src/views/LobbyView.vue +++ b/app/gateway-frontend/src/views/LobbyView.vue @@ -24,7 +24,7 @@ onMounted(async () => { try { me.value = await trpc.me.query(); if (!me.value) { - router.push('/'); + await router.push('/'); return; } @@ -51,7 +51,7 @@ onMounted(async () => { const handleLogout = async () => { // TODO: Implement logout mutation in gateway-api // await trpc.auth.logout.mutation(); - router.push('/'); + await router.push('/'); }; diff --git a/eslint.config.js b/eslint.config.js index 60c1c95..b904f3b 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -74,6 +74,22 @@ export default tseslint.config( ], '@typescript-eslint/no-explicit-any': 'error', '@typescript-eslint/no-empty-object-type': 'off', + '@typescript-eslint/consistent-type-imports': [ + 'error', + { + fixStyle: 'separate-type-imports', + }, + ], + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-misused-promises': [ + 'error', + { + checksVoidReturn: { + arguments: false, + attributes: false, + }, + }, + ], }, }, { @@ -100,7 +116,7 @@ export default tseslint.config( prettier: prettierPlugin, }, rules: { - 'prettier/prettier': 'error', + 'prettier/prettier': 'off', }, }, prettierConfig diff --git a/packages/common/src/util/sha512.ts b/packages/common/src/util/sha512.ts index 7e0c5b9..bc2bbe3 100644 --- a/packages/common/src/util/sha512.ts +++ b/packages/common/src/util/sha512.ts @@ -1,14 +1,10 @@ import { sha512 as sha512Noble } from '@noble/hashes/sha2.js'; +import type { createHash } from 'node:crypto'; import type { BytesLike } from './BytesLike.js'; import { convertBytesLikeToUint8Array } from './convertBytesLikeToUint8Array.js'; -type NodeHash = { - update(data: Uint8Array): NodeHash; - digest(): Uint8Array; -}; - -type NodeCreateHash = (algorithm: 'sha512') => NodeHash; +type NodeCreateHash = typeof createHash; const isNode = typeof process !== 'undefined' && typeof process.versions?.node === 'string'; @@ -17,7 +13,7 @@ const nodeCryptoSpecifier = 'node:crypto'; let nodeCreateHash: NodeCreateHash | null = null; if (isNode) { - const nodeCrypto = (await import(nodeCryptoSpecifier)) as typeof import('node:crypto'); + const nodeCrypto = await import(nodeCryptoSpecifier); nodeCreateHash = nodeCrypto.createHash as NodeCreateHash; } diff --git a/packages/logic/src/actions/turn/general/che_거병.ts b/packages/logic/src/actions/turn/general/che_거병.ts index 80fcf94..d0732c0 100644 --- a/packages/logic/src/actions/turn/general/che_거병.ts +++ b/packages/logic/src/actions/turn/general/che_거병.ts @@ -1,4 +1,3 @@ -/* eslint-disable prettier/prettier */ import type { GeneralTriggerState, Nation } from '@sammo-ts/logic/domain/entities.js'; import type { Constraint, ConstraintContext } from '@sammo-ts/logic/constraints/types.js'; import { beNeutral } from '@sammo-ts/logic/constraints/presets.js'; diff --git a/packages/logic/src/triggers/special/selector.ts b/packages/logic/src/triggers/special/selector.ts index debc593..39a0199 100644 --- a/packages/logic/src/triggers/special/selector.ts +++ b/packages/logic/src/triggers/special/selector.ts @@ -1,4 +1,4 @@ -import { RandUtil } from '@sammo-ts/common'; +import type { RandUtil } from '@sammo-ts/common'; import { TraitRequirement, TraitWeightType } from './requirements.js'; import type { TraitModule } from './types.js'; import type { ScenarioStatBlock } from '../../scenario/types.js'; diff --git a/packages/logic/src/triggers/special/war/che_무쌍.ts b/packages/logic/src/triggers/special/war/che_무쌍.ts index e8f449f..34def26 100644 --- a/packages/logic/src/triggers/special/war/che_무쌍.ts +++ b/packages/logic/src/triggers/special/war/che_무쌍.ts @@ -1,3 +1,4 @@ +import type { TriggerValue } from '@sammo-ts/logic/domain/entities.js'; import type { GeneralActionContext } from '@sammo-ts/logic/triggers/general.js'; import type { GeneralStatName, WarStatName } from '@sammo-ts/logic/triggers/types.js'; import type { WarActionContext } from '@sammo-ts/logic/war/actions.js'; @@ -5,7 +6,7 @@ import type { TraitModule } from '@sammo-ts/logic/triggers/special/types.js'; import { TraitRequirement, TraitWeightType } from '../requirements.js'; import { getMetaNumber } from '@sammo-ts/logic/war/utils.js'; -import { WarUnit } from '@sammo-ts/logic/war/units.js'; +import type { WarUnit } from '@sammo-ts/logic/war/units.js'; type WarUnitWithGeneral = WarUnit & { getGeneral: () => { meta: Record } }; @@ -53,7 +54,7 @@ export const traitModule: TraitModule = { // In a real scenario, we should check if unit is WarUnitGeneral. if (hasGeneral(unit)) { const killnum = getMetaNumber( - unit.getGeneral().meta as Record, + unit.getGeneral().meta as Record, 'rank_killnum', 0 ); diff --git a/packages/logic/src/war/units.ts b/packages/logic/src/war/units.ts index 6e4e128..3226a10 100644 --- a/packages/logic/src/war/units.ts +++ b/packages/logic/src/war/units.ts @@ -12,9 +12,9 @@ import type { ActionLogger } from '@sammo-ts/logic/logging/actionLogger.js'; import { LogFormat } from '@sammo-ts/logic/logging/types.js'; import type { WarStatName } from '@sammo-ts/logic/triggers/types.js'; import { getTechAbility, getTechCost } from '@sammo-ts/logic/world/unitSet.js'; -import { WarActionPipeline, type WarActionContext } from './actions.js'; +import type { WarActionPipeline, WarActionContext } from './actions.js'; import type { WarEngineConfig } from './types.js'; -import { WarCrewType } from './crewType.js'; +import type { WarCrewType } from './crewType.js'; import { clamp, clampMin,