Skip to content

eslint/no-empty Restriction ​

💡 A suggestion is available for this rule.

What it does ​

Disallows empty block statements

Why is this bad? ​

Empty block statements, while not technically errors, usually occur due to refactoring that wasn’t completed. They can cause confusion when reading code.

Example ​

javascript
if (condition) {
}

How to use ​

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

bash
oxlint --deny no-empty
json
{
  "rules": {
    "no-empty": "error"
  }
}

References ​

Released under the MIT License.