Skip to content

objectProto

Reports using the deprecated proto property to access or modify an object's prototype.

✅ This rule is included in the ts untyped preset.

The __proto__ property is a deprecated way to access and modify an object’s prototype. While it is supported for backwards compatibility, it is not part of the ECMAScript standard and can cause performance issues. Direct manipulation of an object’s prototype can lead to “hidden classes” in JavaScript engines, resulting in slower code execution.

const proto = obj.__proto__;
obj.__proto__ = prototype;
const value = obj["__proto__"];

This rule is not configurable.

If you need to support very old JavaScript environments that don’t have Object.getPrototypeOf and Object.setPrototypeOf (pre-ES5), you might need to disable this rule. However, this is extremely rare in modern development, as even Internet Explorer 9 supports these methods.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.