Retire le code mort signalé par ESLint ; npm run lint passe

Corrige les 23 erreurs restantes, sans changer le comportement :
- no-unused-vars (18)
  - galaxy-system-scene.component.spec.ts : les 5 faux `links` déclaraient des
    paramètres _rangePc, _drawn, _budget seulement pour typer mock.calls ; ils sont
    typés par vi.fn<LinkScene['routing']['links']>(), même signature.
  - body-detail-scene : `const viewModel = this.viewModel()` jamais lu (lecture de
    signal hors contexte réactif, sans effet).
  - galaxy-system-scene : `const camera = this.engine.getCamera()` jamais lu dans
    swapToSystemSpace et swapToGalaxySpace. getCamera() ne lève que si le moteur
    n'est pas initialisé, or ces fonctions ne tournent qu'en rappel de rig.flyTo,
    piloté par le tick du moteur qui appelle déjà getCamera() à chaque image.
  - grid-plane, star-field-renderer : imports cités seulement dans un {@link} de
    JSDoc (SUN_HEIGHT_ABOVE_MIDPLANE_PC, REFERENCE_VIEWPORT_HEIGHT_PX). Les modules
    restent importés pour leurs autres exports.
- no-useless-assignment (4) : valeurs initiales jamais lues (u, v, s de gaussian(),
  affectés dans le do avant toute lecture ; raw de BookmarksStore.read(), affecté
  dans le try dont le catch retourne). Les déclarations gardent leur type.
- no-unused-expressions (1) : `this.display().jumpLinks;` dans l'effect des liens
  de saut est une lecture voulue (abonnement au signal) ; écrite
  `void this.display().jumpLinks;`, même lecture.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-10-01 17:22:36 +02:00
