]> git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-proto.js
e6659e59c6bc274288b9b51c5d9940e348ce5606
[pve-eslint.git] / eslint / lib / rules / no-proto.js
1 /**
2 * @fileoverview Rule to flag usage of __proto__ property
3 * @author Ilya Volodin
4 */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Requirements
10 //------------------------------------------------------------------------------
11
12 const { getStaticPropertyName } = require("./utils/ast-utils");
13
14 //------------------------------------------------------------------------------
15 // Rule Definition
16 //------------------------------------------------------------------------------
17
18 /** @type {import('../shared/types').Rule} */
19 module.exports = {
20 meta: {
21 type: "suggestion",
22
23 docs: {
24 description: "disallow the use of the `__proto__` property",
25 recommended: false,
26 url: "https://eslint.org/docs/rules/no-proto"
27 },
28
29 schema: [],
30
31 messages: {
32 unexpectedProto: "The '__proto__' property is deprecated."
33 }
34 },
35
36 create(context) {
37
38 return {
39
40 MemberExpression(node) {
41 if (getStaticPropertyName(node) === "__proto__") {
42 context.report({ node, messageId: "unexpectedProto" });
43 }
44 }
45 };
46
47 }
48 };