# no-object-constructor

> Disallow `Object()` and `new Object()` without an argument

`new Object()` and `Object()` without an argument make an empty object. `{}` does the same thing and is shorter.

A call with an argument isn't reported. It converts the argument to an object, which `{}` can't do.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"no-object-constructor" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 2} */}
```js
const cache = new Object();
const totals = Object();
```

Not reported:

{/* good */}
```js
const cache = {};
const totals = {};
const wrapped = Object(value);
```

A call to your own `Object` isn't reported either:

{/* good */}
```js
function build(Object) {
  return new Object();
}
```
