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>
This commit is contained in:
Matiss Janis Aboltins
2026-03-13 18:36:58 +00:00
committed by GitHub
parent 85e3166495
commit 541df52441
34 changed files with 61 additions and 42 deletions

View File

@@ -76,7 +76,7 @@ export function patchFetchForSqlJS(baseURL: string) {
},
});
}
return Promise.reject(new Error(`fetch not mocked for ${url}`));
return Promise.reject(new Error(`fetch not mocked for ${String(url)}`));
},
);
}

View File

@@ -944,7 +944,7 @@ handlers['api/schedule-update'] = withMutation(async function ({
break;
default:
throw APIError(
`Invalid amount operator: ${value}. Expected: is, isapprox, or isbetween`,
`Invalid amount operator: ${String(value)}. Expected: is, isapprox, or isbetween`,
);
}
sched._conditions[amountIndex].op = convertedOp;

View File

@@ -715,7 +715,11 @@ const compileOp = saveStack('op', (state, fieldRef, opData) => {
// Dedupe the ids
const ids = [...new Set(right)];
return `${left} IN (` + ids.map(id => `'${id}'`).join(',') + ')';
return (
`${String(left)} IN (` +
ids.map(id => `'${String(id)}'`).join(',') +
')'
);
}
case '$like': {
const [left, right] = valArray(state, [lhs, rhs], ['string', 'string']);

View File

@@ -611,7 +611,7 @@ export class CategoryTemplateContext {
monthUtils.addMonths(date, numPeriods * 12);
break;
default:
throw new Error(`Unrecognized periodic period: ${period}`);
throw new Error(`Unrecognized periodic period: ${String(period)}`);
}
//shift the starting date until its in our month or in the future

View File

@@ -89,7 +89,7 @@ const exportModel = {
if (!isWidgetType(widget.type)) {
throw new ValidationError(
`Invalid widget.${idx}.type value ${widget.type}.`,
`Invalid widget.${idx}.type value ${String(widget.type)}.`,
);
}

View File

@@ -24,7 +24,7 @@ export const mappingsFromString = (str: string): Mappings => {
);
} catch (e) {
const message = e instanceof Error ? e.message : e;
throw new Error(`Failed to parse mapping: ${message}`);
throw new Error(`Failed to parse mapping: ${String(message)}`);
}
};

View File

@@ -79,7 +79,7 @@ export function getDownloadError({
default:
const info =
meta && typeof meta === 'object' && 'fileId' in meta && meta.fileId
? `, fileId: ${meta.fileId}`
? `, fileId: ${String(meta.fileId)}`
: '';
return t(
'Something went wrong trying to download that file, sorry! Visit https://actualbudget.org/contact/ for support. reason: {{reason}}{{info}}',