Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Linter · Rules

no-new-object

Disallow new Object() in favor of {}

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

Reported:

const headers = new Object();
headers.accept = "text/html";

Not reported:

const headers = { accept: "text/html" };