UNPKG

753 BJavaScriptView Raw
1/**
2 * @fileoverview Rule to flag usage of __proto__ property
3 * @author Ilya Volodin
4 */
5
6//------------------------------------------------------------------------------
7// Rule Definition
8//------------------------------------------------------------------------------
9
10module.exports = function(context) {
11
12 "use strict";
13
14 return {
15
16 "MemberExpression": function(node) {
17
18 if (node.property &&
19 (node.property.type === "Identifier" && node.property.name === "__proto__" && !node.computed) ||
20 (node.property.type === "Literal" && node.property.value === "__proto__")) {
21 context.report(node, "The '__proto__' property is deprecated.");
22 }
23 }
24 };
25
26};