Apply Biome safe fixes

This commit is contained in:
NightKev 2025-06-17 18:17:34 -07:00
parent 6a8867abe1
commit 69ed6258b2
16 changed files with 36 additions and 42 deletions

View File

@ -136,7 +136,7 @@
"useJsonImportAttribute": "error", "useJsonImportAttribute": "error",
"useIndexOf": "warn", "useIndexOf": "warn",
"useObjectSpread": "info", "useObjectSpread": "info",
"useNumericSeparators": "info", "useNumericSeparators": "off", // TODO: enable?
"useIterableCallbackReturn": "warn", "useIterableCallbackReturn": "warn",
"useSingleJsDocAsterisk": "warn", "useSingleJsDocAsterisk": "warn",
"noShadow": "warn" "noShadow": "warn"

View File

@ -468,7 +468,7 @@ export default class BattleScene extends SceneBase {
true, true,
); );
//@ts-ignore (the defined types in the package are incromplete...) //@ts-expect-error (the defined types in the package are incromplete...)
transition.transit({ transition.transit({
mode: "blinds", mode: "blinds",
ease: "Cubic.easeInOut", ease: "Cubic.easeInOut",
@ -1167,7 +1167,7 @@ export default class BattleScene extends SceneBase {
this.field.remove(this.currentBattle.mysteryEncounter?.introVisuals, true); this.field.remove(this.currentBattle.mysteryEncounter?.introVisuals, true);
} }
//@ts-ignore - allowing `null` for currentBattle causes a lot of trouble //@ts-expect-error - allowing `null` for currentBattle causes a lot of trouble
this.currentBattle = null; // TODO: resolve ts-ignore this.currentBattle = null; // TODO: resolve ts-ignore
// Reset RNG after end of game or save & quit. // Reset RNG after end of game or save & quit.

View File

@ -178,7 +178,7 @@ export default class Battle {
) )
.map(i => { .map(i => {
const ret = i as PokemonHeldItemModifier; const ret = i as PokemonHeldItemModifier;
//@ts-ignore - this is awful to fix/change //@ts-expect-error - this is awful to fix/change
ret.pokemonId = null; ret.pokemonId = null;
return ret; return ret;
}), }),

View File

@ -359,15 +359,11 @@ class AnimTimedUpdateBgEvent extends AnimTimedBgEvent {
tweenProps["alpha"] = (this.opacity || 0) / 255; tweenProps["alpha"] = (this.opacity || 0) / 255;
} }
if (Object.keys(tweenProps).length) { if (Object.keys(tweenProps).length) {
globalScene.tweens.add( globalScene.tweens.add({
Object.assign(
{
targets: moveAnim.bgSprite, targets: moveAnim.bgSprite,
duration: getFrameMs(this.duration * 3), duration: getFrameMs(this.duration * 3),
}, ...tweenProps,
tweenProps, });
),
);
} }
return this.duration * 2; return this.duration * 2;
} }
@ -1641,12 +1637,12 @@ export async function populateAnims() {
let props: string[]; let props: string[];
for (let p = 0; p < propSets.length; p++) { for (let p = 0; p < propSets.length; p++) {
props = propSets[p]; props = propSets[p];
// @ts-ignore TODO // @ts-expect-error TODO
const ai = props.indexOf(a.key); const ai = props.indexOf(a.key);
if (ai === -1) { if (ai === -1) {
continue; continue;
} }
// @ts-ignore TODO // @ts-expect-error TODO
const bi = props.indexOf(b.key); const bi = props.indexOf(b.key);
return ai < bi ? -1 : ai > bi ? 1 : 0; return ai < bi ? -1 : ai > bi ? 1 : 0;

View File

@ -135,7 +135,7 @@ export const ClowningAroundEncounter: MysteryEncounter = MysteryEncounterBuilder
); );
clownConfig.setPartyTemplates(clownPartyTemplate); clownConfig.setPartyTemplates(clownPartyTemplate);
clownConfig.setDoubleOnly(); clownConfig.setDoubleOnly();
// @ts-ignore // @ts-expect-error
clownConfig.partyTemplateFunc = null; // Overrides party template func if it exists clownConfig.partyTemplateFunc = null; // Overrides party template func if it exists
// Generate random ability for Blacephalon from pool // Generate random ability for Blacephalon from pool

View File

@ -92,7 +92,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
const brutalConfig = trainerConfigs[brutalTrainerType].clone(); const brutalConfig = trainerConfigs[brutalTrainerType].clone();
brutalConfig.title = trainerConfigs[brutalTrainerType].title; brutalConfig.title = trainerConfigs[brutalTrainerType].title;
brutalConfig.setPartyTemplates(e4Template); brutalConfig.setPartyTemplates(e4Template);
// @ts-ignore // @ts-expect-error
brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func
female = false; female = false;
if (brutalConfig.hasGenders) { if (brutalConfig.hasGenders) {

View File

@ -4373,9 +4373,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
scene.time.delayedCall(fixedInt(Math.ceil(duration * 0.4)), () => { scene.time.delayedCall(fixedInt(Math.ceil(duration * 0.4)), () => {
try { try {
SoundFade.fadeOut(scene, cry, fixedInt(Math.ceil(duration * 0.2))); SoundFade.fadeOut(scene, cry, fixedInt(Math.ceil(duration * 0.2)));
fusionCry = this.getFusionSpeciesForm(undefined, true).cry( fusionCry = this.getFusionSpeciesForm(undefined, true).cry({
Object.assign({ seek: Math.max(fusionCry.totalDuration * 0.4, 0) }, soundConfig), seek: Math.max(fusionCry.totalDuration * 0.4, 0),
); ...soundConfig,
});
SoundFade.fadeIn( SoundFade.fadeIn(
scene, scene,
fusionCry, fusionCry,
@ -4517,13 +4518,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
} }
if (i === transitionIndex && fusionCryKey) { if (i === transitionIndex && fusionCryKey) {
SoundFade.fadeOut(globalScene, cry, fixedInt(Math.ceil((duration / rate) * 0.2))); SoundFade.fadeOut(globalScene, cry, fixedInt(Math.ceil((duration / rate) * 0.2)));
fusionCry = globalScene.playSound( fusionCry = globalScene.playSound(fusionCryKey, {
fusionCryKey,
Object.assign({
seek: Math.max(fusionCry.totalDuration * 0.4, 0), seek: Math.max(fusionCry.totalDuration * 0.4, 0),
rate: rate, rate: rate,
}), });
);
SoundFade.fadeIn( SoundFade.fadeIn(
globalScene, globalScene,
fusionCry, fusionCry,

View File

@ -44,7 +44,7 @@ export class SwitchSummonPhase extends SummonPhase {
preSummon(): void { preSummon(): void {
if (!this.player) { if (!this.player) {
if (this.slotIndex === -1) { if (this.slotIndex === -1) {
//@ts-ignore //@ts-expect-error
this.slotIndex = globalScene.currentBattle.trainer?.getNextSummonIndex( this.slotIndex = globalScene.currentBattle.trainer?.getNextSummonIndex(
!this.fieldIndex ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER, !this.fieldIndex ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER,
); // TODO: what would be the default trainer-slot fallback? ); // TODO: what would be the default trainer-slot fallback?

View File

@ -1610,7 +1610,7 @@ export class GameData {
} }
} }
this.defaultDexData = Object.assign({}, data); this.defaultDexData = { ...data };
this.dexData = data; this.dexData = data;
} }

View File

@ -42,7 +42,7 @@ export default class TouchControl {
document.querySelectorAll(".apad-button").forEach(element => this.preventElementZoom(element as HTMLElement)); document.querySelectorAll(".apad-button").forEach(element => this.preventElementZoom(element as HTMLElement));
// Select all elements with the 'data-key' attribute and bind keys to them // Select all elements with the 'data-key' attribute and bind keys to them
for (const button of document.querySelectorAll("[data-key]")) { for (const button of document.querySelectorAll("[data-key]")) {
// @ts-ignore - Bind the key to the button using the dataset key // @ts-expect-error - Bind the key to the button using the dataset key
this.bindKey(button, button.dataset.key); this.bindKey(button, button.dataset.key);
} }
} }

View File

@ -2321,7 +2321,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.showStats(); this.showStats();
} else { } else {
this.statsContainer.setVisible(false); this.statsContainer.setVisible(false);
//@ts-ignore //@ts-expect-error
this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. what. how? huh? this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. what. how? huh?
} }
} }
@ -2786,7 +2786,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.statsMode = false; this.statsMode = false;
this.statsContainer.setVisible(false); this.statsContainer.setVisible(false);
this.pokemonSprite.setVisible(true); this.pokemonSprite.setVisible(true);
//@ts-ignore //@ts-expect-error
this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. !?!? this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. !?!?
} }
} }

View File

@ -2855,7 +2855,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
} else { } else {
iconPath = globalScene.inputController?.getIconForLatestInputRecorded(iconSetting); iconPath = globalScene.inputController?.getIconForLatestInputRecorded(iconSetting);
} }
// @ts-ignore: TODO can iconPath actually be undefined? // @ts-expect-error: TODO can iconPath actually be undefined?
iconElement.setTexture(gamepadType, iconPath); iconElement.setTexture(gamepadType, iconPath);
iconElement.setPosition(this.instructionRowX, this.instructionRowY); iconElement.setPosition(this.instructionRowX, this.instructionRowY);
controlLabel.setPosition(this.instructionRowX + this.instructionRowTextOffset, this.instructionRowY); controlLabel.setPosition(this.instructionRowX + this.instructionRowTextOffset, this.instructionRowY);
@ -3480,7 +3480,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.showStats(); this.showStats();
} else { } else {
this.statsContainer.setVisible(false); this.statsContainer.setVisible(false);
//@ts-ignore //@ts-expect-error
this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. what. how? huh? this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. what. how? huh?
} }
} }
@ -4488,7 +4488,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.statsMode = false; this.statsMode = false;
this.statsContainer.setVisible(false); this.statsContainer.setVisible(false);
this.pokemonSprite.setVisible(!!this.speciesStarterDexEntry?.caughtAttr); this.pokemonSprite.setVisible(!!this.speciesStarterDexEntry?.caughtAttr);
//@ts-ignore //@ts-expect-error
this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. !?!? this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. !?!?
this.teraIcon.setVisible(globalScene.gameData.achvUnlocks.hasOwnProperty(achvs.TERASTALLIZE.id)); this.teraIcon.setVisible(globalScene.gameData.achvUnlocks.hasOwnProperty(achvs.TERASTALLIZE.id));
const props = globalScene.gameData.getSpeciesDexAttrProps( const props = globalScene.gameData.getSpeciesDexAttrProps(

View File

@ -66,7 +66,7 @@ describe("Abilities - Wonder Skin", () => {
it(`does not affect pokemon with ${ability[1]}`, async () => { it(`does not affect pokemon with ${ability[1]}`, async () => {
const moveToCheck = allMoves[MoveId.CHARM]; const moveToCheck = allMoves[MoveId.CHARM];
// @ts-ignore ts doesn't know that ability[0] is an ability and not a string... // @ts-expect-error ts doesn't know that ability[0] is an ability and not a string...
game.override.ability(ability[0]); game.override.ability(ability[0]);
vi.spyOn(moveToCheck, "calculateBattleAccuracy"); vi.spyOn(moveToCheck, "calculateBattleAccuracy");

View File

@ -89,7 +89,7 @@ class Fakepad extends Phaser.Input.Gamepad.Gamepad {
public index: number; public index: number;
constructor(pad) { constructor(pad) {
//@ts-ignore //@ts-expect-error
super(undefined, { ...pad, buttons: pad.deviceMapping, axes: [] }); //TODO: resolve ts-ignore super(undefined, { ...pad, buttons: pad.deviceMapping, axes: [] }); //TODO: resolve ts-ignore
this.id = "xbox_360_fakepad"; this.id = "xbox_360_fakepad";
this.index = 0; this.index = 0;

View File

@ -19,13 +19,13 @@ export default class MockSprite implements MockGameObject {
constructor(textureManager, x, y, texture) { constructor(textureManager, x, y, texture) {
this.textureManager = textureManager; this.textureManager = textureManager;
this.scene = textureManager.scene; this.scene = textureManager.scene;
// @ts-ignore // @ts-expect-error
Phaser.GameObjects.Sprite.prototype.setInteractive = this.setInteractive; Phaser.GameObjects.Sprite.prototype.setInteractive = this.setInteractive;
// @ts-ignore // @ts-expect-error
Phaser.GameObjects.Sprite.prototype.setTexture = this.setTexture; Phaser.GameObjects.Sprite.prototype.setTexture = this.setTexture;
// @ts-ignore // @ts-expect-error
Phaser.GameObjects.Sprite.prototype.setSizeToFrame = this.setSizeToFrame; Phaser.GameObjects.Sprite.prototype.setSizeToFrame = this.setSizeToFrame;
// @ts-ignore // @ts-expect-error
Phaser.GameObjects.Sprite.prototype.setFrame = this.setFrame; Phaser.GameObjects.Sprite.prototype.setFrame = this.setFrame;
// Phaser.GameObjects.Sprite.prototype.disable = this.disable; // Phaser.GameObjects.Sprite.prototype.disable = this.disable;

View File

@ -47,7 +47,7 @@ export function initTestFile() {
}); });
BBCodeText.prototype.destroy = () => null; BBCodeText.prototype.destroy = () => null;
// @ts-ignore // @ts-expect-error
BBCodeText.prototype.resize = () => null; BBCodeText.prototype.resize = () => null;
InputText.prototype.setElement = () => null as any; InputText.prototype.setElement = () => null as any;
InputText.prototype.resize = () => null as any; InputText.prototype.resize = () => null as any;