# no-proto

> Disallow the `__proto__` property

`object.__proto__` is a getter and setter that objects inherit from `Object.prototype`. An object made with `Object.create(null)` doesn't have it, so on that object `__proto__` is an ordinary property and reading it returns `undefined`. `Object.getPrototypeOf()` and `Object.setPrototypeOf()` work on every object.

Using `__proto__` as a key in an object literal sets the new object's prototype, and that isn't reported.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"no-proto" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 2} */}
```js
const parent = user.__proto__;
user["__proto__"] = admin;
```

Not reported:

{/* good */}
```js
const parent = Object.getPrototypeOf(user);
Object.setPrototypeOf(user, admin);

const guest = { __proto__: user, name: "guest" };
```
