canonical
Version:
Canonical code style linter and formatter for JavaScript, SCSS and CSS.
28 lines (19 loc) • 645 B
JavaScript
/**
* @fileoverview Rule to flag statements with function invocation preceded by
* "new" and not part of assignment
* @author Ilya Volodin
*/
;
//------------------------------------------------------------------------------
// Rule Definition
//------------------------------------------------------------------------------
module.exports = function(context) {
return {
"ExpressionStatement": function(node) {
if (node.expression.type === "NewExpression") {
context.report(node, "Do not use 'new' for side effects.");
}
}
};
};
module.exports.schema = [];