---
title: "unicorn/empty-brace-spaces"
description: "Disallow spaces and line breaks inside empty braces"
# Generated by src/codegen/lint-rule-docs.ts. Do not edit below this line.
plugin: "unicorn"
aliases: []
kind: "suggestion"
category: "style"
default: "off"
fixable: "yes"
typeAware: false
deprecated: false
---

You can write an empty pair of braces as `{}`, `{ }` or over two lines. This rule keeps `{}`, so empty objects, blocks, function bodies and class bodies look the same everywhere.

Braces with a comment in them aren't empty, so they're left alone.

`--fix` removes the whitespace.

{/* 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]
"unicorn/empty-brace-spaces" = "error" # or "warn"
```

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

## Examples

Reported:

{/* bad {"count": 3} */}
```js
const cache = { };

function noop() {
}

class Store { }
```

Not reported:

{/* good */}
```js
const cache = {};

function noop() {}

class Store {}

try {
  cache.clear();
} catch {
  // Nothing to clean up.
}
```
