UNPKG

645 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"use strict";
8
9//------------------------------------------------------------------------------
10// Rule Definition
11//------------------------------------------------------------------------------
12
13module.exports = function(context) {
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};
26
27module.exports.schema = [];