adc2f70c92f6cc99482d502733fe62e9b63d29bc
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Rule to flag when using constructor without parentheses
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         "NewExpression": function(node) {
17             var tokens = context.getTokens(node);
18             var prenticesTokens = tokens.filter(function(token) {
19                 return token.value === "(" || token.value === ")";
20             });
21             if (prenticesTokens.length < 2) {
22                 context.report(node, "Missing '()' invoking a constructor");
23             }
24         }
25     };
26
27 };