84006f2dbd1a5d46de9844a11f00edc63f1774a3
[platform/framework/web/crosswalk-tizen.git] /
1 /**
2  * @fileoverview Disallow the use of process.exit()
3  * @author Nicholas C. Zakas
4  */
5 "use strict";
6
7 //------------------------------------------------------------------------------
8 // Rule Definition
9 //------------------------------------------------------------------------------
10
11 module.exports = function(context) {
12
13     //--------------------------------------------------------------------------
14     // Public
15     //--------------------------------------------------------------------------
16
17     return {
18
19         "CallExpression": function(node) {
20             var callee = node.callee;
21
22             if (callee.type === "MemberExpression" && callee.object.name === "process" &&
23                 callee.property.name === "exit"
24             ) {
25                 context.report(node, "Don't use process.exit(); throw an error instead.");
26             }
27         }
28
29     };
30
31 };