Disallow Use of proto (no-proto)

__proto__ property has been deprecated as of ECMAScript 3.1 and shouldn’t be used in the code. Use getPrototypeOf method instead.

Rule Details

When an object is created __proto__ is set to the original prototype property of the object’s constructor function. getPrototypeOf is the preferred method of getting “the prototype”.

The following patterns are considered warnings:

var a = obj.__proto__;

var a = obj["__proto__"];

The following patterns are considered okay and could be used alternatively:

var a = Object.getPrototypeOf(obj);

When not to use

If you need to support legacy browsers, you might want to turn this rule off, since support for getPrototypeOf is not yet universal.

Further Reading

Version

This rule was introduced in ESLint 0.0.9.

Resources