Skip to content

Rule Change: no-empty rule does not ignore empty switch statements with comments #20000

@jaymarvelz

Description

@jaymarvelz

What rule do you want to change?

no-empty

What change do you want to make?

Generate fewer warnings

How do you think the change should be implemented?

A new default behavior

Example code

switch (foo) {
  /* empty */
}

What does the rule currently do for this code?

The rule reports an error for the empty switch statement, even though it contains a comment.

What will the rule do after it's changed?

After the change, the rule will ignore switch statements that are empty but contain a comment, similar to how it handles other empty blocks.

Participation

  • I am willing to submit a pull request to implement this change.

Additional comments

No response

Metadata

Metadata

Assignees

Labels

acceptedThere is consensus among the team that this change meets the criteria for inclusionbugESLint is working incorrectlyruleRelates to ESLint's core rules

Type

No type

Projects

Status

Complete

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions