mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-28 13:57:58 +00:00
Eslint (#998)
## Description: Enable a few eslint rules: - `@typescript-eslint/no-empty-object-type` - `@typescript-eslint/no-require-imports` - `no-useless-escape` ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors --------- Co-authored-by: Scott Anderson <scottanderson@users.noreply.github.com>
This commit is contained in:
co-authored by
Scott Anderson
parent
31381f67f4
commit
be01b90b25
+16
-13
@@ -194,11 +194,11 @@ export interface UnitParamsMap {
|
||||
patrolTile: TileRef;
|
||||
};
|
||||
|
||||
[UnitType.Shell]: {};
|
||||
[UnitType.Shell]: Record<string, never>;
|
||||
|
||||
[UnitType.SAMMissile]: {};
|
||||
[UnitType.SAMMissile]: Record<string, never>;
|
||||
|
||||
[UnitType.Port]: {};
|
||||
[UnitType.Port]: Record<string, never>;
|
||||
|
||||
[UnitType.AtomBomb]: {
|
||||
targetTile?: number;
|
||||
@@ -219,25 +219,23 @@ export interface UnitParamsMap {
|
||||
loaded?: boolean;
|
||||
};
|
||||
|
||||
[UnitType.Factory]: {};
|
||||
[UnitType.Factory]: Record<string, never>;
|
||||
|
||||
[UnitType.MissileSilo]: {
|
||||
cooldownDuration?: number;
|
||||
};
|
||||
[UnitType.MissileSilo]: Record<string, never>;
|
||||
|
||||
[UnitType.DefensePost]: {};
|
||||
[UnitType.DefensePost]: Record<string, never>;
|
||||
|
||||
[UnitType.SAMLauncher]: {};
|
||||
[UnitType.SAMLauncher]: Record<string, never>;
|
||||
|
||||
[UnitType.City]: {};
|
||||
[UnitType.City]: Record<string, never>;
|
||||
|
||||
[UnitType.MIRV]: {};
|
||||
[UnitType.MIRV]: Record<string, never>;
|
||||
|
||||
[UnitType.MIRVWarhead]: {
|
||||
targetTile?: number;
|
||||
};
|
||||
|
||||
[UnitType.Construction]: {};
|
||||
[UnitType.Construction]: Record<string, never>;
|
||||
}
|
||||
|
||||
// Type helper to get params type for a specific unit type
|
||||
@@ -381,7 +379,12 @@ export class PlayerInfo {
|
||||
}
|
||||
|
||||
export function isUnit(unit: Unit | UnitParams<UnitType>): unit is Unit {
|
||||
return "isUnit" in unit && typeof unit.isUnit === "function" && unit.isUnit();
|
||||
return (
|
||||
unit !== undefined &&
|
||||
"isUnit" in unit &&
|
||||
typeof unit.isUnit === "function" &&
|
||||
unit.isUnit()
|
||||
);
|
||||
}
|
||||
|
||||
export interface Unit {
|
||||
|
||||
Reference in New Issue
Block a user