Skip to content

prefer-array-flat-map false positives for React.children #13531

@skovhus

Description

@skovhus

Latest oxlint. When applying auto-fix for prefer-array-flat-map introduces false positives for React.Children.

          React.Children.map(props.children, child => {
            if (typeof child === "string") {
              return child.split("+");
            }

            return "";
          })
            ?.flat()

ends up as

          React.Children.flatMap(props.children, child => {
            if (typeof child === "string") {
              return child.split("+");
            }

            return "";
          })

Note that React.Children is not an array.

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions