summaryrefslogtreecommitdiff
path: root/tools/node_modules/eslint/lib/rules/no-new.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/node_modules/eslint/lib/rules/no-new.js')
-rw-r--r--tools/node_modules/eslint/lib/rules/no-new.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/tools/node_modules/eslint/lib/rules/no-new.js b/tools/node_modules/eslint/lib/rules/no-new.js
new file mode 100644
index 0000000000..6e6025aac5
--- /dev/null
+++ b/tools/node_modules/eslint/lib/rules/no-new.js
@@ -0,0 +1,33 @@
+/**
+ * @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 > NewExpression"(node) {
+ context.report({ node: node.parent, message: "Do not use 'new' for side effects." });
+ }
+ };
+
+ }
+};