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

@@ -18,15 +18,6 @@ function daySeed(dateKey) {
return h;
}
/**
* @param {import("./types.js").GameState} state
* @param {number} level
* @returns {number}
*/
function _questReward(state, level) {
return GameConfig.Quests.RewardBase + level * GameConfig.Quests.RewardPerLevel;
}
/**
* @param {import("./types.js").GameState} state
* @returns {import("./types.js").Quest[]}
@@ -54,7 +45,9 @@ export function generateDailyQuests(state) {
return state.quests;
}
/** @param {import("./types.js").GameState} state */
/** @param {import("./types.js").GameState} state
* @returns {{ eggsPlaced: number, animalsSold: number, conveyorUpgrades: number, plotUpgrades: number, coinsEarned: number }}
*/
function getQuestProgress(state) {
const s = state.stats ?? { eggsPlaced: 0, animalsSold: 0, conveyorUpgrades: 0, plotUpgrades: 0, coinsEarned: 0 };
return {
@@ -66,6 +59,14 @@ function getQuestProgress(state) {
};
}
const QUEST_PROGRESS_KEYS = {
questPlaceEggs: "eggsPlaced",
questSellAnimals: "animalsSold",
questUpgradeConveyor: "conveyorUpgrades",
questUpgradePlot: "plotUpgrades",
questEarnCoins: "coinsEarned",
};
/**
* @param {import("./types.js").GameState} state
* @returns {number} coins awarded from completed quests this tick
@@ -75,16 +76,10 @@ export function tickQuests(state) {
const progress = getQuestProgress(state);
let earned = 0;
for (const q of state.quests ?? []) {
if (q.done) {
// already done
} else {
let current = null;
if (q.descriptionKey === "questPlaceEggs") current = progress.eggsPlaced;
else if (q.descriptionKey === "questSellAnimals") current = progress.animalsSold;
else if (q.descriptionKey === "questUpgradeConveyor") current = progress.conveyorUpgrades;
else if (q.descriptionKey === "questUpgradePlot") current = progress.plotUpgrades;
else if (q.descriptionKey === "questEarnCoins") current = progress.coinsEarned ?? 0;
if (current !== null && current !== undefined) {
if (!q.done) {
const progressKey = QUEST_PROGRESS_KEYS[q.descriptionKey];
const current = progressKey !== undefined ? (progress[progressKey] ?? 0) : null;
if (current !== null) {
q.current = Math.min(current, q.target);
if (q.current >= q.target) {
q.done = true;