Skip to content

linter: array-callback-return false-positive #21485

@ai

Description

@ai

What version of Oxlint are you using?

1.60.0

What command did you run?

oxlint

What does your .oxlintrc.json (or oxlint.config.ts) config file look like?

{
  "rules": {
    "array-callback-return": "error"
  }
}

What happened?

function filterNested(allItems, group) {
  return Array.from(allItems).filter(item => {
    let current = item.parentElement
    while (current && current !== group) {
      if (current.getAttribute('aria-hidden') === 'true') {
        return false
      }
      current = current.parentElement
    }
    return true
  })
}

generates error:

eslint(array-callback-return): Callback for array method "Array.prototype.filter" does not return on all code paths

But all paths has return and ESLint does not report the same issue

Reproduction

Metadata

Metadata

Assignees

Labels

Type

Priority

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions