refactor(fe): eliminate every explicit any; enforce no-explicit-any (R7 S3a·4)
Removes all 13 remaining `any`s and flips the ESLint rule from off to error so new ones can't creep back: - api.ts prefs/data JSON bags: Record<string, any> -> Record<string, unknown>, narrowed at consumers (App language guard; NotificationsPanel shapes the notification `data` per type behind its existing typeof guards) - catch (e: any) -> catch (e) + `e instanceof HttpError` narrowing (SettingsPanel, SetupWizard, PlexPlayer) - the YouTube IFrame API boundary: new lib/youtube.ts types (YTPlayer/ YTPlayerEvent/YTNamespace + a Window augmentation) replace the 6 player anys; tsc surfaced the exact method surface to declare - NotificationsPanel `t` props: any-options -> i18next TFunction Gate green: typecheck (app+node+e2e), eslint 0 errors (rule now enforced), prettier, 74 vitest.
This commit is contained in:
@@ -37,10 +37,11 @@ export default tseslint.config(
|
||||
// finding is reported once, by one tool, and this config stays about hooks + refresh safety.
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"no-undef": "off",
|
||||
// The 19 `any`s all live in the api.ts god-module, which R7 (Frontend API layer) rewrites.
|
||||
// Turning the rule on now would either block the gate on pre-existing debt or scatter 19
|
||||
// suppressions — R7 flips this back to "error" when it types that layer. Tracked, not ignored.
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
// R7 S3a eliminated every explicit `any` (api.ts prefs/data bags → Record<string, unknown>;
|
||||
// catch clauses → unknown + HttpError narrowing; the YouTube IFrame boundary → lib/youtube.ts
|
||||
// types; i18n `t` props → TFunction), so the rule is now enforced to keep new ones from
|
||||
// creeping back in. Prefer `unknown` + narrowing, or a typed boundary, over `any`.
|
||||
"@typescript-eslint/no-explicit-any": "error",
|
||||
// Side-effect ternaries/short-circuits are an established idiom here (`cond ? a() : b()`,
|
||||
// `v.paused ? v.play() : v.pause()`) — allow them rather than rewrite working code to if/else.
|
||||
"@typescript-eslint/no-unused-expressions": [
|
||||
|
||||
Reference in New Issue
Block a user