feat: eslint 적용 및 관련 코드 일괄 수정
This commit is contained in:
@@ -1,25 +1,15 @@
|
||||
import type { City, General, Nation, Troop } from '@sammo-ts/logic/domain/entities.js';
|
||||
import type { ScenarioConfig, ScenarioDiplomacy } from '@sammo-ts/logic/scenario/types.js';
|
||||
import type { ScenarioConfigSource, WorldStateSnapshotSource } from '@sammo-ts/logic/ports/worldSnapshot.js';
|
||||
import type {
|
||||
MapDefinition,
|
||||
ScenarioMeta,
|
||||
UnitSetDefinition,
|
||||
WorldSnapshot,
|
||||
} from './types.js';
|
||||
import type { MapDefinition, ScenarioMeta, UnitSetDefinition, WorldSnapshot } from './types.js';
|
||||
|
||||
export interface WorldSnapshotLoadInput<
|
||||
GeneralType extends General = General,
|
||||
CityType extends City = City,
|
||||
NationType extends Nation = Nation,
|
||||
TroopType extends Troop = Troop
|
||||
TroopType extends Troop = Troop,
|
||||
> {
|
||||
worldSource: WorldStateSnapshotSource<
|
||||
GeneralType,
|
||||
CityType,
|
||||
NationType,
|
||||
TroopType
|
||||
>;
|
||||
worldSource: WorldStateSnapshotSource<GeneralType, CityType, NationType, TroopType>;
|
||||
scenarioConfig?: ScenarioConfig;
|
||||
scenarioMeta?: ScenarioMeta;
|
||||
scenarioSource?: ScenarioConfigSource;
|
||||
@@ -35,29 +25,20 @@ export const loadWorldSnapshot = async <
|
||||
GeneralType extends General,
|
||||
CityType extends City,
|
||||
NationType extends Nation,
|
||||
TroopType extends Troop
|
||||
TroopType extends Troop,
|
||||
>(
|
||||
input: WorldSnapshotLoadInput<
|
||||
GeneralType,
|
||||
CityType,
|
||||
NationType,
|
||||
TroopType
|
||||
>
|
||||
input: WorldSnapshotLoadInput<GeneralType, CityType, NationType, TroopType>
|
||||
): Promise<WorldSnapshot> => {
|
||||
const { worldSource, scenarioSource } = input;
|
||||
|
||||
const scenarioConfig =
|
||||
input.scenarioConfig ??
|
||||
(scenarioSource ? await scenarioSource.loadScenarioConfig() : undefined);
|
||||
input.scenarioConfig ?? (scenarioSource ? await scenarioSource.loadScenarioConfig() : undefined);
|
||||
if (!scenarioConfig) {
|
||||
throw new Error('Scenario config is required to load world snapshot.');
|
||||
}
|
||||
|
||||
const scenarioMeta =
|
||||
input.scenarioMeta ??
|
||||
(scenarioSource?.loadScenarioMeta
|
||||
? await scenarioSource.loadScenarioMeta()
|
||||
: undefined);
|
||||
input.scenarioMeta ?? (scenarioSource?.loadScenarioMeta ? await scenarioSource.loadScenarioMeta() : undefined);
|
||||
|
||||
const [generals, cities, nations, troops] = await Promise.all([
|
||||
worldSource.listGenerals(),
|
||||
|
||||
Reference in New Issue
Block a user