this is copied into a variable
What it finds
const self = this;: copying this into a variable was the way to reach it from a nested function. Arrow functions keep the this of the code around them, so the copy is no longer needed, and it hides from readers and tools what the variable stands for.
Destructuring this, as const { a, b } = this, is left alone.
From the rule's source, this_alias.rs.
class View { name = "v"; render() { const self = this;tx0 reports: this copies this into a variable const { name } = this; return () => self.name + name; }} 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:this-alias" = "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:this-alias] reason="..."tx0 explain tx0/ts:this-alias shows the same in the terminal. Found a false positive? Report it.