A method that returns this declares the class as its return type, which subclasses then lose

tx0/ts:fluent-method-names-classrecommendedwarningstyle/namingdepth fastsmell

What it finds

A fluent method returns the object it was called on. Declared to return the class by name, a call on a subclass gives the base class type, so chaining a subclass method after it fails to type-check. The return type this follows the subclass.

Reported are methods whose return type is the name of their class and whose return statements all return this.

From the rule's source, fluent_method_names_class.rs.

Example from the rule's tests
export class Query {  private parts: string[] = [];  where(part: string): Query {tx0 reports: this method returns this    this.parts.push(part);    return this;  }}
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 from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/ts:fluent-method-names-class" = "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:fluent-method-names-class] reason="..."

tx0 explain tx0/ts:fluent-method-names-class shows the same in the terminal. Found a false positive? Report it.