Code reaches for __proto__, arguments.callee or another pre-standard property

tx0/ts:legacy-introspectionrecommendedwarningsmell

What it finds

obj.__proto__, arguments.callee, obj.__defineGetter__(...): these are leftovers of early JavaScript engines. arguments.callee and arguments.caller throw in strict code and in classes and modules; __proto__ and the __define*__ and __lookup*__ methods exist only for compatibility and do not work on objects without a prototype.

The standard replacements are Object.getPrototypeOf and Object.setPrototypeOf, Object.defineProperty and Object.getOwnPropertyDescriptor, and a named function instead of arguments.callee. arguments must be the implicit one of a function, not a variable of that name.

From the rule's source, legacy_introspection.rs.

Example from the rule's tests
function walk(node: any) {  const parent = node.__proto__;tx0 reports: __proto__ is a pre-standard property  const self = arguments.callee;tx0 reports: arguments.callee throws in strict code  return [parent, self, Object.getPrototypeOf(node)];}function shadow(args: any) {  const arguments2 = args;  return arguments2.callee;}
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:legacy-introspection" = "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:legacy-introspection] reason="..."

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