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",
"useIndexOf": "warn",
"useObjectSpread": "info",
"useNumericSeparators": "info",
"useNumericSeparators": "off", // TODO: enable?
"useIterableCallbackReturn": "warn",
"useSingleJsDocAsterisk": "warn",
"noShadow": "warn"

View File

@ -468,7 +468,7 @@ export default class BattleScene extends SceneBase {
true,
);
//@ts-ignore (the defined types in the package are incromplete...)
//@ts-expect-error (the defined types in the package are incromplete...)
transition.transit({
mode: "blinds",
ease: "Cubic.easeInOut",
@ -1167,7 +1167,7 @@ export default class BattleScene extends SceneBase {
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
// Reset RNG after end of game or save & quit.

View File

@ -178,7 +178,7 @@ export default class Battle {
)
.map(i => {
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;
return ret;
}),

View File

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

View File

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

View File

@ -92,7 +92,7 @@ export const MysteriousChallengersEncounter: MysteryEncounter = MysteryEncounter
const brutalConfig = trainerConfigs[brutalTrainerType].clone();
brutalConfig.title = trainerConfigs[brutalTrainerType].title;
brutalConfig.setPartyTemplates(e4Template);
// @ts-ignore
// @ts-expect-error
brutalConfig.partyTemplateFunc = null; // Overrides gym leader party template func
female = false;
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)), () => {
try {
SoundFade.fadeOut(scene, cry, fixedInt(Math.ceil(duration * 0.2)));
fusionCry = this.getFusionSpeciesForm(undefined, true).cry(
Object.assign({ seek: Math.max(fusionCry.totalDuration * 0.4, 0) }, soundConfig),
);
fusionCry = this.getFusionSpeciesForm(undefined, true).cry({
seek: Math.max(fusionCry.totalDuration * 0.4, 0),
...soundConfig,
});
SoundFade.fadeIn(
scene,
fusionCry,
@ -4517,13 +4518,10 @@ export default abstract class Pokemon extends Phaser.GameObjects.Container {
}
if (i === transitionIndex && fusionCryKey) {
SoundFade.fadeOut(globalScene, cry, fixedInt(Math.ceil((duration / rate) * 0.2)));
fusionCry = globalScene.playSound(
fusionCryKey,
Object.assign({
seek: Math.max(fusionCry.totalDuration * 0.4, 0),
rate: rate,
}),
);
fusionCry = globalScene.playSound(fusionCryKey, {
seek: Math.max(fusionCry.totalDuration * 0.4, 0),
rate: rate,
});
SoundFade.fadeIn(
globalScene,
fusionCry,

View File

@ -44,7 +44,7 @@ export class SwitchSummonPhase extends SummonPhase {
preSummon(): void {
if (!this.player) {
if (this.slotIndex === -1) {
//@ts-ignore
//@ts-expect-error
this.slotIndex = globalScene.currentBattle.trainer?.getNextSummonIndex(
!this.fieldIndex ? TrainerSlot.TRAINER : TrainerSlot.TRAINER_PARTNER,
); // 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;
}

View File

@ -42,7 +42,7 @@ export default class TouchControl {
document.querySelectorAll(".apad-button").forEach(element => this.preventElementZoom(element as HTMLElement));
// Select all elements with the 'data-key' attribute and bind keys to them
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);
}
}

View File

@ -2321,7 +2321,7 @@ export default class PokedexPageUiHandler extends MessageUiHandler {
this.showStats();
} else {
this.statsContainer.setVisible(false);
//@ts-ignore
//@ts-expect-error
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.statsContainer.setVisible(false);
this.pokemonSprite.setVisible(true);
//@ts-ignore
//@ts-expect-error
this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. !?!?
}
}

View File

@ -2855,7 +2855,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
} else {
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.setPosition(this.instructionRowX, this.instructionRowY);
controlLabel.setPosition(this.instructionRowX + this.instructionRowTextOffset, this.instructionRowY);
@ -3480,7 +3480,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
this.showStats();
} else {
this.statsContainer.setVisible(false);
//@ts-ignore
//@ts-expect-error
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.statsContainer.setVisible(false);
this.pokemonSprite.setVisible(!!this.speciesStarterDexEntry?.caughtAttr);
//@ts-ignore
//@ts-expect-error
this.statsContainer.updateIvs(null); // TODO: resolve ts-ignore. !?!?
this.teraIcon.setVisible(globalScene.gameData.achvUnlocks.hasOwnProperty(achvs.TERASTALLIZE.id));
const props = globalScene.gameData.getSpeciesDexAttrProps(

View File

@ -66,7 +66,7 @@ describe("Abilities - Wonder Skin", () => {
it(`does not affect pokemon with ${ability[1]}`, async () => {
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]);
vi.spyOn(moveToCheck, "calculateBattleAccuracy");

View File

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

View File

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

View File

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