UNPKG

596 BJavaScriptView Raw
1/**
2 * @fileoverview A rule to disallow calls to the Object constructor
3 * @author Matt DuVall <http://www.mattduvall.com/>
4 */
5
6//------------------------------------------------------------------------------
7// Rule Definition
8//------------------------------------------------------------------------------
9
10module.exports = function(context) {
11
12 "use strict";
13
14 return {
15
16 "NewExpression": function(node) {
17 if (node.callee.name === "Object") {
18 context.report(node, "The object literal notation {} is preferrable.");
19 }
20 }
21 };
22
23};