Names inside with (obj) resolve against an object at run time
What it finds
with (obj) { x = 1; }: whether x is a property of obj or a variable outside depends on the object at run time, so neither a reader nor a tool can tell what a name refers to. The statement is a syntax error in strict code and in modules.
From the rule's source, dynamic_scope_with.rs.
function area(shape: any) { with (shape) {tx0 reports: with hides what the names inside refer to return width * height; }} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:dynamic-scope-with" = "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:dynamic-scope-with] reason="..."tx0 explain tx0/ts:dynamic-scope-with shows the same in the terminal. Found a false positive? Report it.