UNPKG

778 BJavaScriptView Raw
1/**
2 * @fileoverview Rule to flag usage of __proto__ property
3 * @author Ilya Volodin
4 */
5
6"use strict";
7
8//------------------------------------------------------------------------------
9// Rule Definition
10//------------------------------------------------------------------------------
11
12module.exports = function(context) {
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};
27
28module.exports.schema = [];