noProto
此内容尚不支持你的语言。
Summary
Section titled “Summary”- Rule available since:
v2.3.8 - Diagnostic Category:
lint/nursery/noProto - This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Same as
no-proto
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noProto": "error" } } }}Description
Section titled “Description”Disallow the use of the __proto__ property.
The use of __proto__ for getting or setting the prototype of an object
is deprecated. Use Object.getPrototypeOf() or
Object.setPrototypeOf() instead.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”obj.__proto__ = a;code-block.js:1:1 lint/nursery/noProto ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Unexpected use of __proto__.
> 1 │ obj.__proto__ = a;
│ ^^^^^^^^^^^^^
2 │
ℹ The use of __proto__ for getting or setting the prototype of an object is deprecated.
ℹ Use Object.getPrototypeOf() or Object.setPrototypeOf() instead.
const b = obj.__proto__;code-block.js:1:11 lint/nursery/noProto ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Unexpected use of __proto__.
> 1 │ const b = obj.__proto__;
│ ^^^^^^^^^^^^^
2 │
ℹ The use of __proto__ for getting or setting the prototype of an object is deprecated.
ℹ Use Object.getPrototypeOf() or Object.setPrototypeOf() instead.
const a = Object.getPrototypeOf(obj);Object.setPrototypeOf(obj, b);Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.