co-authored by Claude Opus 5.5
parent bd90b4a21f
commit a47b5d3d92
7 changed files with 12 additions and 16 deletions
@@ -271,7 +271,6 @@ export class BodyDetailSceneComponent implements AfterViewInit, OnDestroy {
scene.add(sunLight);
const geometry = new THREE.SphereGeometry(1, 64, 48);
const viewModel = this.viewModel();
this.planetMaterial = new THREE.MeshStandardMaterial({
// White, always: the map that arrives a moment later carries the colour, whether it is a
// photograph or a surface derived from the body's own measurements.
@@ -604,7 +604,7 @@ describe('GalaxySystemSceneComponent camera-flight transitions', () => {
}
it('links the stars being drawn, and asks again once a new set of them holds still', async () => {
const links = vi.fn((_rangePc: number, _drawn: Uint32Array) => Promise.resolve(new Float32Array(0)));
const links = vi.fn<LinkScene['routing']['links']>(() => Promise.resolve(new Float32Array(0)));
const component = linkScene(links);
await settle();
expect(links).toHaveBeenCalledTimes(1);
@@ -625,7 +625,7 @@ describe('GalaxySystemSceneComponent camera-flight transitions', () => {
});
it('asks for as much of the graph as a million pixels of line make, around where the view is centred', async () => {
const links = vi.fn((_rangePc: number, _drawn: Uint32Array, _budget?: LinkBudget) => Promise.resolve(new Float32Array(0)));
const links = vi.fn<LinkScene['routing']['links']>(() => Promise.resolve(new Float32Array(0)));
Object.defineProperty((fixture.nativeElement as HTMLElement).querySelector('canvas')!, 'clientHeight', { value: 1080 });
// A screen scaled to 200%: 1080 CSS pixels are 2160 drawn ones, and the lines are drawn in those.
engine.pixelRatio = 2;
@@ -641,7 +641,7 @@ describe('GalaxySystemSceneComponent camera-flight transitions', () => {
it('asks again once the view has zoomed past the budget it asked with, though the drawn stars are the same', async () => {
// All three stars fit the star budget, so the drawn set never changes: only the budget can.
const links = vi.fn((_rangePc: number, _drawn: Uint32Array, _budget?: LinkBudget) => Promise.resolve(new Float32Array(0)));
const links = vi.fn<LinkScene['routing']['links']>(() => Promise.resolve(new Float32Array(0)));
Object.defineProperty((fixture.nativeElement as HTMLElement).querySelector('canvas')!, 'clientHeight', { value: 1080 });
const component = linkScene(links);
await advanceFrames(engine, 0.3);
@@ -658,7 +658,7 @@ describe('GalaxySystemSceneComponent camera-flight transitions', () => {
});
it('asks for no graph from inside a system, where distances are in astronomical units', async () => {
const links = vi.fn((_rangePc: number, _drawn: Uint32Array, _budget?: LinkBudget) => Promise.resolve(new Float32Array(0)));
const links = vi.fn<LinkScene['routing']['links']>(() => Promise.resolve(new Float32Array(0)));
navigationStore.selectStar(SUN.id);
await flushAsync();
await advanceFrames(engine, 2.5);
@@ -695,7 +695,7 @@ describe('GalaxySystemSceneComponent camera-flight transitions', () => {
});
it('gives a view on the move a new graph at least every quarter second, rather than waiting for it to stop', async () => {
const links = vi.fn((_rangePc: number, _drawn: Uint32Array) => Promise.resolve(new Float32Array(0)));
const links = vi.fn<LinkScene['routing']['links']>(() => Promise.resolve(new Float32Array(0)));
const component = linkScene(links);
await settle();
@@ -484,7 +484,7 @@ export class GalaxySystemSceneComponent implements AfterViewInit, OnDestroy {
// Reads both signals, so flipping the layer on and dragging the range each land here.
effect(() => {
this.jumpRangePc();
this.display().jumpLinks;
void this.display().jumpLinks;
this.scheduleJumpLinks();
});
}
@@ -1804,8 +1804,6 @@ export class GalaxySystemSceneComponent implements AfterViewInit, OnDestroy {
}
private swapToSystemSpace(star: StarRecord, direction: THREE.Vector3, onComplete: () => void): void {
const camera = this.engine.getCamera();
this.systemRenderer?.dispose();
if (this.starMarker) {
this.systemGroup.remove(this.starMarker);
@@ -1912,7 +1910,6 @@ export class GalaxySystemSceneComponent implements AfterViewInit, OnDestroy {
}
private swapToGalaxySpace(exitingStarId: number, direction: THREE.Vector3, isSwitchingSystems: boolean, onComplete: () => void): void {
const camera = this.engine.getCamera();
const star = this.starsById.get(exitingStarId);
const starPc = star ? new THREE.Vector3(star.x, star.y, star.z) : GALAXY_OVERVIEW_TARGET.clone();
+1 -1
View File
@@ -1,6 +1,6 @@
import * as THREE from 'three/webgpu';
import { GALACTIC_BASIS_EQUATORIAL, SUN_HEIGHT_ABOVE_MIDPLANE_PC } from '../../shared/astro/galaxy';
import { GALACTIC_BASIS_EQUATORIAL } from '../../shared/astro/galaxy';
const SEGMENTS_PER_RING = 180;
@@ -87,9 +87,9 @@ export function createRandom(seed: number): () => number {
/** Standard normal sample, by the polar form of Box-Muller. */
function gaussian(random: () => number): number {
let u = 0;
let v = 0;
let s = 0;
let u: number;
let v: number;
let s: number;
do {
u = random() * 2 - 1;
v = random() * 2 - 1;
@@ -5,7 +5,7 @@ import { BrightnessIndex, brightnessIndex, Positioned } from '../../shared/astro
import { spectralTypeToColorIndex } from '../../shared/astro/spectral';
import { SceneCamera } from '../../core/engine/engine.service';
import { StarRecord } from '../../shared/models/star.model';
import { PIXELS_TO_ANGULAR_SIZE, REFERENCE_FOV_DEGREES, REFERENCE_VIEWPORT_HEIGHT_PX } from './angular-size';
import { PIXELS_TO_ANGULAR_SIZE, REFERENCE_FOV_DEGREES } from './angular-size';
/** Apparent star diameters, in pixels at {@link REFERENCE_VIEWPORT_HEIGHT_PX}. */
const MIN_POINT_SIZE = 1.5;
+1 -1
View File
@@ -82,7 +82,7 @@ export class BookmarksStore {
}
private read(): Bookmark[] {
let raw: string | null = null;
let raw: string | null;
try {
raw = localStorage.getItem(STORAGE_KEY);
} catch {