UNPKG

e-lado

Version:

[![CircleCI](https://circleci.com/gh/sharetribe/sharetribe/tree/master.svg?style=svg)](https://circleci.com/gh/sharetribe/sharetribe/tree/master) [![Dependency Status](https://gemnasium.com/sharetribe/sharetribe.png)](https://gemnasium.com/sharetribe/shar

38 lines (28 loc) 884 B
/** * @fileoverview Rule to flag statements with function invocation preceded by * "new" and not part of assignment * @author Ilya Volodin */ "use strict"; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ module.exports = { meta: { docs: { description: "disallow `new` operators outside of assignments or comparisons", category: "Best Practices", recommended: false }, schema: [] }, create(context) { return { ExpressionStatement(node) { if (node.expression.type === "NewExpression") { context.report({ node, message: "Do not use 'new' for side effects." }); } } }; } };