A variable or parameter name does not follow the configured case style
What it finds
Variables named in one case style read alike across a code base; a constant in UPPER_CASE or a component in PascalCase stands out by convention.
The names of variables and parameters declared as plain names are checked against the case styles of the parameter style, camelCase|PascalCase|UPPER_CASE by default; several styles are separated by |. Names bound by destructuring often mirror external data, such as { user_id } from a JSON response, and are left alone, as are leading and trailing underscores and dollar signs.
From the rule's source, variable_naming.rs.
const MAX_SIZE = 10;export function area(side_length: number) {tx0 reports: the variable name side_length is not written const { user_id } = { user_id: 1 }; const Result = side_length * side_length; let total_value = Result + user_id + MAX_SIZE;tx0 reports: the variable name total_value is not written return total_value;} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:variable-naming" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:variable-naming] reason="..."tx0 explain tx0/ts:variable-naming shows the same in the terminal. Found a false positive? Report it.