# empty-brace-spaces

Rule `unicorn/empty-brace-spaces`. Enforce no spaces between braces.

- Source: unicorn
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 12M weekly downloads of presets that enable it
- Trend: +40.1% last quarter
- Rank: #823 by reach, #1019 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/empty-brace-spaces` | no | safe | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/empty-brace-spaces.md) |
| Oxlint | `unicorn/empty-brace-spaces` | no | safe | plugin `unicorn`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/unicorn/empty-brace-spaces.html) |

## Code examples

### Incorrect: the rule reports this

```js
class Unicorn {
}
```

```js
try {
  foo();
} catch { }
```

### Correct: the rule accepts this

```js
class Unicorn {}
```

```js
try {
  foo();
} catch {}
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import unicorn from "eslint-plugin-unicorn";

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/empty-brace-spaces": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "unicorn/empty-brace-spaces": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/consistent-template-literal-escape](https://lintradar.dev/rules/unicorn/consistent-template-literal-escape.md): Enforce consistent style for escaping `${` in template literals.
- [unicorn/no-await-expression-member](https://lintradar.dev/rules/unicorn/no-await-expression-member.md): Disallow member access from await expression.
- [unicorn/consistent-assert](https://lintradar.dev/rules/unicorn/consistent-assert.md): Enforce consistent assertion style with `node:assert`.
- [unicorn/no-confusing-array-with](https://lintradar.dev/rules/unicorn/no-confusing-array-with.md): Disallow confusing uses of `Array#with()`.
- [unicorn/no-immediate-mutation](https://lintradar.dev/rules/unicorn/no-immediate-mutation.md): Disallow immediate mutation after assignment and initialization immediately after declaration.
- [unicorn/prefer-export-from](https://lintradar.dev/rules/unicorn/prefer-export-from.md): Prefer `export…from` when re-exporting.

---

Web page: https://lintradar.dev/rules/unicorn/empty-brace-spaces. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
