## 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:
Scott Anderson
2025-07-15 00:41:24 -04:00
committed by GitHub
parent 31381f67f4
commit be01b90b25
9 changed files with 23 additions and 29 deletions
-3
View File
@@ -39,13 +39,10 @@ export default [
{
rules: {
// Disable rules that would fail. The failures should be fixed, and the entries here removed.
"@typescript-eslint/no-empty-object-type": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-expressions": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-case-declarations": "off",
"no-useless-escape": "off",
},
},
{
+1 -1
View File
@@ -1,4 +1,4 @@
export interface GameEvent {}
export type GameEvent = object;
export interface EventConstructor<T extends GameEvent = GameEvent> {
new (...args: any[]): T;
+1 -1
View File
@@ -162,7 +162,7 @@ export const TeamSchema = z.string();
const SafeString = z
.string()
.regex(
/^([a-zA-Z0-9\s.,!?@#$%&*()\-_+=\[\]{}|;:"'\/\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|üÜ])*$/,
/^([a-zA-Z0-9\s.,!?@#$%&*()\-_+=[\]{}|;:"'/\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff]|üÜ])*$/,
)
.max(1000);
+1 -1
View File
@@ -139,7 +139,7 @@ export function getMode(list: Set<number>): number {
export function sanitize(name: string): string {
return Array.from(name)
.join("")
.replace(/[^\p{L}\p{N}\s\p{Emoji}\p{Emoji_Component}\[\]_]/gu, "");
.replace(/[^\p{L}\p{N}\s\p{Emoji}\p{Emoji_Component}[\]_]/gu, "");
}
export function processName(name: string): string {
+1 -3
View File
@@ -25,9 +25,7 @@ export class MissileSiloExecution implements Execution {
this.active = false;
return;
}
this.silo = this.player.buildUnit(UnitType.MissileSilo, spawn, {
cooldownDuration: this.mg.config().SiloCooldown(),
});
this.silo = this.player.buildUnit(UnitType.MissileSilo, spawn, {});
if (this.player !== this.silo.owner()) {
this.player = this.silo.owner();
+1 -3
View File
@@ -96,9 +96,7 @@ export class SAMLauncherExecution implements Execution {
this.active = false;
return;
}
this.sam = this.player.buildUnit(UnitType.SAMLauncher, spawnTile, {
cooldownDuration: this.mg.config().SAMCooldown(),
});
this.sam = this.player.buildUnit(UnitType.SAMLauncher, spawnTile, {});
}
if (!this.sam.isActive()) {
this.active = false;
+16 -13
View File
@@ -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 {
+1 -1
View File
@@ -22,7 +22,7 @@ const matcher = new RegExpMatcher({
export const MIN_USERNAME_LENGTH = 3;
export const MAX_USERNAME_LENGTH = 27;
const validPattern = /^[a-zA-Z0-9_\[\] 🐈🍀üÜ]+$/u;
const validPattern = /^[a-zA-Z0-9_[\] 🐈🍀üÜ]+$/u;
const shadowNames = [
"NicePeopleOnly",
@@ -130,9 +130,7 @@ describe("SAM", () => {
});
test("two sams should not target twice same nuke", async () => {
const sam1 = defender.buildUnit(UnitType.SAMLauncher, game.ref(1, 1), {
cooldownDuration: 10,
});
const sam1 = defender.buildUnit(UnitType.SAMLauncher, game.ref(1, 1), {});
game.addExecution(new SAMLauncherExecution(defender, null, sam1));
const sam2 = defender.buildUnit(UnitType.SAMLauncher, game.ref(1, 2), {});
game.addExecution(new SAMLauncherExecution(defender, null, sam2));