summaryrefslogtreecommitdiff
path: root/tools/eslint/lib/rules/no-new-object.js
diff options
context:
space:
mode:
Diffstat (limited to 'tools/eslint/lib/rules/no-new-object.js')
-rw-r--r--tools/eslint/lib/rules/no-new-object.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/tools/eslint/lib/rules/no-new-object.js b/tools/eslint/lib/rules/no-new-object.js
new file mode 100644
index 0000000000..426d7129da
--- /dev/null
+++ b/tools/eslint/lib/rules/no-new-object.js
@@ -0,0 +1,23 @@
+/**
+ * @fileoverview A rule to disallow calls to the Object constructor
+ * @author Matt DuVall <http://www.mattduvall.com/>
+ */
+
+"use strict";
+
+//------------------------------------------------------------------------------
+// Rule Definition
+//------------------------------------------------------------------------------
+
+module.exports = function(context) {
+
+ return {
+
+ "NewExpression": function(node) {
+ if (node.callee.name === "Object") {
+ context.report(node, "The object literal notation {} is preferrable.");
+ }
+ }
+ };
+
+};