no-new-object

Disallow new Object() in favor of {}

deprecated

new Object() creates the same empty object as {}. The literal is shorter and lets you list the properties in place.

ESLint has deprecated this rule. Use no-object-constructor instead, which also reports Object() without new.

Examples#

example.js1 problem
const headers = new Object();
headers.accept = "text/html";
example.jsNo problems
const headers = { accept: "text/html" };