246720c2c4abd5cae464c290763f0f00e0512e63
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Rule to flag use of an object property of the global object (Math and JSON) as a function
3  * @author James Allardice
4  */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Rule Definition
10 //------------------------------------------------------------------------------
11
12 module.exports = function(context) {
13
14     return {
15         "CallExpression": function(node) {
16
17             if (node.callee.type === "Identifier") {
18                 var name = node.callee.name;
19                 if (name === "Math" || name === "JSON") {
20                     context.report(node, "'{{name}}' is not a function.", { name: name });
21                 }
22             }
23         }
24     };
25
26 };