Skip to content

no-expression-statements: shouldn't flag yield statements #567

@danielnixon

Description

@danielnixon

Bug Report

For the purposes of the no-expression-statements rule, I think a yield statement should be treated like a return statement, i.e., not flagged as a lint issue.

export function* mySaga() {
  // Flagged by functional/no-expression-statements
  yield "hello";

  // Not flagged
  return "hello";
}

Expected behavior

yield xyz not flagged

Actual behavior

yield xyz flagged

Steps to reproduce

See example above.

Proposed changes

Add a dedicated special case to checkExpressionStatement for yield statements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    AcceptedThis issue or PR has been accepted.Type: BugInconsistencies or issues which will cause a problem for users or implementors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions