chore: remove the remaining unused local bindings

An ESLint no-unused-vars scan over src, server, scripts, tools, build
and pinokio, repeated until it is stable, reported these.

Runtime modules keep every call and drop only the unread binding:
- src/ui/cockpitInput.js: the unread result of enter()/exit().
- src/layers/launches/rendering.js: the unread entity returned by
  entities.add().
- src/layers/radio/rendering.js: the unread map key in the horizon scan,
  which now iterates the map's values.

QA scripts and tools drop an unused helper, two unused in-page module
imports, unused counters and destructured fields, and an unread wait
result. Tests drop source files read into variables that no assertion
uses, redundant StyleManager imports (the shell-source helper already
imports it), and unused destructured fields.

The one remaining report is the `_` loop variable in src/tools/schema.js,
which counts iterations and is intentional.
This commit is contained in:
Sameh Khamis committed 2026-10-22 19:08:10 -07:00
1 parent 46f7b74c8c
commit f3a87777ee
25 files changed
+15 -44

No files matched your search

-1
View File
@@ -52,7 +52,6 @@ try {
id, id,
value, value,
); );
const text = () => page.$eval('#cesium-credits', (e) => e.innerText);
const shot = async (name, osm, tiles) => { const shot = async (name, osm, tiles) => {
await sleep(300); await sleep(300);
const state = await page.$eval('#cesium-credits', (e) => { const state = await page.$eval('#cesium-credits', (e) => {
-2
View File
@@ -1291,8 +1291,6 @@ async function main() {
const clusterBadge = await page.evaluate(async () => { const clusterBadge = await page.evaluate(async () => {
const viewer = window.__godsEyeView.viewer; const viewer = window.__godsEyeView.viewer;
const { getOverlayPaintRect, getWorldOverlayDiagnostics } = await import('/src/overlays/worldOverlay.js'); const { getOverlayPaintRect, getWorldOverlayDiagnostics } = await import('/src/overlays/worldOverlay.js');
const { distanceFade } = await import('/src/overlays/worldOverlayDraw.js');
const { radioStationIdFromPick } = await import('/src/data/radio.js');
const baselineSolveRevision = getWorldOverlayDiagnostics().solveRevision; const baselineSolveRevision = getWorldOverlayDiagnostics().solveRevision;
const source = Array.from({ length: viewer.dataSources.length }, (_, index) => viewer.dataSources.get(index)) const source = Array.from({ length: viewer.dataSources.length }, (_, index) => viewer.dataSources.get(index))
.find((item) => item.name === 'Radio stations'); .find((item) => item.name === 'Radio stations');
+1 -3
View File
@@ -80,9 +80,7 @@ try {
page.evaluate(() => { page.evaluate(() => {
const { viewer, dataManager } = window.__godsEyeView; const { viewer, dataManager } = window.__godsEyeView;
let upper = 0, let upper = 0,
lower = 0, lower = 0;
near = 0;
const camera = viewer.camera.positionWC;
dataManager.layers dataManager.layers
.get('traffic') .get('traffic')
.module.visitMotionDots((id, key, p) => { .module.visitMotionDots((id, key, p) => {
+1 -1
View File
@@ -295,7 +295,7 @@ async function main() {
); );
// Wait for the photoreal tileset and at least one vessel refresh. // Wait for the photoreal tileset and at least one vessel refresh.
const settled = await page await page
.waitForFunction(() => { .waitForFunction(() => {
const gev = window.__godsEyeView; const gev = window.__godsEyeView;
const t = gev.tileset; const t = gev.tileset;
+1 -2
View File
@@ -1,7 +1,6 @@
import { LayerBindings } from './ui/layerBindings.js'; import { LayerBindings } from './ui/layerBindings.js';
import { readShellSource, shellMethod } from './testSupport/readShellSource.mjs'; import { readShellSource, shellMethod } from './testSupport/readShellSource.mjs';
import { readLayerSource } from './testSupport/readLayerSource.mjs'; import { readLayerSource } from './testSupport/readLayerSource.mjs';
import { StyleManager } from './ui/applicationShell.js';
import { enter as cockpitEnter, navigateContext } from './ui/cockpitTrackingController.js'; import { enter as cockpitEnter, navigateContext } from './ui/cockpitTrackingController.js';
import { CockpitViewController } from './ui/cockpitController.js'; import { CockpitViewController } from './ui/cockpitController.js';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
@@ -384,7 +383,7 @@ test('world-focus listener lifecycle is symmetric and idempotent', () => {
}); });
test('vessel and fire layers announce valid clicks and never fly cameras', () => { test('vessel and fire layers announce valid clicks and never fly cameras', () => {
for (const [label, source] of [['vessels', vessels], ['fires', firms]]) { for (const source of [vessels, firms]) {
assert.match(source, /requestWorldFocus\(\{/); assert.match(source, /requestWorldFocus\(\{/);
assert.doesNotMatch(source, /camera\.flyTo/); assert.doesNotMatch(source, /camera\.flyTo/);
} }
-1
View File
@@ -8,7 +8,6 @@ import { setContextMode as contextModeAction } from './ui/contextActions.js';
import { ContextControls } from './ui/contextControls.js'; import { ContextControls } from './ui/contextControls.js';
import { readFileSync as readRadioSource } from 'node:fs'; import { readFileSync as readRadioSource } from 'node:fs';
const radioBindings = readRadioSource(new URL('./ui/radioBindings.js', import.meta.url), 'utf8'); const radioBindings = readRadioSource(new URL('./ui/radioBindings.js', import.meta.url), 'utf8');
const radioPresentation = readRadioSource(new URL('./ui/radioPresentation.js', import.meta.url), 'utf8');
const radioControlsSource = readRadioSource(new URL('./ui/radioControls.js', import.meta.url), 'utf8'); const radioControlsSource = readRadioSource(new URL('./ui/radioControls.js', import.meta.url), 'utf8');
// Source-contract pins read the actual Context owners and root disposal wiring. Each pin guards a bug that shipped or nearly shipped: // Source-contract pins read the actual Context owners and root disposal wiring. Each pin guards a bug that shipped or nearly shipped:
// - session bookkeeping ran AFTER the exit early-return, so the compensating // - session bookkeeping ran AFTER the exit early-return, so the compensating
-5
View File
@@ -1,4 +1,3 @@
import { readShellSource } from './testSupport/readShellSource.mjs';
import { expandApplicationHtml } from '../build/application-html.js'; import { expandApplicationHtml } from '../build/application-html.js';
import { readStylesheet } from './testSupport/readStylesheet.mjs'; import { readStylesheet } from './testSupport/readStylesheet.mjs';
import { _selectContextMode } from './ui/contextTransactions.js'; import { _selectContextMode } from './ui/contextTransactions.js';
@@ -8,13 +7,11 @@ import { clearSelectedLayers } from './ui/contextActions.js';
import { readFileSync as readRadioSource } from 'node:fs'; import { readFileSync as readRadioSource } from 'node:fs';
const radioBindings = readRadioSource(new URL('./ui/radioBindings.js', import.meta.url), 'utf8'); const radioBindings = readRadioSource(new URL('./ui/radioBindings.js', import.meta.url), 'utf8');
const radioPresentation = readRadioSource(new URL('./ui/radioPresentation.js', import.meta.url), 'utf8'); const radioPresentation = readRadioSource(new URL('./ui/radioPresentation.js', import.meta.url), 'utf8');
const radioControlsSource = readRadioSource(new URL('./ui/radioControls.js', import.meta.url), 'utf8');
import { readFileSync } from 'node:fs'; import { readFileSync } from 'node:fs';
import { test } from 'node:test'; import { test } from 'node:test';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
const html = expandApplicationHtml(readFileSync(new URL('../index.html', import.meta.url), 'utf8')); const html = expandApplicationHtml(readFileSync(new URL('../index.html', import.meta.url), 'utf8'));
const ui = readShellSource();
const css = readStylesheet(new URL('../style.css', import.meta.url)); const css = readStylesheet(new URL('../style.css', import.meta.url));
test('Contacts and Space Missions both participate in the ordinary Tab sequence', () => { test('Contacts and Space Missions both participate in the ordinary Tab sequence', () => {
@@ -32,8 +29,6 @@ test('Contacts and Space Missions both participate in the ordinary Tab sequence'
}); });
test('Context transition state preserves focus and Tab availability until settle', () => { test('Context transition state preserves focus and Tab availability until settle', () => {
const syncSource = _syncContextModeButtons.toString();
const attributes = () => new Map(); const attributes = () => new Map();
const makeButton = () => { const makeButton = () => {
const attrs = attributes(); const attrs = attributes();
-2
View File
@@ -1,4 +1,3 @@
import { readShellSource } from './testSupport/readShellSource.mjs';
import { readStylesheet } from './testSupport/readStylesheet.mjs'; import { readStylesheet } from './testSupport/readStylesheet.mjs';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
@@ -8,7 +7,6 @@ import { fileURLToPath } from 'node:url';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..'); const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const css = readStylesheet(path.join(ROOT, 'style.css')); const css = readStylesheet(path.join(ROOT, 'style.css'));
const ui = readShellSource();
/* /*
* Required-attribution keep-out pin. * Required-attribution keep-out pin.
+1 -3
View File
@@ -1779,7 +1779,6 @@ test('voice playback confirmation waits for playing and requires a hard duck', a
}); });
test('voice playback confirmation accepts fallback buffering but times out safely', async () => { test('voice playback confirmation accepts fallback buffering but times out safely', async () => {
let listener = () => {};
const state = { const state = {
audioState: 'loading', audioState: 'loading',
playingStationId: 'fallback', playingStationId: 'fallback',
@@ -1789,9 +1788,8 @@ test('voice playback confirmation accepts fallback buffering but times out safel
const confirmed = await confirmRadioPlayback({ const confirmed = await confirmRadioPlayback({
startPlayback: async () => false, startPlayback: async () => false,
subscribe: (next) => { subscribe: (next) => {
listener = next;
next(state); next(state);
return () => { listener = () => {}; }; return () => {};
}, },
getState: () => state, getState: () => state,
timeoutMs: 10, timeoutMs: 10,
-2
View File
@@ -930,7 +930,6 @@ for (const fixture of LAYERS) {
} }
test('both layers gate the tracked-model load and record its failures', async () => { test('both layers gate the tracked-model load and record its failures', async () => {
const { readFile } = await import('node:fs/promises');
for (const name of ['flights.js', 'militaryFlights.js']) { for (const name of ['flights.js', 'militaryFlights.js']) {
const source = readLayerSource(new URL(`./${name}`, import.meta.url)); const source = readLayerSource(new URL(`./${name}`, import.meta.url));
assert.match(source, /!(?:flightState\.)?_trackedModel\s*&&\s*!(?:flightState\.)?_trackedModelLoading\s*&&\s*(?:parts\.\w+\.)?_trackedModelLoadAllowed\(\s*,?\s*\)/, assert.match(source, /!(?:flightState\.)?_trackedModel\s*&&\s*!(?:flightState\.)?_trackedModelLoading\s*&&\s*(?:parts\.\w+\.)?_trackedModelLoadAllowed\(\s*,?\s*\)/,
@@ -946,7 +945,6 @@ test('both layers gate the tracked-model load and record its failures', async ()
}); });
test('the tracked regime never consults the fleet models3d toggle', async () => { test('the tracked regime never consults the fleet models3d toggle', async () => {
const { readFile } = await import('node:fs/promises');
for (const name of ['flights.js', 'militaryFlights.js']) { for (const name of ['flights.js', 'militaryFlights.js']) {
const source = readLayerSource(new URL(`./${name}`, import.meta.url)); const source = readLayerSource(new URL(`./${name}`, import.meta.url));
const regime = /^([ \t]*)function _trackedModelRegimeActive\b[\s\S]*?\n\1\}/m.exec(source)?.[0]; const regime = /^([ \t]*)function _trackedModelRegimeActive\b[\s\S]*?\n\1\}/m.exec(source)?.[0];
-4
View File
@@ -373,10 +373,6 @@ test('one ESC does one thing — the radio disclosure stops the launcher outrigh
new URL('./ui/radioBindings.js', import.meta.url), new URL('./ui/radioBindings.js', import.meta.url),
'utf8', 'utf8',
); );
const module = fs.readFileSync(
new URL('./firstRunExperience.js', import.meta.url),
'utf8',
);
// stopPropagation() does NOT stop later listeners on the SAME document, so the // stopPropagation() does NOT stop later listeners on the SAME document, so the
// disclosure's earlier capture handler closed the disclosure and the launcher // disclosure's earlier capture handler closed the disclosure and the launcher
@@ -60,7 +60,7 @@ test('the layer reports failure when a failed city left it with nothing', () =>
}); });
test('a layer with nothing to draw and nothing failed is not an error', () => { test('a layer with nothing to draw and nothing failed is not an error', () => {
const { state, methods } = makeLayer(); const { methods } = makeLayer();
// Out of range of every city is empty, not broken. // Out of range of every city is empty, not broken.
assert.equal(methods.getStats().error, undefined); assert.equal(methods.getStats().error, undefined);
+1 -1
View File
@@ -109,7 +109,7 @@ export function createRendering({
); );
}); });
if (satelliteTrack) layerState._orbitMatches++; if (satelliteTrack) layerState._orbitMatches++;
const entity = layerState._dataSource.entities.add({ layerState._dataSource.entities.add({
id: `rocket-launch:${launch.id}`, id: `rocket-launch:${launch.id}`,
position, position,
point: { point: {
+1 -1
View File
@@ -259,7 +259,7 @@ export function createRendering({
layerState._horizonScanCount += 1; layerState._horizonScanCount += 1;
const occluder = horizonOccluder(layerState._viewer.camera); const occluder = horizonOccluder(layerState._viewer.camera);
let visibilityChanged = false; let visibilityChanged = false;
for (const [id, record] of layerState._renderById) { for (const record of layerState._renderById.values()) {
const matches = parts.categories.stationMatchesRadioCategory( const matches = parts.categories.stationMatchesRadioCategory(
record.station, record.station,
layerState._filter, layerState._filter,
+2 -2
View File
@@ -317,7 +317,7 @@ test('a rejected key stops coverage requests until the layer goes off', async ()
test('a rate limit keeps the drawn tiles and asks again once the wait is over', async (t) => { test('a rate limit keeps the drawn tiles and asks again once the wait is over', async (t) => {
t.mock.timers.enable({ apis: ['setTimeout', 'Date'] }); t.mock.timers.enable({ apis: ['setTimeout', 'Date'] });
const { viewer, source, state, coverage } = setup(); const { viewer, source, coverage } = setup();
coverage.refresh(); coverage.refresh();
source.calls[0].reject( source.calls[0].reject(
Object.assign(new Error('rate limited'), { retryAfterSec: 30 }), Object.assign(new Error('rate limited'), { retryAfterSec: 30 }),
@@ -593,7 +593,7 @@ test('a tile that fails before the terrain table loads is reported at once, neve
}); });
test('the selected sequence is drawn and highlighted even past the per-tile cap', async () => { test('the selected sequence is drawn and highlighted even past the per-tile cap', async () => {
const { state, source, coverage, centre, viewer } = setup(); const { state, source, coverage, centre } = setup();
const line = (n) => [ const line = (n) => [
[ [
[centre.lon - 0.001, centre.lat + n * 1e-6], [centre.lon - 0.001, centre.lat + n * 1e-6],
-1
View File
@@ -1406,7 +1406,6 @@ test('the selected card lands where the vehicle stopped, not short of it', async
// segment ends left it a few metres behind, and then the render hold was // segment ends left it a few metres behind, and then the render hold was
// released with no frame scheduled to close the gap. // released with no frame scheduled to close the gap.
const app = harness(t); const app = harness(t);
const start = Date.now();
app.serve('mbta', () => ({ app.serve('mbta', () => ({
status: 200, status: 200,
body: snapshot('mbta', 'MBTA', [vehicle('b', 42.36, -71.06, reported())], { body: snapshot('mbta', 'MBTA', [vehicle('b', 42.36, -71.06, reported())], {
+1 -1
View File
@@ -97,7 +97,7 @@ const complete = (model, extra = {}) => ({
}); });
test('local appearance and units reuse the loaded field; optional scalar requests remain separate', async () => { test('local appearance and units reuse the loaded field; optional scalar requests remain separate', async () => {
const requests = []; const requests = [];
const { layer, calls } = harness({ const { layer } = harness({
getSnapshot: async (args) => { getSnapshot: async (args) => {
requests.push(args); requests.push(args);
return complete( return complete(
-1
View File
@@ -93,7 +93,6 @@ test('deferred terminal notices lose ownership to newer acquisition epochs and d
}); });
test('share-follow failures use the universal top-center status instead of the bottom toast', () => { test('share-follow failures use the universal top-center status instead of the bottom toast', () => {
const ui = readShellSource();
const handler = shellMethod('_handleShareTrackingRestoreStatus').toString(); const handler = shellMethod('_handleShareTrackingRestoreStatus').toString();
assert.match(handler, /this\.showStatus\(message\)/); assert.match(handler, /this\.showStatus\(message\)/);
assert.match(handler, /this\.initialRestorePromise\.then\(showAfterStartupCover\)/); assert.match(handler, /this\.initialRestorePromise\.then\(showAfterStartupCover\)/);
-1
View File
@@ -1,5 +1,4 @@
import { readShellSource, shellMethod } from './testSupport/readShellSource.mjs'; import { readShellSource, shellMethod } from './testSupport/readShellSource.mjs';
import { StyleManager } from './ui/applicationShell.js';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import fs from 'node:fs'; import fs from 'node:fs';
import path from 'node:path'; import path from 'node:path';
+1 -3
View File
@@ -1,6 +1,5 @@
import { readShellSource, shellMethod } from './testSupport/readShellSource.mjs'; import { shellMethod } from './testSupport/readShellSource.mjs';
import { expandApplicationHtml } from '../build/application-html.js'; import { expandApplicationHtml } from '../build/application-html.js';
import { StyleManager } from './ui/applicationShell.js';
import { createHoverDisclosure, collapsePanelOnEscape } from './ui/panelDisclosure.js'; import { createHoverDisclosure, collapsePanelOnEscape } from './ui/panelDisclosure.js';
import test from 'node:test'; import test from 'node:test';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
@@ -8,7 +7,6 @@ import { readFileSync } from 'node:fs';
import { msg, t } from './i18n/index.js'; import { msg, t } from './i18n/index.js';
// Exercise the installed event routes and central close method, without WebGL. // Exercise the installed event routes and central close method, without WebGL.
const source = readShellSource();
const markup = expandApplicationHtml(readFileSync(new URL('../index.html', import.meta.url), 'utf8')); const markup = expandApplicationHtml(readFileSync(new URL('../index.html', import.meta.url), 'utf8'));
const locationMarkup = markup.slice(markup.indexOf('<div id="location-bar"'), markup.indexOf('<div id="left-panel-stack"')); const locationMarkup = markup.slice(markup.indexOf('<div id="location-bar"'), markup.indexOf('<div id="left-panel-stack"'));
const locationToggleMarkup = locationMarkup.match(/<button\b([^>]*\bid="location-bar-toggle"[^>]*)>([\s\S]*?)<\/button>/); const locationToggleMarkup = locationMarkup.match(/<button\b([^>]*\bid="location-bar-toggle"[^>]*)>([\s\S]*?)<\/button>/);
-2
View File
@@ -2,8 +2,6 @@ import { readShellSource } from './testSupport/readShellSource.mjs';
import { onKeyDown as cockpitKeyDown } from './ui/cockpitInput.js'; import { onKeyDown as cockpitKeyDown } from './ui/cockpitInput.js';
import { readFileSync as readRadioSource } from 'node:fs'; import { readFileSync as readRadioSource } from 'node:fs';
const radioBindings = readRadioSource(new URL('./ui/radioBindings.js', import.meta.url), 'utf8'); const radioBindings = readRadioSource(new URL('./ui/radioBindings.js', import.meta.url), 'utf8');
const radioPresentation = readRadioSource(new URL('./ui/radioPresentation.js', import.meta.url), 'utf8');
const radioControlsSource = readRadioSource(new URL('./ui/radioControls.js', import.meta.url), 'utf8');
import { bindPanelDisclosure, collapsePanelOnEscape } from './ui/panelDisclosure.js'; import { bindPanelDisclosure, collapsePanelOnEscape } from './ui/panelDisclosure.js';
import assert from 'node:assert/strict'; import assert from 'node:assert/strict';
import test from 'node:test'; import test from 'node:test';
-1
View File
@@ -2,7 +2,6 @@ import { DisplayBindings } from './ui/displayBindings.js';
import { LocationNavigation } from './ui/locationNavigation.js'; import { LocationNavigation } from './ui/locationNavigation.js';
import { VisualSettings } from './ui/visualSettings.js'; import { VisualSettings } from './ui/visualSettings.js';
import { readShellSource, shellMethod } from './testSupport/readShellSource.mjs'; import { readShellSource, shellMethod } from './testSupport/readShellSource.mjs';
import { StyleManager } from './ui/applicationShell.js';
import { _claimContextVisualAuthority, setContextMode } from './ui/contextActions.js'; import { _claimContextVisualAuthority, setContextMode } from './ui/contextActions.js';
import { _initGlobalContextPanel } from './ui/contextBindings.js'; import { _initGlobalContextPanel } from './ui/contextBindings.js';
import { test } from 'node:test'; import { test } from 'node:test';
+2 -1
View File
@@ -64,7 +64,8 @@ export function onKeyDown(event) {
event.preventDefault(); event.preventDefault();
event.stopImmediatePropagation(); event.stopImmediatePropagation();
if (!this.active && !this.isEntryAllowed()) return; if (!this.active && !this.isEntryAllowed()) return;
const changed = this.active ? this.exit() : this.enter(); if (this.active) this.exit();
else this.enter();
return; return;
} }
} }
+1 -1
View File
@@ -135,7 +135,7 @@ test('an old progress completion leaves the active in-band response alone', asyn
}); });
test('user speech stops an audible progress line: cancel and clear its audio', async () => { test('user speech stops an audible progress line: cancel and clear its audio', async () => {
const { controller, sent, event, progressLine } = controllerFixture(); const { sent, event, progressLine } = controllerFixture();
await progressLine('resp_p'); await progressLine('resp_p');
await event({ type: 'output_audio_buffer.started', response_id: 'resp_p' }); await event({ type: 'output_audio_buffer.started', response_id: 'resp_p' });
sent.length = 0; sent.length = 0;
+1 -1
View File
@@ -157,7 +157,7 @@ async function fetchTile(apiKey, session, panoId, z, x, y) {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
async function stitchPanorama(apiKey, session, panoId, metadata, zoom) { async function stitchPanorama(apiKey, session, panoId, metadata, zoom) {
const { imageWidth, imageHeight, tileWidth, tileHeight } = metadata; const { tileWidth, tileHeight } = metadata;
// Street View tile grids follow a fixed power-of-2 scheme: // Street View tile grids follow a fixed power-of-2 scheme:
// zoom 0: 1×1 (360° FOV, entire panorama in one tile) // zoom 0: 1×1 (360° FOV, entire panorama in one tile)