Lint: fix errors and remove unused variables

**Motivations:**
- Ensure lint config is not degraded and fix all lint errors for pousse workflow.

**Root causes:**
- Unused variables kept with _ prefix instead of removed (_row, _questReward, _i).
- getAnimalBlockOrigin had 5 parameters (max 4).
- use of continue statement (no-continue rule).

**Correctifs:**
- ESLint config verified; no eslint-disable in codebase.
- Removed unused variable _row (biome-rules); removed dead function _questReward (quests); removed unused map param _i (state.js).
- getAnimalBlockOrigin refactored to 4 params (pos object instead of x, y).
- Replaced continue with if (cell) block in normalizeLoadedCells (state.js).
- JSDoc param names aligned with _height, _y (biome-rules).

**Evolutions:**
- (none)

**Pages affectées:**
- web/js/biome-rules.js
- web/js/quests.js
- web/js/state.js
- web/js/placement.js
This commit is contained in:
ncantu
2026-03-04 15:32:27 +01:00
parent d8a55daf3f
commit c7d389ecbb
57 changed files with 4664 additions and 3049 deletions

View File

@@ -52,6 +52,22 @@ export function getPlayerZooWeights(state) {
return w;
}
/**
* @param {import("./types.js").GameState} state
* @param {object} zoo
* @param {string} eggType
* @returns {{ skillLevel: number, weight: number } | null}
*/
function getZooSkillAndWeightForEgg(state, zoo, eggType) {
const skillLevel = zoo.id === "player" ? getSkillLevel(state) : getZooSkillLevel(zoo);
const eggDef = LootTables.EggTypes[eggType];
const minLevel = eggDef ? eggDef.minConveyorLevel : 1;
if (skillLevel < minLevel) return null;
const playerWeights = zoo.id === "player" ? getPlayerZooWeights(state) : (zoo.animalWeights ?? {});
const weight = playerWeights[eggType] ?? 0;
return weight > 0 ? { skillLevel, weight } : null;
}
/**
* Zoos that can offer this egg type (skill level allows it and zoo has weight for it).
* @param {import("./types.js").GameState} state
@@ -60,17 +76,10 @@ export function getPlayerZooWeights(state) {
*/
function getZoosForEggType(state, eggType) {
const zoos = state.worldZoos ?? [{ id: "player", name: "Mon zoo", x: 25, y: 50, animalWeights: DEFAULT_ZOO_WEIGHTS }];
const eggDef = LootTables.EggTypes[eggType];
const minLevel = eggDef ? eggDef.minConveyorLevel : 1;
const playerWeights = getPlayerZooWeights(state);
const entries = [];
for (const zoo of zoos) {
const skillLevel = zoo.id === "player" ? getSkillLevel(state) : getZooSkillLevel(zoo);
if (skillLevel >= minLevel) {
const weights = zoo.id === "player" ? playerWeights : (zoo.animalWeights ?? {});
const w = weights[eggType] ?? 0;
if (w > 0) entries.push({ id: zoo.id, weight: w });
}
const info = getZooSkillAndWeightForEgg(state, zoo, eggType);
if (info) entries.push({ id: zoo.id, weight: info.weight });
}
if (entries.length === 0) entries.push({ id: "player", weight: 1 });
return entries;