Skip to content

Commit

Permalink
Update deps and fix ts errors (#1868)
Browse files Browse the repository at this point in the history
* remove eslint and update deps

* remove obsolete eslint config file

* fix all typescript errors
  • Loading branch information
sylvainpolletvillard authored Jun 23, 2024
1 parent 941cb50 commit 6cc635a
Show file tree
Hide file tree
Showing 37 changed files with 507 additions and 1,780 deletions.
3 changes: 0 additions & 3 deletions app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,8 @@ export default config({
connect(process.env.MONGO_URI!)
admin.initializeApp({
credential: admin.credential.cert({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
projectId: process.env.FIREBASE_PROJECT_ID!,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
clientEmail: process.env.FIREBASE_CLIENT_EMAIL!,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
privateKey: process.env.FIREBASE_PRIVATE_KEY!.replace(/\\n/g, "\n")
})
})
Expand Down
3 changes: 0 additions & 3 deletions app/core/pokemon-entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,6 @@ export class PokemonEntity extends Schema implements IPokemonEntity {
this.count.staticHolderCount++
if (this.count.staticHolderCount > 2) {
this.count.staticHolderCount = 0
// eslint-disable-next-line no-unused-vars

const nbBounces = 3
const closestEnemies = new Array<PokemonEntity>()
board.forEach(
Expand Down Expand Up @@ -1353,7 +1351,6 @@ export class PokemonEntity extends Schema implements IPokemonEntity {
} else if (isAngerPoint) {
speedBoost = 30
}
// eslint-disable-next-line @typescript-eslint/no-this-alias
const _pokemon = this // beware of closure vars
this.simulation.room.clock.setTimeout(() => {
board.forEach((x, y, value) => {
Expand Down
1 change: 0 additions & 1 deletion app/core/pokemon-state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-empty-function */
import Player from "../models/colyseus-models/player"
import { IPokemonEntity, Transfer } from "../types"
import { FIGHTING_PHASE_DURATION, ARMOR_FACTOR } from "../types/Config"
Expand Down
1 change: 0 additions & 1 deletion app/core/simulation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-extra-semi */
import { MapSchema, Schema, SetSchema, type } from "@colyseus/schema"
import Player from "../models/colyseus-models/player"
import { Pokemon } from "../models/colyseus-models/pokemon"
Expand Down
1 change: 0 additions & 1 deletion app/core/terrain.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable no-var */
const F = (Math.sqrt(3) - 1) / 2
const G = (3 - Math.sqrt(3)) / 6
const GRAD = [
Expand Down
4 changes: 2 additions & 2 deletions app/models/colyseus-models/game-record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Item } from "../../types/enum/Item"
import { Pkm, PkmIndex } from "../../types/enum/Pokemon"
export interface IPokemonRecord {
name: Pkm
items: Item[]
items: Item[] | ArraySchema<Item>
avatar: string
}
export class PokemonRecord extends Schema implements IPokemonRecord {
Expand All @@ -28,7 +28,7 @@ export class PokemonRecord extends Schema implements IPokemonRecord {
export interface IGameRecord {
time: number
rank: number
pokemons: IPokemonRecord[]
pokemons: IPokemonRecord[] | ArraySchema<IPokemonRecord>
elo: number
}

Expand Down
14 changes: 7 additions & 7 deletions app/models/colyseus-models/lobby-user.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArraySchema, Schema, type } from "@colyseus/schema"
import { ArraySchema, MapSchema, Schema, type } from "@colyseus/schema"
import { Role, Title } from "../../types"
import { Language } from "../../types/enum/Language"
import { IPokemonConfig } from "../mongo-models/user-metadata"
Expand All @@ -17,11 +17,11 @@ export interface ILobbyUser {
exp: number
level: number
donor: boolean
honors: string[]
history: IGameRecord[]
pokemonCollection: Map<string, IPokemonConfig>
honors: string[] | ArraySchema<string>
history: IGameRecord[] | ArraySchema<IGameRecord>
pokemonCollection: Map<string, IPokemonConfig> | MapSchema<IPokemonConfig>
booster: number
titles: Title[]
titles: Title[] | ArraySchema<Title>
title: "" | Title
role: Role
anonymous: boolean
Expand Down Expand Up @@ -61,7 +61,7 @@ export default class LobbyUser extends Schema implements ILobbyUser {
exp: number,
level: number,
donor: boolean,
history: GameRecord[],
history: GameRecord[] | ArraySchema<GameRecord>,
honors: string[],
pokemonCollection: Map<string, IPokemonConfig> | null,
booster: number,
Expand All @@ -71,7 +71,7 @@ export default class LobbyUser extends Schema implements ILobbyUser {
anonymous: boolean,
creationTime: string,
lastSignInTime: string,
language: Language | ""
language: Language | "",
) {
super()
this.id = id
Expand Down
13 changes: 3 additions & 10 deletions app/models/colyseus-models/pokemon.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable no-unused-vars */
/* eslint-disable max-len */

import { MapSchema, Schema, SetSchema, type } from "@colyseus/schema"
import { nanoid } from "nanoid"
import {
Expand Down Expand Up @@ -499,15 +496,11 @@ export class Scyther extends Pokemon {
passive = Passive.SCYTHER

evolutionRule = new ItemEvolutionRule(
[
Item.METAL_COAT,
Item.BLACK_AUGURITE
],
[Item.METAL_COAT, Item.BLACK_AUGURITE],
(pokemon, player, item) => {
if (item === Item.METAL_COAT){
if (item === Item.METAL_COAT) {
return Pkm.SCIZOR
}
else {
} else {
return Pkm.KLEAVOR
}
}
Expand Down
8 changes: 5 additions & 3 deletions app/models/colyseus-models/simple-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ export default class SimplePlayer extends Schema implements ISimplePlayer {
name: string,
avatar: string,
rank: number,
pokemons: IPokemonRecord[],
pokemons: IPokemonRecord[] | ArraySchema<IPokemonRecord>,
exp: number,
title: string,
role: Role,
synergies: Array<{ name: Synergy; value: number }>,
elo: number
synergies:
| Array<{ name: Synergy; value: number }>
| ArraySchema<{ name: Synergy; value: number }>,
elo: number,
) {
super()
this.id = id
Expand Down
20 changes: 12 additions & 8 deletions app/models/colyseus-models/tournament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Schema, MapSchema, ArraySchema, type } from "@colyseus/schema"
import {
ITournament,
ITournamentBracket,
ITournamentPlayer
ITournamentPlayer,
} from "../../types/interfaces/Tournament"
import { resetArraySchema } from "../../utils/schemas"

Expand All @@ -20,8 +20,8 @@ export class TournamentPlayerSchema
name: string,
avatar: string,
elo: number,
ranks: number[] = [],
eliminated: boolean = false
ranks: number[] | ArraySchema<number> = [],
eliminated: boolean = false,
) {
super()
this.name = name
Expand All @@ -40,7 +40,11 @@ export class TournamentBracketSchema
@type(["string"]) playersId = new ArraySchema<string>()
@type("boolean") finished: boolean

constructor(name: string, playersId: string[], finished: boolean = false) {
constructor(
name: string,
playersId: string[] | ArraySchema<string>,
finished: boolean = false,
) {
super()
this.name = name
this.finished = finished
Expand All @@ -64,7 +68,7 @@ export class TournamentSchema extends Schema implements ITournament {
startDate: string,
players: Map<string, ITournamentPlayer>,
brackets: Map<string, ITournamentBracket>,
finished: boolean = false
finished: boolean = false,
) {
super()
this.id = id
Expand All @@ -81,8 +85,8 @@ export class TournamentSchema extends Schema implements ITournament {
p.avatar,
p.elo,
p.ranks,
p.eliminated
)
p.eliminated,
),
)
})
}
Expand All @@ -91,7 +95,7 @@ export class TournamentSchema extends Schema implements ITournament {
brackets.forEach((b, bracketId) => {
this.brackets.set(
bracketId,
new TournamentBracketSchema(b.name, b.playersId, b.finished)
new TournamentBracketSchema(b.name, b.playersId, b.finished),
)
})
}
Expand Down
Loading

0 comments on commit 6cc635a

Please sign in to comment.