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

@@ -0,0 +1,95 @@
import {
autoProfileFamilyLabel,
autoProfileSpecialisationLabel,
autoProfilePickerTitle,
autoProfilePickerFamilyStep,
autoProfilePickerSpecialisationStep,
autoProfileCancel,
} from "./texts-fr.js";
import { getProfilesByFamily, AUTO_MODE_FAMILY_IDS } from "./auto-mode-profiles.js";
/**
* @param {(p: Partial<import("./types.js").GameState>) => void} updateState
* @param {HTMLElement} pickerWrap
* @returns {void}
*/
function buildAutoProfilePickerFamilyStep(updateState, pickerWrap) {
const stepLabel = document.createElement("div");
stepLabel.className = "auto-profile-picker-step";
stepLabel.textContent = autoProfilePickerFamilyStep;
pickerWrap.appendChild(stepLabel);
const familyBtns = document.createElement("div");
familyBtns.className = "auto-profile-picker-families";
for (const fid of AUTO_MODE_FAMILY_IDS) {
const btn = document.createElement("button");
btn.type = "button";
btn.className = "auto-profile-picker-family-btn";
btn.textContent = autoProfileFamilyLabel[fid] ?? `Famille ${fid}`;
btn.addEventListener("click", () => updateState({ autoProfilePickerFamily: fid }));
familyBtns.appendChild(btn);
}
pickerWrap.appendChild(familyBtns);
}
/**
* @param {string|number} familyId
* @param {(p: Partial<import("./types.js").GameState>) => void} updateState
* @param {HTMLElement} pickerWrap
* @returns {void}
*/
function buildAutoProfilePickerSpecStep(familyId, updateState, pickerWrap) {
const stepLabel = document.createElement("div");
stepLabel.className = "auto-profile-picker-step";
stepLabel.textContent = autoProfilePickerSpecialisationStep;
pickerWrap.appendChild(stepLabel);
const profiles = getProfilesByFamily(familyId);
const specWrap = document.createElement("div");
specWrap.className = "auto-profile-picker-specialisations";
for (const prof of profiles) {
const btn = document.createElement("button");
btn.type = "button";
btn.className = "auto-profile-picker-spec-btn";
btn.textContent = autoProfileSpecialisationLabel[String(prof.id)] ?? `Profil ${prof.id}`;
btn.addEventListener("click", () => {
updateState({
autoModeProfileId: prof.id,
autoMode: true,
autoProfilePickerOpen: false,
autoProfilePickerFamily: undefined,
});
});
specWrap.appendChild(btn);
}
pickerWrap.appendChild(specWrap);
}
/**
* @param {{ state: import("./types.js").GameState, updateState?: (p: Partial<import("./types.js").GameState>) => void }} setup
* @param {HTMLElement} gameBarActions
* @returns {void}
*/
export function buildAutoProfilePicker(setup, gameBarActions) {
const { state, updateState } = setup;
if (!state.autoProfilePickerOpen || !updateState) return;
const pickerWrap = document.createElement("div");
pickerWrap.className = "auto-profile-picker-wrap";
pickerWrap.setAttribute("role", "dialog");
pickerWrap.setAttribute("aria-label", autoProfilePickerTitle);
const pickerTitle = document.createElement("div");
pickerTitle.className = "auto-profile-picker-title";
pickerTitle.textContent = autoProfilePickerTitle;
pickerWrap.appendChild(pickerTitle);
const familyId = state.autoProfilePickerFamily;
if (familyId === null || familyId === undefined) {
buildAutoProfilePickerFamilyStep(updateState, pickerWrap);
} else {
buildAutoProfilePickerSpecStep(familyId, updateState, pickerWrap);
}
const cancelBtn = document.createElement("button");
cancelBtn.type = "button";
cancelBtn.className = "auto-profile-picker-cancel";
cancelBtn.textContent = autoProfileCancel;
cancelBtn.addEventListener("click", () => updateState({ autoProfilePickerOpen: false, autoProfilePickerFamily: undefined }));
pickerWrap.appendChild(cancelBtn);
gameBarActions.appendChild(pickerWrap);
}