Files
Matiss Janis Aboltins 541df52441 Enable restrict-template-expressions linting rule (#7181)
* [AI] Promote typescript/restrict-template-expressions to error and fix violations

Convert the oxlint rule from "warn" to "error" and fix all 42 violations
by wrapping non-string template expressions with String(). This ensures
type safety in template literals across the codebase.

https://claude.ai/code/session_01Uk8SwFbD6HuUuo3SSMwU9z

* Add release notes for PR #7181

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-13 18:36:58 +00:00

47 lines
1.3 KiB
TypeScript

import promiseRetry from 'promise-retry';
const BACKEND_IMPORT_MAX_RETRIES = 30;
const lazyLoadBackend = async (isDev: boolean) => {
if (process.env.lootCoreScript === undefined) {
throw new Error(
'The environment variable `lootCoreScript` is not defined. Please define it to point to the server bundle.',
);
}
try {
// These retries are primarily for dev mode, where we watch for changes in loot-core
// In a packaged build this should always work the first time.
const bundle = await promiseRetry(
async (retry, number) => {
try {
return await import(process.env.lootCoreScript!);
} catch (error) {
console.info(
`Loading server bundle: Attempt ${number} of ${BACKEND_IMPORT_MAX_RETRIES}`,
);
retry(error);
}
},
{
retries: BACKEND_IMPORT_MAX_RETRIES,
minTimeout: 1000,
maxTimeout: 1000,
factor: 1, // No exponential backoff
},
);
bundle.initApp(isDev);
} catch (error) {
console.error('Failed to init the server bundle after all retries:', error);
throw new Error(
`Failed to init the server bundle after all retries: ${String(error)}`,
);
}
};
const isDev = false;
// Start the app
void lazyLoadBackend(isDev);