60ad5700f87f5c7d1406180d646c24f2724b4991
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Rule to flag when initializing to undefined
3  * @author Ilya Volodin
4  */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Rule Definition
10 //------------------------------------------------------------------------------
11
12 module.exports = function(context) {
13
14     return {
15
16         "VariableDeclarator": function(node) {
17             var name = node.id.name;
18             var init = node.init && node.init.name;
19
20             if (init === "undefined") {
21                 context.report(node, "It's not necessary to initialize '{{name}}' to undefined.", { name: name });
22             }
23         }
24     };
25
26 };