Skip to content

unicorn/empty-brace-spaces Style

🛠️ An auto-fix is available for this rule.

What it does

Removes the extra spaces or new line characters inside a pair of braces that does not contain additional code.

Why is this bad?

There should be no spaces inside a pair of braces as it affects the overall readability of the code.

Example

javascript
const a = {};
class A {}

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny unicorn/empty-brace-spaces
json
{
  "rules": {
    "unicorn/empty-brace-spaces": "error"
  }
}

References

Released under the MIT License.