chore(hygiene): Phase 4 guardrails — noUnusedLocals/Parameters + dead-code sweep

Enable tsconfig noUnusedLocals + noUnusedParameters (permanent guardrail: every tsc/
build now flags re-accumulated dead code). Fixed the 8 violations that surfaced, all
genuine dead code:
- Sidebar: deleted unused SORT_IDS/SHOW_IDS/rollSeed consts + the dead Toggle component
  (+ its now-unused Switch import).
- PlexBrowse: dropped the unused onClearSearch prop (Props + destructure + App call site).
- VideoEditor: dropped the unused map index; notifications: deleted the dead back-compat
  toast(); storage: deleted the unused non-account usePersistedState (+ readJSON import).
- SavedViewsWidget: deleted the dead loadDefaultViewFilters export (App loads the default
  view inline; resolves the last knip unused-export → knip now clean).

Backend: added backend/ruff.toml (ignore E402 — intentional pre-import setup in main.py)
and fixed the 6 E702/E741 style items (_vtt_s_to_ts semicolons, ambiguous `l` loop vars)
so ruff is green. localdev boots; Feed/Plex/sidebar render; 0 console errors.
This commit is contained in:
npeter83 2026-07-12 02:15:52 +02:00
parent b481de0e48
commit 4dd1327b93
12 changed files with 27 additions and 85 deletions

View file

@ -752,7 +752,7 @@ def list_links(
.scalars()
.all()
)
return [linksmod.owner_view(l) for l in rows]
return [linksmod.owner_view(row) for row in rows]
@router.post("/{job_id}/links")

View file

@ -1346,11 +1346,15 @@ def _vtt_ts_to_s(ts: str) -> float:
def _vtt_s_to_ts(x: float) -> str:
x = max(0.0, x)
h = int(x // 3600); x -= h * 3600
m = int(x // 60); x -= m * 60
s = int(x); ms = int(round((x - s) * 1000))
h = int(x // 3600)
x -= h * 3600
m = int(x // 60)
x -= m * 60
s = int(x)
ms = int(round((x - s) * 1000))
if ms >= 1000:
s += 1; ms -= 1000
s += 1
ms -= 1000
return f"{h:02d}:{m:02d}:{s:02d}.{ms:03d}"

View file

@ -34,9 +34,9 @@ def _external_links(branding: dict) -> list | None:
channel = branding.get("channel", {})
links = channel.get("links") or []
out = [
{"title": l.get("title"), "url": l.get("url")}
for l in links
if isinstance(l, dict) and l.get("url")
{"title": item.get("title"), "url": item.get("url")}
for item in links
if isinstance(item, dict) and item.get("url")
]
return out or None

6
backend/ruff.toml Normal file
View file

@ -0,0 +1,6 @@
# Ruff config for the Siftlode backend. Keeps ruff's default rule set (E4/E7/E9 + F = the
# high-signal pyflakes/pycodestyle checks that catch real dead code + bugs), but ignores E402:
# a handful of modules (e.g. main.py) deliberately run setup — logging config, sys.path — before
# importing route modules, so "module import not at top of file" is intentional there, not cruft.
[lint]
ignore = ["E402"]