Skip to content

linter: no-fallthrough has some false positive effects when multiple cases present #6417

@pumano

Description

@pumano

in some edge cases (looks like problem in || and &&):

    const notification = { type: 'PRIMARY' };

    switch (true) {
      case notification.type === 'PRIMARY' || notification.type === 'SECONDARY':
        // TODO
        break;
      case notification.type === 'SECONDARY':
        // TODO
        break;
      case notification.type === 'OUTLINE' || notification.type === 'SECONDARY':
        // TODO
        break;
      case notification.type === 'ETC':
        // TODO
        break;
    }
    const notification = { type: 'PRIMARY' };
    const other = true;

    switch (true) {
      case notification.type === 'PRIMARY' && other:
        // TODO
        break;
      case notification.type === 'SECONDARY':
        // TODO
        break;
      case notification.type === 'OUTLINE' && other:
        // TODO
        break;
      case notification.type === 'ETC':
        // TODO
        break;
    }

Metadata

Metadata

Assignees

Labels

A-linterArea - LinterC-bugCategory - Bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions