# no-new

> Disallow `new` when the created object is thrown away

`new Thing()` as a standalone statement creates an object and throws it away. Either a variable is missing, or the constructor is only called for its side effects. In that case a plain function says so more clearly.

{/* 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-new" = "error" # or "warn"
```

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

## Examples

Reported:

{/* bad */}
```js
new Router(routes);
```

Not reported:

{/* good */}
```js
const router = new Router(routes);

startRouter(routes);
```

## When not to use it

Some libraries start working from the constructor, for example `new Vue({ el: "#app" })`. If you use one, disable the rule on that line or turn it off.
