UNPKG

620 BJavaScriptView Raw
1/**
2 * @fileoverview Rule to flag statements with function invocation preceded by
3 * "new" and not part of assignment
4 * @author Ilya Volodin
5 */
6
7//------------------------------------------------------------------------------
8// Rule Definition
9//------------------------------------------------------------------------------
10
11module.exports = function(context) {
12
13 "use strict";
14
15 return {
16
17 "ExpressionStatement": function(node) {
18
19 if (node.expression.type === "NewExpression") {
20 context.report(node, "Do not use 'new' for side effects.");
21 }
22 }
23 };
24
25};