Skip to content

How to address consistent-return & array-callback-return with condition #2082

@gplusdotgr

Description

@gplusdotgr

How should I properly address the following:

const things = [
  {
    toy: 'lego',
  },
  {
    ball: 'football',
  },
  {
    series: 'spongebob',
  },
]

const newThings = things.map((item) => {
  if (item.toy) {
    return item.toy.toUpperCase();
  }
}).filter((n) => n);

// eslint error for consistent-return & array-callback-return

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions