A getter reads or a setter writes its own property, which recurses without end

tx0/ts:accessor-recursiondefaulterrorbug

What it finds

get name() { return this.name; }, set name(v) { this.name = v; }: a getter that reads its own property calls itself, and a setter that assigns its own property calls itself, without end, until the stack overflows. A field with another name, often _name or #name, was meant to hold the value.

Reported are reads of this.<name> in a getter and writes to it in a setter of the same name, outside nested functions and outside conditions, loops and try, where the access may be guarded, as a getter that fills a cache on its first call and reads it again does.

From the rule's source, accessor_recursion.rs.

Example from the rule's tests
export class User {  private _name = "";  get name(): string {    return this.name;tx0 reports: this getter reads name itself  }  set name(v: string) {    this.name = v;tx0 reports: this setter writes name itself  }  get label(): string {    return this._name;  }  set label(v: string) {    this._name = v;  }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:accessor-recursion" = "off"

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:accessor-recursion] reason="..."

tx0 explain tx0/ts:accessor-recursion shows the same in the terminal. Found a false positive? Report it.