diff --git a/eslint.config.mjs b/eslint.config.mjs index 71732a6..a2aba3b 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -8,4 +8,15 @@ const urlConstantsOverride = { }, }; -export default [...config, urlConstantsOverride]; +// Forbid non-null assertions (`value!`). The `!` operator silently tells the +// type checker a value can't be null/undefined without any runtime guarantee, +// so a wrong assumption surfaces as a runtime crash instead of a compile error. +// `eslint-config-agent` does not ship this rule. Prefer an explicit guard, +// optional chaining, or narrowing instead. +const noNonNullAssertion = { + rules: { + "@typescript-eslint/no-non-null-assertion": "error", + }, +}; + +export default [...config, urlConstantsOverride, noNonNullAssertion]; diff --git a/src/app/open/use-auto-close.ts b/src/app/open/use-auto-close.ts index bb1ee53..11ff353 100644 --- a/src/app/open/use-auto-close.ts +++ b/src/app/open/use-auto-close.ts @@ -22,8 +22,7 @@ export function useAutoClose(active: boolean) { intervalRef.current = setInterval(() => { setCountdown((prev) => { if (prev <= 1) { - clearInterval(intervalRef.current!); - intervalRef.current = null; + clearTimer(); window.close(); return 0; }