10b0683f9529f530ea07e0440297cc02886f9202
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Rule to flag nested ternary expressions
3  * @author Ian Christian Myers
4  */
5
6 "use strict";
7
8 //------------------------------------------------------------------------------
9 // Rule Definition
10 //------------------------------------------------------------------------------
11
12 module.exports = function(context) {
13
14     return {
15         "ConditionalExpression": function(node) {
16             if (node.alternate.type === "ConditionalExpression" ||
17                     node.consequent.type === "ConditionalExpression") {
18                 context.report(node, "Do not nest ternary expressions");
19             }
20         }
21     };
22 };