]>
git.proxmox.com Git - pve-eslint.git/blob - eslint/lib/rules/no-new-object.js
2 * @fileoverview A rule to disallow calls to the Object constructor
3 * @author Matt DuVall <http://www.mattduvall.com/>
8 //------------------------------------------------------------------------------
10 //------------------------------------------------------------------------------
12 const astUtils
= require("./utils/ast-utils");
14 //------------------------------------------------------------------------------
16 //------------------------------------------------------------------------------
18 /** @type {import('../shared/types').Rule} */
24 description
: "Disallow `Object` constructors",
26 url
: "https://eslint.org/docs/rules/no-new-object"
32 preferLiteral
: "The object literal notation {} is preferable."
39 const variable
= astUtils
.getVariableByName(
44 if (variable
&& variable
.identifiers
.length
> 0) {
48 if (node
.callee
.name
=== "Object") {
51 messageId
: "preferLiteral"