Skip to content

Disallow empty block statements (no-empty) #796

@tunnckoCore

Description

@tunnckoCore

Digging more and more in ESLint rules, i found some good ones which enforces good style and more readable code. This issue is for no-empty rule - not fixable.

Suggested configuration.

{
  "no-empty": ["error", { "allowEmptyCatch": true }]
}

Never seen a point for doing such things. It is just waste of code and is messy, adding needless branches.

For what god reason this make sense

var foo = true // or false, no matter
if (foo) {}

I've seen such code here and there over the years, but mostly if i remember correctly it was because if-elseif combo like

let foo = true
if (foo) {
} else if (foo === 123) {
  // ok
}

But again, it not make any sense.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions