Skip to content
Sarj Code Standards

no-redundant-local-alias

Pass the original local into an object field instead of creating a single-use rename.

Why

An unannotated alias used only by its matching object field adds a second name without adding a contract.

Fix

Write the object property with the original binding, then remove the redundant alias. Keep annotations, captured snapshots and independently useful names.

Examples

Before — flagged The closed primitive return preserves the data-field contract
src/request.ts
export {};
function request(value: string) {
const accountId = value;
return { accountId };
}
After — preferred The direct data field needs no local alias
src/request.ts
export {};
function request(value: string) {
return { accountId: value };
}
Autofix output
src/request.ts
export {};
function request(value: string) {
return { accountId: value };
}
Before — flagged The property already supplies the name
src/request.ts
function request(value: string) {
const accountId = value;
return { accountId };
}
After — preferred Use the original binding
src/request.ts
function request(value: string) {
return { accountId: value };
}