chore(codeql): remove unused imports across src + tests

Closes 8 CodeQL js/unused-local-variable alerts. All deletions are pure
import-list trims — no runtime behavior changes:

  src/history.js          -- existsSync          (#72)
  src/sync.js             -- readFileSync        (#73)
  src/visual-diff.js      -- basename            (#62)
  src/index.js            -- formatAnatomyStubs  (#57; still re-exported)
  src/index.js            -- formatMotionTokens  (#58; still re-exported)
  src/formatters/tailwind.js   -- rgbToHex       (#54)
  src/formatters/vue-theme.js  -- rgbToHsl       (#55)
  src/formatters/css-vars.js   -- pxToRem        (#52)
  tests/wide-gamut.test.js -- oklchToSrgb, oklabToSrgb (#64)

Confirmed via grep that none of the removed names had call sites in
their source file. The two src/index.js entries still appear as
`export { … } from '…'` re-exports on lines 201–202 — those are
self-contained re-exports, not affected by the removed imports.

Skipped intentionally:
- Unused functions (#66–#69, #61, #76–#77) — may be retained as
  internal API surface; need per-call review.
- File-system race conditions (#70, #71) in sync.js / studio.js — real
  bugs, but need a dedicated atomic-write fix, not in scope.

336/336 tests pass; all touched modules load cleanly.
This commit is contained in:
Manav Arya Singh
2026-05-02 23:39:32 +04:00
parent 8614beda55
commit e2eced898e
8 changed files with 5 additions and 11 deletions
-2
View File
@@ -1,5 +1,3 @@
import { pxToRem } from '../utils.js';
export function formatCssVars(design) {
const lines = [':root {'];
+1 -1
View File
@@ -1,4 +1,4 @@
import { rgbToHex, rgbToHsl } from '../utils.js';
import { rgbToHsl } from '../utils.js';
function generateColorScale(hex, parsed) {
const { h, s } = parsed.hsl ?? rgbToHsl(parsed.rgb);
-2
View File
@@ -1,5 +1,3 @@
import { rgbToHsl } from '../utils.js';
export function formatVueTheme(design) {
const { colors, typography, spacing, borders, shadows } = design;
const lines = [];
+1 -1
View File
@@ -1,6 +1,6 @@
// Historical tracking — save and compare design snapshots over time
import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
import { readFileSync, writeFileSync, mkdirSync } from 'fs';
import { join } from 'path';
import { homedir } from 'os';
+1 -2
View File
@@ -26,7 +26,7 @@ import { extractWideGamut } from './extractors/wide-gamut.js';
import { extractTokenSources } from './extractors/token-sources.js';
import { extractInteractionStates } from './extractors/interaction-states.js';
import { extractMotion } from './extractors/motion.js';
import { extractComponentAnatomy, formatAnatomyStubs } from './extractors/component-anatomy.js';
import { extractComponentAnatomy } from './extractors/component-anatomy.js';
import { extractVoice } from './extractors/voice.js';
import { extractPageIntent } from './extractors/page-intent.js';
import { extractSectionRoles } from './extractors/section-roles.js';
@@ -39,7 +39,6 @@ import { extractBackgroundPatterns } from './extractors/background-patterns.js';
import { extractStackIntel } from './extractors/stack-intel.js';
import { extractFormStates } from './extractors/form-states.js';
import { formatDtcgTokens } from './formatters/dtcg-tokens.js';
import { formatMotionTokens } from './formatters/motion-tokens.js';
function safeExtract(fn, ...args) {
try { return fn(...args); } catch { return null; }
+1 -1
View File
@@ -5,7 +5,7 @@ import { formatTokens } from './formatters/tokens.js';
import { formatTailwind } from './formatters/tailwind.js';
import { formatCssVars } from './formatters/css-vars.js';
import { saveSnapshot, getHistory } from './history.js';
import { writeFileSync, readFileSync, statSync } from 'fs';
import { writeFileSync, statSync } from 'fs';
import { join } from 'path';
// Race-safe "update only if file exists" — statSync inside try/catch
-1
View File
@@ -7,7 +7,6 @@ import { extractDesignLanguage } from './index.js';
import { diffDesigns } from './diff.js';
import { nameFromUrl } from './utils.js';
import { statSync, existsSync, readFileSync } from 'fs';
import { basename } from 'path';
function fileKb(p) {
try { return Math.round(statSync(p).size / 1024); } catch { return 0; }
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, it } from 'node:test';
import assert from 'node:assert/strict';
import { oklchToSrgb, oklabToSrgb, oklchLikeToHex, parseOklchOrOklab, rgbToHex } from '../src/utils/color-gamut.js';
import { oklchLikeToHex, parseOklchOrOklab, rgbToHex } from '../src/utils/color-gamut.js';
import { extractWideGamut } from '../src/extractors/wide-gamut.js';
import { extractTokenSources } from '../src/extractors/token-sources.js';